*** empty log message ***

This commit is contained in:
Christopher Faylor 2001-03-03 03:56:34 +00:00
parent 19ca46d5fb
commit 0312ede431
5 changed files with 171 additions and 171 deletions

View File

@ -38,7 +38,7 @@ details. */
#define MAX_AT_FILE_LEVEL 10
#define PREMAIN_LEN (sizeof(user_data->premain) / sizeof (user_data->premain[0]))
#define PREMAIN_LEN (sizeof (user_data->premain) / sizeof (user_data->premain[0]))
HANDLE NO_COPY hMainProc = NULL;
HANDLE NO_COPY hMainThread = NULL;
@ -356,7 +356,7 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
int n = 0;
char *p, *s;
int dos_spec = isdrive (word);
if (!dos_spec && isquote(*word) && word[1] && word[2])
if (!dos_spec && isquote (*word) && word[1] && word[2])
dos_spec = isdrive (word + 1);
/* We'll need more space if there are quoting characters in
@ -601,7 +601,7 @@ alloc_stack (child_info_fork *ci)
api_fatal ("fork: couldn't get stack info, %E");
if (sm.AllocationBase != ci->stacktop)
alloc_stack_hard_way (ci, b + sizeof(b) - 1);
alloc_stack_hard_way (ci, b + sizeof (b) - 1);
else
ci->stacksize = 0;
}
@ -872,7 +872,7 @@ _dll_crt0 ()
if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf)))
{
small_printf ("Sleeping %d, pid %u\n", atoi (buf), GetCurrentProcessId ());
Sleep (atoi(buf));
Sleep (atoi (buf));
}
#endif

View File

@ -1,6 +1,6 @@
/* debug.cc
Copyright 1998, 1999, 2000 Cygnus Solutions.
Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@ -31,7 +31,7 @@ typedef struct
} thread_info;
static NO_COPY thread_info threads[32] = {{0, NULL}}; // increase as necessary
#define NTHREADS (sizeof(threads) / sizeof(threads[0]))
#define NTHREADS (sizeof (threads) / sizeof (threads[0]))
void
threadname_init ()
@ -55,7 +55,7 @@ regthread (const char *name, DWORD tid)
}
int __stdcall
iscygthread()
iscygthread ()
{
DWORD tid = GetCurrentThreadId ();
if (tid != mainthread.id)
@ -256,7 +256,7 @@ add_handle (const char *func, int ln, HANDLE h, const char *name)
goto out; /* Already did this once */
}
if ((hl = newh()) == NULL)
if ((hl = newh ()) == NULL)
{
unlock_debug ();
system_printf ("couldn't allocate memory for %s(%d): %s(%p)",

View File

@ -204,30 +204,30 @@ fhandler_console::read (void *pv, size_t buflen)
#define control_key_state (input_rec.Event.KeyEvent.dwControlKeyState)
#ifdef DEBUGGING
/* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
if (input_rec.Event.KeyEvent.bKeyDown &&
virtual_key_code == VK_SCROLL &&
control_key_state & (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED) == LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED
)
{
set_raw_win32_keyboard_mode ( !raw_win32_keyboard_mode );
continue;
}
/* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
if (input_rec.Event.KeyEvent.bKeyDown &&
virtual_key_code == VK_SCROLL &&
control_key_state & (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED) == LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED
)
{
set_raw_win32_keyboard_mode (!raw_win32_keyboard_mode);
continue;
}
#endif
if (raw_win32_keyboard_mode)
{
__small_sprintf(tmp, "\033{%u;%u;%u;%u;%u;%luK",
input_rec.Event.KeyEvent.bKeyDown,
input_rec.Event.KeyEvent.wRepeatCount,
input_rec.Event.KeyEvent.wVirtualKeyCode,
input_rec.Event.KeyEvent.wVirtualScanCode,
input_rec.Event.KeyEvent.uChar.UnicodeChar,
input_rec.Event.KeyEvent.dwControlKeyState );
toadd = tmp;
nread = strlen (toadd);
break;
}
if (raw_win32_keyboard_mode)
{
__small_sprintf(tmp, "\033{%u;%u;%u;%u;%u;%luK",
input_rec.Event.KeyEvent.bKeyDown,
input_rec.Event.KeyEvent.wRepeatCount,
input_rec.Event.KeyEvent.wVirtualKeyCode,
input_rec.Event.KeyEvent.wVirtualScanCode,
input_rec.Event.KeyEvent.uChar.UnicodeChar,
input_rec.Event.KeyEvent.dwControlKeyState);
toadd = tmp;
nread = strlen (toadd);
break;
}
if (!input_rec.Event.KeyEvent.bKeyDown)
continue;
@ -244,8 +244,8 @@ fhandler_console::read (void *pv, size_t buflen)
continue;
nread = strlen (toadd);
}
else
{
else
{
tmp[1] = ich;
/* Need this check since US code page seems to have a bug when
converting a CTRL-U. */
@ -260,7 +260,7 @@ fhandler_console::read (void *pv, size_t buflen)
toadd = tmp;
nread++;
}
}
}
#undef ich
#undef wch
break;
@ -280,7 +280,7 @@ fhandler_console::read (void *pv, size_t buflen)
/* Did something other than a click occur? */
if (mouse_event.dwEventFlags)
continue;
/* If the mouse event occurred out of the area we can handle,
ignore it. */
int x = mouse_event.dwMousePosition.X;
@ -290,10 +290,10 @@ fhandler_console::read (void *pv, size_t buflen)
syscall_printf("mouse: position out of range");
continue;
}
/* Ignore unimportant mouse buttons */
mouse_event.dwButtonState &= 0x7;
/* This code assumes Windows never reports multiple button
events at the same time. */
int b = 0;
@ -323,10 +323,10 @@ fhandler_console::read (void *pv, size_t buflen)
b = 2;
strcpy(sz, "btn3 down");
}
/* Remember the current button state */
dwLastButtonState = mouse_event.dwButtonState;
/* If a button was pressed, remember the modifiers */
if (b != 3)
{
@ -338,9 +338,9 @@ fhandler_console::read (void *pv, size_t buflen)
if (mouse_event.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))
nModifiers |= 0x10;
}
b |= nModifiers;
/* We can now create the code. */
sprintf(tmp, "\033[M%c%c%c", b + ' ', x + ' ' + 1, y + ' ' + 1);
syscall_printf("mouse: %s at (%d,%d)", sz, x, y);
@ -537,15 +537,15 @@ fhandler_console::dup (fhandler_base *child)
fhc->dim_color = dim_color;
fhc->state_ = state_;
fhc->nargs_ = nargs_;
for ( int i = 0; i < MAXARGS; i++ )
for (int i = 0; i < MAXARGS; i++)
fhc->args_[i] = args_[i];
fhc->rarg = rarg;
fhc->saw_question_mark = saw_question_mark;
strncpy ( fhc->my_title_buf, my_title_buf, TITLESIZE + 1) ;
strncpy (fhc->my_title_buf, my_title_buf, TITLESIZE + 1) ;
fhc->current_win32_attr = current_win32_attr;
fhc->intensity = intensity;
fhc->intensity = intensity;
fhc->underline = underline;
fhc->blink = blink;
fhc->reverse = reverse;
@ -772,7 +772,7 @@ fhandler_console::fhandler_console (const char *name) :
underline_color = FOREGROUND_GREEN | FOREGROUND_BLUE;
state_ = normal;
nargs_ = 0;
for ( int i = 0; i < MAXARGS; i++ ) args_ [i] = 0;
for (int i = 0; i < MAXARGS; i++) args_ [i] = 0;
savex = savey = 0;
scroll_region.Top = 0;
scroll_region.Bottom = -1;
@ -785,9 +785,9 @@ fhandler_console::fhandler_console (const char *name) :
}
#define FOREGROUND_ATTR_MASK (FOREGROUND_RED | FOREGROUND_GREEN | \
FOREGROUND_BLUE | FOREGROUND_INTENSITY)
FOREGROUND_BLUE | FOREGROUND_INTENSITY)
#define BACKGROUND_ATTR_MASK (BACKGROUND_RED | BACKGROUND_GREEN | \
BACKGROUND_BLUE | BACKGROUND_INTENSITY)
BACKGROUND_BLUE | BACKGROUND_INTENSITY)
void
fhandler_console::set_default_attr ()
{
@ -802,26 +802,26 @@ fhandler_console::get_win32_attr ()
{
WORD win_fg = fg;
WORD win_bg = bg;
if ( reverse )
{
if (reverse)
{
WORD save_fg = win_fg;
win_fg = ( win_bg & BACKGROUND_RED ? FOREGROUND_RED : 0 ) |
( win_bg & BACKGROUND_GREEN ? FOREGROUND_GREEN : 0 ) |
( win_bg & BACKGROUND_BLUE ? FOREGROUND_BLUE : 0 ) |
( win_fg & FOREGROUND_INTENSITY );
win_bg = ( save_fg & FOREGROUND_RED ? BACKGROUND_RED : 0 ) |
( save_fg & FOREGROUND_GREEN ? BACKGROUND_GREEN : 0 ) |
( save_fg & FOREGROUND_BLUE ? BACKGROUND_BLUE : 0 ) |
( win_bg & BACKGROUND_INTENSITY );
win_fg = (win_bg & BACKGROUND_RED ? FOREGROUND_RED : 0) |
(win_bg & BACKGROUND_GREEN ? FOREGROUND_GREEN : 0) |
(win_bg & BACKGROUND_BLUE ? FOREGROUND_BLUE : 0) |
(win_fg & FOREGROUND_INTENSITY);
win_bg = (save_fg & FOREGROUND_RED ? BACKGROUND_RED : 0) |
(save_fg & FOREGROUND_GREEN ? BACKGROUND_GREEN : 0) |
(save_fg & FOREGROUND_BLUE ? BACKGROUND_BLUE : 0) |
(win_bg & BACKGROUND_INTENSITY);
}
if ( underline ) win_fg = underline_color;
if (underline) win_fg = underline_color;
/* emulate blink with bright background */
if ( blink ) win_bg |= BACKGROUND_INTENSITY;
if ( intensity == INTENSITY_INVISIBLE )
if (blink) win_bg |= BACKGROUND_INTENSITY;
if (intensity == INTENSITY_INVISIBLE)
win_fg = win_bg;
else if ( intensity == INTENSITY_BOLD )
else if (intensity == INTENSITY_BOLD)
win_fg |= FOREGROUND_INTENSITY;
return ( win_fg | win_bg );
return (win_fg | win_bg);
}
/*
@ -931,7 +931,7 @@ static const char base_chars[256] =
/*10 11 12 13 14 15 16 17 */ NOR, NOR, ERR, ERR, ERR, ERR, ERR, ERR,
/*18 19 1A 1B 1C 1D 1E 1F */ NOR, NOR, ERR, ESC, ERR, ERR, ERR, ERR,
/* ! " # $ % & ' */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
/*( ) * + , - . / */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
/*() * + , - . / */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
/*0 1 2 3 4 5 6 7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
/*8 9 : ; < = > ? */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
/*@ A B C D E F G */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
@ -974,32 +974,32 @@ fhandler_console::char_command (char c)
switch (args_[i])
{
case 0: /* normal color */
set_default_attr ();
set_default_attr ();
break;
case 1: /* bold */
intensity = INTENSITY_BOLD;
intensity = INTENSITY_BOLD;
break;
case 4:
case 4:
underline = 1;
break;
case 5: /* blink mode */
blink = TRUE;
blink = TRUE;
break;
case 7: /* reverse */
reverse = TRUE;
reverse = TRUE;
break;
case 8: /* invisible */
intensity = INTENSITY_INVISIBLE;
intensity = INTENSITY_INVISIBLE;
break;
case 9: /* dim */
intensity = INTENSITY_DIM;
intensity = INTENSITY_DIM;
break;
case 24:
underline = FALSE;
break;
case 27:
reverse = FALSE;
break;
case 24:
underline = FALSE;
break;
case 27:
reverse = FALSE;
break;
case 30: /* BLACK foreground */
fg = 0;
break;
@ -1024,9 +1024,9 @@ fhandler_console::char_command (char c)
case 37: /* WHITE foreg */
fg = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
break;
case 39:
fg = default_color & FOREGROUND_ATTR_MASK;
break;
case 39:
fg = default_color & FOREGROUND_ATTR_MASK;
break;
case 40: /* BLACK background */
bg = 0;
break;
@ -1051,12 +1051,12 @@ fhandler_console::char_command (char c)
case 47: /* WHITE background */
bg = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED;
break;
case 49:
bg = default_color & BACKGROUND_ATTR_MASK;
break;
case 49:
bg = default_color & BACKGROUND_ATTR_MASK;
break;
}
current_win32_attr = get_win32_attr ();
SetConsoleTextAttribute (get_output_handle (), current_win32_attr);
current_win32_attr = get_win32_attr ();
SetConsoleTextAttribute (get_output_handle (), current_win32_attr);
break;
case 'h':
case 'l':
@ -1069,10 +1069,10 @@ fhandler_console::char_command (char c)
syscall_printf("mouse support %sabled", use_mouse ? "en" : "dis");
break;
case 2000: /* Raw keyboard mode */
set_raw_win32_keyboard_mode ( (c == 'h') ? TRUE : FALSE );
break;
case 2000: /* Raw keyboard mode */
set_raw_win32_keyboard_mode ((c == 'h') ? TRUE : FALSE);
break;
default: /* Ignore */
syscall_printf("unknown h/l command: %d", args_[0]);
break;
@ -1251,7 +1251,7 @@ fhandler_console::write_normal (const unsigned char *src,
CharToOemBuff ((LPCSTR)src, buf, l2);
else
strncpy (buf, (LPCSTR)src, l2);
if (! WriteFile (get_output_handle (), buf, l2, &done, 0))
if (!WriteFile (get_output_handle (), buf, l2, &done, 0))
{
debug_printf ("write failed, handle %p", get_output_handle ());
__seterrno ();
@ -1335,7 +1335,7 @@ fhandler_console::write (const void *vsrc, size_t len)
if (*src == '[')
{
state_ = gotsquare;
saw_question_mark = FALSE;
saw_question_mark = FALSE;
for (nargs_ = 0; nargs_ < MAXARGS; nargs_++)
args_[nargs_] = 0;
nargs_ = 0;
@ -1354,7 +1354,7 @@ fhandler_console::write (const void *vsrc, size_t len)
}
else if (*src == 'c') /* Reset Linux terminal */
{
set_default_attr ();
set_default_attr ();
clear_screen (0, 0, -1, -1);
cursor_set (TRUE, 0, 0);
state_ = normal;

View File

@ -96,27 +96,27 @@ fhandler_dev_floppy::lseek (off_t offset, int whence)
PARTITION_INFORMATION pi;
DWORD bytes_read;
if ( !DeviceIoControl ( get_handle(),
if (!DeviceIoControl (get_handle(),
IOCTL_DISK_GET_DRIVE_GEOMETRY,
NULL, 0,
&di, sizeof (di),
&bytes_read, NULL) )
&bytes_read, NULL))
{
__seterrno ();
return -1;
}
debug_printf ( "disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
di.Cylinders.LowPart,
di.TracksPerCylinder,
di.SectorsPerTrack,
di.BytesPerSector );
if ( DeviceIoControl ( get_handle (),
di.BytesPerSector);
if (DeviceIoControl (get_handle (),
IOCTL_DISK_GET_PARTITION_INFO,
NULL, 0,
&pi, sizeof (pi),
&bytes_read, NULL ))
&bytes_read, NULL))
{
debug_printf ( "partition info: %ld (%ld)",
debug_printf ("partition info: %ld (%ld)",
pi.StartingOffset.LowPart,
pi.PartitionLength.LowPart);
drive_size = (long long) pi.PartitionLength.QuadPart;
@ -126,13 +126,13 @@ fhandler_dev_floppy::lseek (off_t offset, int whence)
drive_size = (long long) di.Cylinders.QuadPart * di.TracksPerCylinder *
di.SectorsPerTrack * di.BytesPerSector;
}
debug_printf ( "drive size: %ld", drive_size );
debug_printf ("drive size: %ld", drive_size);
}
if (whence == SEEK_END && drive_size > 0)
{
lloffset = offset + drive_size;
whence = SEEK_SET;
whence = SEEK_SET;
}
if (whence == SEEK_CUR)
@ -161,7 +161,7 @@ fhandler_dev_floppy::lseek (off_t offset, int whence)
}
high = lloffset >> 32;
low = lloffset & 0xffffffff;
if ( high || (off_t) low < 0 )
if (high || (off_t) low < 0)
{
set_errno (EFBIG);
return -1;

View File

@ -48,17 +48,17 @@ SYSTEM_INFO system_info;
void __stdcall
close_all_files (void)
{
SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
SetResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
fhandler_base *fh;
for (int i = 0; i < (int) fdtab.size; i++)
if ((fh = fdtab[i]) != NULL)
if ( (fh = fdtab[i]) != NULL)
{
fh->close ();
fdtab.release (i);
}
ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
cygwin_shared->delqueue.process_queue ();
}
@ -100,7 +100,7 @@ _unlink (const char *ourname)
int len = strlen (win32_name.get_win32 ());
if (len > 4 && !strcasecmp (win32_name.get_win32 () + len - 4, ".lnk"))
SetFileAttributes (win32_name.get_win32 (),
win32_name.file_attributes () & ~FILE_ATTRIBUTE_READONLY);
win32_name.file_attributes () & ~FILE_ATTRIBUTE_READONLY);
}
for (int i = 0; i < 2; i++)
@ -421,9 +421,9 @@ _open (const char *unix_path, int flags, ...)
sigframe thisframe (mainthread);
syscall_printf ("open (%s, %p)", unix_path, flags);
if (!check_null_empty_path_errno(unix_path))
if (!check_null_empty_path_errno (unix_path))
{
SetResourceLock(LOCK_FD_LIST, WRITE_LOCK|READ_LOCK, " open ");
SetResourceLock (LOCK_FD_LIST, WRITE_LOCK|READ_LOCK, " open ");
/* check for optional mode argument */
va_start (ap, flags);
@ -434,16 +434,16 @@ _open (const char *unix_path, int flags, ...)
if (fd < 0)
set_errno (ENMFILE);
else if ((fh = fdtab.build_fhandler (fd, unix_path, NULL)) == NULL)
else if ( (fh = fdtab.build_fhandler (fd, unix_path, NULL)) == NULL)
res = -1; // errno already set
else if (!fh->open (unix_path, flags, (mode & 0777) & ~cygheap->umask))
{
fdtab.release (fd);
res = -1;
}
else if ((res = fd) <= 2)
else if ( (res = fd) <= 2)
set_std_handle (res);
ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," open");
ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," open");
}
syscall_printf ("%d = open (%s, %p)", res, unix_path, flags);
@ -456,9 +456,9 @@ _lseek (int fd, off_t pos, int dir)
off_t res;
sigframe thisframe (mainthread);
if ( dir != SEEK_SET && dir != SEEK_CUR && dir != SEEK_END )
if (dir != SEEK_SET && dir != SEEK_CUR && dir != SEEK_END)
{
set_errno ( EINVAL );
set_errno (EINVAL);
res = -1;
}
else if (fdtab.not_open (fd))
@ -492,10 +492,10 @@ _close (int fd)
}
else
{
SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
SetResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
res = fdtab[fd]->close ();
fdtab.release (fd);
ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
}
syscall_printf ("%d = close (%d)", res, fd);
@ -604,7 +604,7 @@ _link (const char *a, const char *b)
/* Write the WIN32_STREAM_ID */
bSuccess = BackupWrite (
hFileSource,
(LPBYTE) &StreamId, // buffer to write
(LPBYTE) &StreamId, // buffer to write
StreamSize, // number of bytes to write
&dwBytesWritten,
FALSE, // don't abort yet
@ -618,7 +618,7 @@ _link (const char *a, const char *b)
Need to handle. */
bSuccess = BackupWrite (
hFileSource,
(LPBYTE) wbuf, // buffer to write
(LPBYTE) wbuf, // buffer to write
cbPathLen, // number of bytes to write
&dwBytesWritten,
FALSE, // don't abort yet
@ -668,7 +668,7 @@ rel2abssd (PSECURITY_DESCRIPTOR psd_rel, PSECURITY_DESCRIPTOR psd_abs,
DWORD abslen)
{
#ifdef _MT_SAFE
struct _winsup_t *r=_reent_winsup();
struct _winsup_t *r=_reent_winsup ();
char *dacl_buf=r->_dacl_buf;
char *sacl_buf=r->_sacl_buf;
char *ownr_buf=r->_ownr_buf;
@ -696,7 +696,7 @@ rel2abssd (PSECURITY_DESCRIPTOR psd_rel, PSECURITY_DESCRIPTOR psd_abs,
/* chown: POSIX 5.6.5.1 */
/*
* chown() is only implemented for Windows NT. Under other operating
* chown () is only implemented for Windows NT. Under other operating
* systems, it is only a stub that always returns zero.
*/
static int
@ -706,7 +706,7 @@ chown_worker (const char *name, unsigned fmode, uid_t uid, gid_t gid)
uid_t old_uid;
gid_t old_gid;
if (check_null_empty_path_errno(name))
if (check_null_empty_path_errno (name))
return -1;
if (os_being_run != winNT) // real chown only works on NT
@ -736,7 +736,7 @@ chown_worker (const char *name, unsigned fmode, uid_t uid, gid_t gid)
attrib |= S_IFDIR;
res = get_file_attribute (win32_path.has_acls (),
win32_path.get_win32 (),
(int *) &attrib,
(int *) &attrib,
&old_uid,
&old_gid);
if (!res)
@ -940,7 +940,7 @@ num_entries (const char *win32_name)
count ++;
while (FindNextFileA (handle, &buf))
{
if ((buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
if ( (buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
count ++;
}
FindClose (handle);
@ -1076,7 +1076,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
strcpy (root, real_path.get_win32 ());
dtype = GetDriveType (rootdir (root));
if ((atts == -1 || !(atts & FILE_ATTRIBUTE_DIRECTORY) ||
if ( (atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) ||
(os_being_run == winNT
&& dtype != DRIVE_NO_ROOT_DIR
&& dtype != DRIVE_UNKNOWN)))
@ -1089,7 +1089,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
in a failing open call in the same process. Check that
case. */
if (!oret && allow_ntsec && get_errno () == EACCES
&& !get_file_attribute (TRUE, real_path, &attribute, &uid, &gid)
&& !get_file_attribute (TRUE, real_path, &attribute, &uid, &gid)
&& !attribute && uid == myself->uid && gid == myself->gid)
{
set_file_attribute (TRUE, real_path, 0400);
@ -1098,7 +1098,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
set_file_attribute (TRUE, real_path.get_win32 (), 0);
}
if (oret)
{
{
res = fh.fstat (buf);
fh.close ();
/* The number of links to a directory includes the
@ -1106,14 +1106,14 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
those subdirectories point to it.
This is too slow on remote drives, so we do without it and
set the number of links to 2. */
/* Unfortunately the count of 2 confuses `find(1)' command. So
/* Unfortunately the count of 2 confuses `find (1)' command. So
let's try it with `1' as link count. */
if (atts != -1 && (atts & FILE_ATTRIBUTE_DIRECTORY))
buf->st_nlink = (dtype == DRIVE_REMOTE
? 1
? 1
: num_entries (real_path.get_win32 ()));
goto done;
}
}
}
if (atts != -1 || (!oret && get_errno () != ENOENT
&& get_errno () != ENOSHARE))
@ -1127,7 +1127,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
&& (atts & FILE_ATTRIBUTE_DIRECTORY)
&& dtype != DRIVE_REMOTE)
buf->st_nlink = num_entries (real_path.get_win32 ());
buf->st_dev = FHDEVN(FH_DISK) << 8;
buf->st_dev = FHDEVN (FH_DISK) << 8;
buf->st_ino = hash_path_name (0, real_path.get_win32 ());
if (atts != -1 && (atts & FILE_ATTRIBUTE_DIRECTORY))
buf->st_mode = S_IFDIR;
@ -1142,14 +1142,14 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
&buf->st_mode, &buf->st_uid, &buf->st_gid))
{
buf->st_mode |= STD_RBITS | STD_XBITS;
if ((atts & FILE_ATTRIBUTE_READONLY) == 0)
if ( (atts & FILE_ATTRIBUTE_READONLY) == 0)
buf->st_mode |= STD_WBITS;
if (real_path.issymlink ())
buf->st_mode |= S_IRWXU | S_IRWXG | S_IRWXO;
get_file_attribute (FALSE, real_path.get_win32 (),
NULL, &buf->st_uid, &buf->st_gid);
}
if ((handle = FindFirstFile (real_path.get_win32(), &wfd))
if ( (handle = FindFirstFile (real_path.get_win32 (), &wfd))
!= INVALID_HANDLE_VALUE)
{
buf->st_atime = to_time_t (&wfd.ftLastAccessTime);
@ -1157,7 +1157,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
buf->st_ctime = to_time_t (&wfd.ftCreationTime);
buf->st_size = wfd.nFileSizeLow;
buf->st_blksize = S_BLKSIZE;
buf->st_blocks = ((unsigned long) buf->st_size +
buf->st_blocks = ( (unsigned long) buf->st_size +
S_BLKSIZE-1) / S_BLKSIZE;
FindClose (handle);
}
@ -1192,7 +1192,7 @@ access (const char *fn, int flags)
{
sigframe thisframe (mainthread);
// flags were incorrectly specified
if (flags & ~(F_OK|R_OK|W_OK|X_OK))
if (flags & ~ (F_OK|R_OK|W_OK|X_OK))
{
set_errno (EINVAL);
return -1;
@ -1210,45 +1210,45 @@ access (const char *fn, int flags)
{
if (st.st_uid == myself->uid)
{
if (!(st.st_mode & S_IRUSR))
if (! (st.st_mode & S_IRUSR))
goto done;
}
else if (st.st_gid == myself->gid)
{
if (!(st.st_mode & S_IRGRP))
if (! (st.st_mode & S_IRGRP))
goto done;
}
else if (!(st.st_mode & S_IROTH))
else if (! (st.st_mode & S_IROTH))
goto done;
}
if (flags & W_OK)
{
if (st.st_uid == myself->uid)
{
if (!(st.st_mode & S_IWUSR))
if (! (st.st_mode & S_IWUSR))
goto done;
}
else if (st.st_gid == myself->gid)
{
if (!(st.st_mode & S_IWGRP))
if (! (st.st_mode & S_IWGRP))
goto done;
}
else if (!(st.st_mode & S_IWOTH))
else if (! (st.st_mode & S_IWOTH))
goto done;
}
if (flags & X_OK)
{
if (st.st_uid == myself->uid)
{
if (!(st.st_mode & S_IXUSR))
if (! (st.st_mode & S_IXUSR))
goto done;
}
else if (st.st_gid == myself->gid)
{
if (!(st.st_mode & S_IXGRP))
if (! (st.st_mode & S_IXGRP))
goto done;
}
else if (!(st.st_mode & S_IXOTH))
else if (! (st.st_mode & S_IXOTH))
goto done;
}
r = 0;
@ -1394,7 +1394,7 @@ system (const char *cmdstring)
command[2] = cmdstring;
command[3] = (const char *) NULL;
if ((res = spawnvp (_P_WAIT, "sh", command)) == -1)
if ( (res = spawnvp (_P_WAIT, "sh", command)) == -1)
{
// when exec fails, return value should be as if shell
// executed exit (127)
@ -1426,7 +1426,7 @@ extern "C" size_t
getpagesize ()
{
if (!system_info.dwPageSize)
GetSystemInfo(&system_info);
GetSystemInfo (&system_info);
return (int) system_info.dwPageSize;
}
@ -1503,7 +1503,7 @@ ttyname (int fd)
{
return 0;
}
return (char *)(fdtab[fd]->ttyname ());
return (char *) (fdtab[fd]->ttyname ());
}
extern "C" char *
@ -1523,39 +1523,39 @@ ctermid (char *str)
extern "C" int
_cygwin_istext_for_stdio (int fd)
{
syscall_printf("_cygwin_istext_for_stdio (%d)\n", fd);
syscall_printf ("_cygwin_istext_for_stdio (%d)\n", fd);
if (CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING)
{
syscall_printf(" _cifs: old API\n");
syscall_printf (" _cifs: old API\n");
return 0; /* we do it for old apps, due to getc/putc macros */
}
if (fdtab.not_open (fd))
{
syscall_printf(" _cifs: fd not open\n");
syscall_printf (" _cifs: fd not open\n");
return 0;
}
fhandler_base *p = fdtab[fd];
if (p->get_device() != FH_DISK)
if (p->get_device () != FH_DISK)
{
syscall_printf(" _cifs: fd not disk file\n");
syscall_printf (" _cifs: fd not disk file\n");
return 0;
}
if (p->get_w_binary () || p->get_r_binary ())
{
syscall_printf(" _cifs: get_*_binary\n");
syscall_printf (" _cifs: get_*_binary\n");
return 0;
}
syscall_printf("_cygwin_istext_for_stdio says yes\n");
syscall_printf ("_cygwin_istext_for_stdio says yes\n");
return 1;
}
/* internal newlib function */
extern "C" int _fwalk (struct _reent *ptr, int (*function)(FILE *));
extern "C" int _fwalk (struct _reent *ptr, int (*function) (FILE *));
static int setmode_mode;
static int setmode_file;
@ -1563,9 +1563,9 @@ static int setmode_file;
static int
setmode_helper (FILE *f)
{
if (fileno(f) != setmode_file)
if (fileno (f) != setmode_file)
return 0;
syscall_printf("setmode: file was %s now %s\n",
syscall_printf ("setmode: file was %s now %s\n",
f->_flags & __SCLE ? "cle" : "raw",
setmode_mode & O_TEXT ? "cle" : "raw");
if (setmode_mode & O_TEXT)
@ -1633,7 +1633,7 @@ setmode (int fd, int mode)
else
setmode_mode = O_BINARY;
setmode_file = fd;
_fwalk(_REENT, setmode_helper);
_fwalk (_REENT, setmode_helper);
syscall_printf ("setmode (%d, %s) returns %s\n", fd,
mode&O_TEXT ? "text" : "binary",
@ -1718,7 +1718,7 @@ get_osfhandle (int fd)
{
res = (long) fdtab[fd]->get_handle ();
}
syscall_printf ("%d = get_osfhandle(%d)", res, fd);
syscall_printf ("%d = get_osfhandle (%d)", res, fd);
return res;
}
@ -1733,7 +1733,7 @@ statfs (const char *fname, struct statfs *sfs)
return -1;
}
path_conv full_path(fname, PC_SYM_FOLLOW | PC_FULL);
path_conv full_path (fname, PC_SYM_FOLLOW | PC_FULL);
char *root = rootdir (full_path);
syscall_printf ("statfs %s", root);
@ -1859,7 +1859,7 @@ ptsname (int fd)
set_errno (EBADF);
return 0;
}
return (char *)(fdtab[fd]->ptsname ());
return (char *) (fdtab[fd]->ptsname ());
}
/* FIXME: what is this? */
@ -1924,30 +1924,30 @@ seteuid (uid_t uid)
if (uid != myself->uid)
if (uid == cygheap->user.orig_uid)
{
debug_printf ("RevertToSelf() (uid == orig_uid, token=%d)",
debug_printf ("RevertToSelf () (uid == orig_uid, token=%d)",
cygheap->user.token);
RevertToSelf();
RevertToSelf ();
if (cygheap->user.token != INVALID_HANDLE_VALUE)
cygheap->user.impersonated = FALSE;
}
else if (!cygheap->user.impersonated)
{
debug_printf ("Impersonate(uid == %d)", uid);
RevertToSelf();
debug_printf ("Impersonate (uid == %d)", uid);
RevertToSelf ();
if (cygheap->user.token != INVALID_HANDLE_VALUE)
if (!ImpersonateLoggedOnUser (cygheap->user.token))
system_printf ("Impersonate(%d) in set(e)uid failed: %E",
system_printf ("Impersonate (%d) in set (e)uid failed: %E",
cygheap->user.token);
else
cygheap->user.impersonated = TRUE;
}
cygheap_user user;
/* user.token is used in internal_getlogin() to determine if
/* user.token is used in internal_getlogin () to determine if
impersonation is active. If so, the token is used for
retrieving user's SID. */
user.token = cygheap->user.impersonated ? cygheap->user.token
: INVALID_HANDLE_VALUE;
: INVALID_HANDLE_VALUE;
struct passwd *pw_cur = getpwnam (internal_getlogin (user));
if (pw_cur != pw_new)
{
@ -1996,7 +1996,7 @@ chroot (const char *newroot)
{
sigframe thisframe (mainthread);
int ret = -1;
path_conv path(newroot, PC_SYM_FOLLOW | PC_FULL);
path_conv path (newroot, PC_SYM_FOLLOW | PC_FULL);
if (path.error)
goto done;
@ -2005,7 +2005,7 @@ chroot (const char *newroot)
set_errno (ENOENT);
goto done;
}
if (!(path.file_attributes () & FILE_ATTRIBUTE_DIRECTORY))
if (! (path.file_attributes () & FILE_ATTRIBUTE_DIRECTORY))
{
set_errno (ENOTDIR);
goto done;
@ -2068,7 +2068,7 @@ wcscmp (const wchar_t *s1, const wchar_t *s2)
s2++;
}
return (*(unsigned short *) s1) - (*(unsigned short *) s2);
return (* (unsigned short *) s1) - (* (unsigned short *) s2);
}
extern "C" size_t
@ -2203,7 +2203,7 @@ login (struct utmp *ut)
(void) write (fd, (char *) ut, sizeof (struct utmp));
(void) close (fd);
}
if ((fd = open (_PATH_WTMP, O_WRONLY | O_APPEND | O_BINARY, 0)) >= 0)
if ( (fd = open (_PATH_WTMP, O_WRONLY | O_APPEND | O_BINARY, 0)) >= 0)
{
(void) write (fd, (char *) ut, sizeof (struct utmp));
(void) close (fd);
@ -2211,7 +2211,7 @@ login (struct utmp *ut)
}
/* It isn't possible to use unix-style I/O function in logout code because
cygwin's I/O subsystem may be inaccessible at logout() call time.
cygwin's I/O subsystem may be inaccessible at logout () call time.
FIXME (cgf): huh?
*/
extern "C" int
@ -2243,7 +2243,7 @@ logout (char *line)
while (!res && ReadFile (ut_fd, ut_buf, sizeof ut_buf, &rd, NULL)
&& rd != 0)
{
struct utmp *ut_end = (struct utmp *) ((char *) ut_buf + rd);
struct utmp *ut_end = (struct utmp *) ( (char *) ut_buf + rd);
for (ut = ut_buf; ut < ut_end; ut++, pos += sizeof (*ut))
if (ut->ut_name[0]
@ -2257,7 +2257,7 @@ logout (char *line)
/* Now seek back to the position in utmp at which UT occured,
and write the new version of UT there. */
if ((SetFilePointer (ut_fd, pos, 0, FILE_BEGIN) != 0xFFFFFFFF)
if ( (SetFilePointer (ut_fd, pos, 0, FILE_BEGIN) != 0xFFFFFFFF)
&& (WriteFile (ut_fd, (char *) ut, sizeof (*ut),
&rd, NULL)))
{