Clean up whitespace.

This commit is contained in:
Christopher Faylor 2011-12-17 23:39:47 +00:00
parent 988d896c0a
commit 1b23b30b29
57 changed files with 893 additions and 894 deletions

View File

@ -140,7 +140,6 @@ cygthread::simplestub (VOID *arg)
info->callfunc (true); info->callfunc (true);
if (notify) if (notify)
SetEvent (notify); SetEvent (notify);
return 0; return 0;
} }

View File

@ -466,7 +466,7 @@ child_info_fork::alloc_stack ()
esp = getstack (esp); esp = getstack (esp);
stackaddr = 0; stackaddr = 0;
/* This only affects forked children of a process started from a native /* This only affects forked children of a process started from a native
64 bit process, but it doesn't hurt to do it unconditionally. Fix 64 bit process, but it doesn't hurt to do it unconditionally. Fix
StackBase in the child to be the same as in the parent, so that the StackBase in the child to be the same as in the parent, so that the
computation of _my_tls is correct. */ computation of _my_tls is correct. */
_tlsbase = (char *) stackbottom; _tlsbase = (char *) stackbottom;
@ -706,7 +706,7 @@ dll_crt0_0 ()
{ {
memory_init (true); memory_init (true);
/* WOW64 process? Check if we have been started from 64 bit process /* WOW64 process? Check if we have been started from 64 bit process
and if our stack is at an unusual address. Set wow64_has_64bit_parent and if our stack is at an unusual address. Set wow64_has_64bit_parent
if so. Problem description in wow64_test_for_64bit_parent. */ if so. Problem description in wow64_test_for_64bit_parent. */
if (wincap.is_wow64 ()) if (wincap.is_wow64 ())
wow64_has_64bit_parent = wow64_test_for_64bit_parent (); wow64_has_64bit_parent = wow64_test_for_64bit_parent ();

View File

@ -1303,7 +1303,7 @@ fhandler_pty_master::close ()
} }
/* This is just to catch error conditions. Since the constructor /* This is just to catch error conditions. Since the constructor
ctually opens some handles, and stat() does not open an fd, they need actually opens some handles, and stat() does not open an fd, they need
to be closed when the fhandler goes away. */ to be closed when the fhandler goes away. */
fhandler_pty_master::~fhandler_pty_master () fhandler_pty_master::~fhandler_pty_master ()
{ {

View File

@ -1028,7 +1028,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
} }
/* Wait for the blocking object and, for POSIX locks, its holding process. /* Wait for the blocking object and, for POSIX locks, its holding process.
Unfortunately, since BSD flock locks are not attached to a specific Unfortunately, since BSD flock locks are not attached to a specific
process, we can't recognize an abandoned lock by sync'ing with the process, we can't recognize an abandoned lock by sync'ing with the
creator process. We have to make sure the event object is in a creator process. We have to make sure the event object is in a
signalled state, or that it has gone away. The latter we can only signalled state, or that it has gone away. The latter we can only

View File

@ -3654,7 +3654,7 @@ public:
static void SetVersionFromPointer (PBYTE buf_p, bool is_buffer) static void SetVersionFromPointer (PBYTE buf_p, bool is_buffer)
{ {
/* Given a pointer to the FAST_CWD structure (is_buffer == false) or a /* Given a pointer to the FAST_CWD structure (is_buffer == false) or a
pointer to the Buffer within (is_buffer == true), this function pointer to the Buffer within (is_buffer == true), this function
computes the FAST_CWD version by checking that Path.MaximumLength computes the FAST_CWD version by checking that Path.MaximumLength
equals MAX_PATH, and that Path.Buffer == Buffer. */ equals MAX_PATH, and that Path.Buffer == Buffer. */
if (is_buffer) if (is_buffer)

View File

@ -102,7 +102,7 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp,
clock_gettime (clk_id, &tp); clock_gettime (clk_id, &tp);
/* Check for immediate timeout */ /* Check for immediate timeout */
if (tp.tv_sec > rqtp->tv_sec if (tp.tv_sec > rqtp->tv_sec
|| (tp.tv_sec == rqtp->tv_sec && tp.tv_nsec > rqtp->tv_nsec)) || (tp.tv_sec == rqtp->tv_sec && tp.tv_nsec > rqtp->tv_nsec))
return 0; return 0;
if (clk_id == CLOCK_REALTIME) if (clk_id == CLOCK_REALTIME)

View File

@ -82,15 +82,15 @@ wow64_test_for_64bit_parent ()
no simpler way to retrieve the parent process in NT, as far as I know. no simpler way to retrieve the parent process in NT, as far as I know.
Hints welcome. */ Hints welcome. */
ret = NtQueryInformationProcess (NtCurrentProcess (), ret = NtQueryInformationProcess (NtCurrentProcess (),
ProcessBasicInformation, ProcessBasicInformation,
&pbi, sizeof pbi, NULL); &pbi, sizeof pbi, NULL);
if (NT_SUCCESS (ret) if (NT_SUCCESS (ret)
&& (parent = OpenProcess (PROCESS_QUERY_INFORMATION, && (parent = OpenProcess (PROCESS_QUERY_INFORMATION,
FALSE, FALSE,
pbi.InheritedFromUniqueProcessId))) pbi.InheritedFromUniqueProcessId)))
{ {
NtQueryInformationProcess (parent, ProcessWow64Information, NtQueryInformationProcess (parent, ProcessWow64Information,
&wow64, sizeof wow64, NULL); &wow64, sizeof wow64, NULL);
CloseHandle (parent); CloseHandle (parent);
} }
return !wow64; return !wow64;

View File

@ -146,13 +146,13 @@ find_process_in_list (PSYSTEM_PROCESSES pslist, PUNICODE_STRING psname)
while (1) while (1)
{ {
if (pslist->ProcessName.Length && pslist->ProcessName.Buffer) if (pslist->ProcessName.Length && pslist->ProcessName.Buffer)
{ {
dbg_printf (("%S\n", pslist->ProcessName.Buffer)); dbg_printf (("%S\n", pslist->ProcessName.Buffer));
if (!_wcsicmp (pslist->ProcessName.Buffer, psname->Buffer)) if (!_wcsicmp (pslist->ProcessName.Buffer, psname->Buffer))
return true; return true;
} }
if (!pslist->NextEntryDelta) if (!pslist->NextEntryDelta)
break; break;
pslist = (PSYSTEM_PROCESSES)(pslist->NextEntryDelta + (char *)pslist); pslist = (PSYSTEM_PROCESSES)(pslist->NextEntryDelta + (char *)pslist);
}; };
return false; return false;
@ -168,7 +168,7 @@ find_module_in_list (PSYSTEM_MODULE_INFORMATION modlist, const char * const modn
dbg_printf (("name '%s' offset %d ", &modptr->ImageName[0], modptr->PathLength)); dbg_printf (("name '%s' offset %d ", &modptr->ImageName[0], modptr->PathLength));
dbg_printf (("= '%s'\n", &modptr->ImageName[modptr->PathLength])); dbg_printf (("= '%s'\n", &modptr->ImageName[modptr->PathLength]));
if (!_stricmp (&modptr->ImageName[modptr->PathLength], modname)) if (!_stricmp (&modptr->ImageName[modptr->PathLength], modname))
return true; return true;
modptr++; modptr++;
} }
return false; return false;
@ -185,45 +185,45 @@ expand_path (const char *path, char *outbuf)
while ((dst - outbuf) < MAX_PATH) while ((dst - outbuf) < MAX_PATH)
{ {
if (*path != '%') if (*path != '%')
{ {
if ((*dst++ = *path++) != 0) if ((*dst++ = *path++) != 0)
continue; continue;
break; break;
} }
/* Expand an environ var. */ /* Expand an environ var. */
end = path + 1; end = path + 1;
while (*end != '%') while (*end != '%')
{ {
/* Watch out for unterminated % */ /* Watch out for unterminated % */
if (*end++ == 0) if (*end++ == 0)
{ {
end = NULL; end = NULL;
break; break;
} }
} }
/* If we didn't find the end, can't expand it. */ /* If we didn't find the end, can't expand it. */
if ((end == NULL) || (end == (path + 1))) if ((end == NULL) || (end == (path + 1)))
{ {
/* Unterminated % so copy verbatim. */ /* Unterminated % so copy verbatim. */
*dst++ = *path++; *dst++ = *path++;
continue; continue;
} }
/* Expand the environment var into the new path. */ /* Expand the environment var into the new path. */
if ((end - (path + 1)) >= MAX_PATH) if ((end - (path + 1)) >= MAX_PATH)
return -1; return -1;
memcpy (envvar, path + 1, end - (path + 1)); memcpy (envvar, path + 1, end - (path + 1));
envvar[end - (path + 1)] = 0; envvar[end - (path + 1)] = 0;
envval = getenv (envvar); envval = getenv (envvar);
/* If not found, copy env var name verbatim. */ /* If not found, copy env var name verbatim. */
if (envval == NULL) if (envval == NULL)
{ {
*dst++ = *path++; *dst++ = *path++;
continue; continue;
} }
/* Check enough room before copying. */ /* Check enough room before copying. */
len = strlen (envval); len = strlen (envval);
if ((dst + len - outbuf) >= MAX_PATH) if ((dst + len - outbuf) >= MAX_PATH)
return false; return false;
memcpy (dst, envval, len); memcpy (dst, envval, len);
dst += len; dst += len;
/* And carry on past the end of env var name. */ /* And carry on past the end of env var name. */
@ -248,39 +248,39 @@ detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYST
case HKLMKEY: case HKLMKEY:
dbg_printf (("Detect reg key hklm '%s'... ", det->param)); dbg_printf (("Detect reg key hklm '%s'... ", det->param));
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS) if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS)
{ {
RegCloseKey (hk); RegCloseKey (hk);
dbg_printf (("found!\n")); dbg_printf (("found!\n"));
return true; return true;
} }
break; break;
case HKCUKEY: case HKCUKEY:
dbg_printf (("Detect reg key hkcu '%s'... ", det->param)); dbg_printf (("Detect reg key hkcu '%s'... ", det->param));
if (RegOpenKeyEx (HKEY_CURRENT_USER, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS) if (RegOpenKeyEx (HKEY_CURRENT_USER, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS)
{ {
RegCloseKey (hk); RegCloseKey (hk);
dbg_printf (("found!\n")); dbg_printf (("found!\n"));
return true; return true;
} }
break; break;
case FILENAME: case FILENAME:
dbg_printf (("Detect filename '%s'... ", det->param)); dbg_printf (("Detect filename '%s'... ", det->param));
if (!expand_path (det->param, expandedname)) if (!expand_path (det->param, expandedname))
{ {
printf ("Expansion failure!\n"); printf ("Expansion failure!\n");
break; break;
} }
dbg_printf (("('%s' after expansion)... ", expandedname)); dbg_printf (("('%s' after expansion)... ", expandedname));
fh = CreateFile (expandedname, 0, FILE_SHARE_READ | FILE_SHARE_WRITE fh = CreateFile (expandedname, 0, FILE_SHARE_READ | FILE_SHARE_WRITE
| FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL); | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL);
if (fh != INVALID_HANDLE_VALUE) if (fh != INVALID_HANDLE_VALUE)
{ {
CloseHandle (fh); CloseHandle (fh);
dbg_printf (("found!\n")); dbg_printf (("found!\n"));
return true; return true;
} }
break; break;
case PROCESSNAME: case PROCESSNAME:
@ -290,26 +290,26 @@ detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYST
ansiname.Buffer = (CHAR *) det->param; ansiname.Buffer = (CHAR *) det->param;
rv = RtlAnsiStringToUnicodeString (&unicodename, &ansiname, TRUE); rv = RtlAnsiStringToUnicodeString (&unicodename, &ansiname, TRUE);
if (rv != STATUS_SUCCESS) if (rv != STATUS_SUCCESS)
{ {
printf ("Ansi to unicode conversion failure $%08x\n", (unsigned int) rv); printf ("Ansi to unicode conversion failure $%08x\n", (unsigned int) rv);
break; break;
} }
found = find_process_in_list (pslist, &unicodename); found = find_process_in_list (pslist, &unicodename);
RtlFreeUnicodeString (&unicodename); RtlFreeUnicodeString (&unicodename);
if (found) if (found)
{ {
dbg_printf (("found!\n")); dbg_printf (("found!\n"));
return true; return true;
} }
break; break;
case HOOKDLLNAME: case HOOKDLLNAME:
dbg_printf (("Detect hookdll '%s'... ", det->param)); dbg_printf (("Detect hookdll '%s'... ", det->param));
if (find_module_in_list (modlist, det->param)) if (find_module_in_list (modlist, det->param))
{ {
dbg_printf (("found!\n")); dbg_printf (("found!\n"));
return true; return true;
} }
break; break;
} }
@ -324,7 +324,7 @@ find_dodgy_app_info (enum bad_app which_app)
for (i = 0; i < num_of_dodgy_apps; i++) for (i = 0; i < num_of_dodgy_apps; i++)
{ {
if (big_list_of_dodgy_apps[i].app_id == which_app) if (big_list_of_dodgy_apps[i].app_id == which_app)
return &big_list_of_dodgy_apps[i]; return &big_list_of_dodgy_apps[i];
} }
return NULL; return NULL;
} }
@ -357,50 +357,50 @@ dump_dodgy_apps (int verbose)
/* Not found would mean we coded the lists bad. */ /* Not found would mean we coded the lists bad. */
assert (found); assert (found);
if (detected) if (detected)
{ {
++n_det; ++n_det;
found->found_it |= (1 << det->type); found->found_it |= (1 << det->type);
} }
} }
if (n_det) if (n_det)
{ {
printf ("\nPotential app conflicts:\n\n"); printf ("\nPotential app conflicts:\n\n");
for (i = 0; i < num_of_dodgy_apps; i++) for (i = 0; i < num_of_dodgy_apps; i++)
{ {
if (big_list_of_dodgy_apps[i].found_it) if (big_list_of_dodgy_apps[i].found_it)
{ {
printf ("%s%s", big_list_of_dodgy_apps[i].details, printf ("%s%s", big_list_of_dodgy_apps[i].details,
verbose ? "\nDetected: " : ".\n"); verbose ? "\nDetected: " : ".\n");
if (!verbose) if (!verbose)
continue; continue;
const char *sep = ""; const char *sep = "";
if (big_list_of_dodgy_apps[i].found_it & (1 << HKLMKEY)) if (big_list_of_dodgy_apps[i].found_it & (1 << HKLMKEY))
{ {
printf ("HKLM Registry Key"); printf ("HKLM Registry Key");
sep = ", "; sep = ", ";
} }
if (big_list_of_dodgy_apps[i].found_it & (1 << HKCUKEY)) if (big_list_of_dodgy_apps[i].found_it & (1 << HKCUKEY))
{ {
printf ("%sHKCU Registry Key", sep); printf ("%sHKCU Registry Key", sep);
sep = ", "; sep = ", ";
} }
if (big_list_of_dodgy_apps[i].found_it & (1 << FILENAME)) if (big_list_of_dodgy_apps[i].found_it & (1 << FILENAME))
{ {
printf ("%sNamed file", sep); printf ("%sNamed file", sep);
sep = ", "; sep = ", ";
} }
if (big_list_of_dodgy_apps[i].found_it & (1 << PROCESSNAME)) if (big_list_of_dodgy_apps[i].found_it & (1 << PROCESSNAME))
{ {
printf ("%sNamed process", sep); printf ("%sNamed process", sep);
sep = ", "; sep = ", ";
} }
if (big_list_of_dodgy_apps[i].found_it & (1 << HOOKDLLNAME)) if (big_list_of_dodgy_apps[i].found_it & (1 << HOOKDLLNAME))
{ {
printf ("%sLoaded hook DLL", sep); printf ("%sLoaded hook DLL", sep);
} }
printf (".\n\n"); printf (".\n\n");
} }
} }
} }
/* Tidy up allocations. */ /* Tidy up allocations. */
free (pslist); free (pslist);

View File

@ -884,7 +884,7 @@ find_app_on_path (const char *app, bool showall = false)
if (!CloseHandle (fh)) if (!CloseHandle (fh))
display_error ("find_app_on_path: CloseHandle()"); display_error ("find_app_on_path: CloseHandle()");
/* FIXME: We leak the ptr returned by cygpath() here which is a /* FIXME: We leak the ptr returned by cygpath() here which is a
malloc()d string. */ malloc()d string. */
return find_app_on_path (ptr, showall); return find_app_on_path (ptr, showall);
} }
@ -1250,7 +1250,7 @@ handle_reg_installation (handle_reg_t what)
{ {
char *path = data + 4; char *path = data + 4;
if (path[1] != ':') if (path[1] != ':')
*(path += 2) = '\\'; *(path += 2) = '\\';
if (what == PRINT_KEY) if (what == PRINT_KEY)
printf (" %s Key: %s Path: %s", i ? "User: " : "System:", printf (" %s Key: %s Path: %s", i ? "User: " : "System:",
name, path); name, path);
@ -1286,14 +1286,14 @@ del_orphaned_reg_installations ()
/* Unfortunately neither mingw nor Windows know this function. */ /* Unfortunately neither mingw nor Windows know this function. */
char * char *
memmem (char *haystack, size_t haystacklen, memmem (char *haystack, size_t haystacklen,
const char *needle, size_t needlelen) const char *needle, size_t needlelen)
{ {
if (needlelen == 0) if (needlelen == 0)
return haystack; return haystack;
while (needlelen <= haystacklen) while (needlelen <= haystacklen)
{ {
if (!memcmp (haystack, needle, needlelen)) if (!memcmp (haystack, needle, needlelen))
return haystack; return haystack;
haystack++; haystack++;
haystacklen--; haystacklen--;
} }
@ -1449,7 +1449,7 @@ dump_sysinfo ()
#define PRODUCT_UNLICENSED 0xabcdabcd #define PRODUCT_UNLICENSED 0xabcdabcd
#define PRODUCT_ULTIMATE_E 0x00000047 #define PRODUCT_ULTIMATE_E 0x00000047
const char *products[] = const char *products[] =
{ {
/* 0x00000000 */ "", /* 0x00000000 */ "",
/* 0x00000001 */ " Ultimate", /* 0x00000001 */ " Ultimate",
/* 0x00000002 */ " Home Basic", /* 0x00000002 */ " Home Basic",
@ -1524,11 +1524,11 @@ dump_sysinfo ()
/* 0x00000047 */ " Ultimate E" /* 0x00000047 */ " Ultimate E"
}; };
if (prod == PRODUCT_UNLICENSED) if (prod == PRODUCT_UNLICENSED)
strcat (osname, "Unlicensed"); strcat (osname, "Unlicensed");
else if (prod > PRODUCT_ULTIMATE_E) else if (prod > PRODUCT_ULTIMATE_E)
strcat (osname, ""); strcat (osname, "");
else else
strcat (osname, products[prod]); strcat (osname, products[prod]);
} }
else else
{ {
@ -1540,7 +1540,7 @@ dump_sysinfo ()
{ {
strcpy (osname, "2000"); strcpy (osname, "2000");
if (osversion.wProductType == VER_NT_WORKSTATION) if (osversion.wProductType == VER_NT_WORKSTATION)
strcat (osname, " Professional"); strcat (osname, " Professional");
else if (osversion.wSuiteMask & VER_SUITE_DATACENTER) else if (osversion.wSuiteMask & VER_SUITE_DATACENTER)
strcat (osname, " Datacenter Server"); strcat (osname, " Datacenter Server");
else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE) else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE)
@ -1566,7 +1566,7 @@ dump_sysinfo ()
{ {
strcpy (osname, "2003 Server"); strcpy (osname, "2003 Server");
if (GetSystemMetrics (SM_SERVERR2)) if (GetSystemMetrics (SM_SERVERR2))
strcat (osname, " R2"); strcat (osname, " R2");
if (osversion.wSuiteMask & VER_SUITE_BLADE) if (osversion.wSuiteMask & VER_SUITE_BLADE)
strcat (osname, " Web Edition"); strcat (osname, " Web Edition");
else if (osversion.wSuiteMask & VER_SUITE_DATACENTER) else if (osversion.wSuiteMask & VER_SUITE_DATACENTER)
@ -1574,18 +1574,18 @@ dump_sysinfo ()
else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE) else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE)
strcat (osname, " Enterprise Edition"); strcat (osname, " Enterprise Edition");
else if (osversion.wSuiteMask & VER_SUITE_COMPUTE_SERVER) else if (osversion.wSuiteMask & VER_SUITE_COMPUTE_SERVER)
strcat (osname, " Compute Cluster Edition"); strcat (osname, " Compute Cluster Edition");
} }
} }
else if (osversion.dwMajorVersion == 4) else if (osversion.dwMajorVersion == 4)
{ {
strcpy (osname, "NT 4"); strcpy (osname, "NT 4");
if (more_info) if (more_info)
{ {
if (osversion.wProductType == VER_NT_WORKSTATION) if (osversion.wProductType == VER_NT_WORKSTATION)
strcat (osname, " Workstation"); strcat (osname, " Workstation");
else else
{ {
strcat (osname, " Server"); strcat (osname, " Server");
if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE) if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE)
strcat (osname, " Enterprise Edition"); strcat (osname, " Enterprise Edition");
@ -1733,12 +1733,12 @@ dump_sysinfo ()
printf ("Use '-r' to scan registry\n\n"); printf ("Use '-r' to scan registry\n\n");
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\kernel", "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\kernel",
0, KEY_READ, &key) == ERROR_SUCCESS) 0, KEY_READ, &key) == ERROR_SUCCESS)
{ {
DWORD size; DWORD size;
RegQueryValueEx (key, "obcaseinsensitive", NULL, NULL, RegQueryValueEx (key, "obcaseinsensitive", NULL, NULL,
(LPBYTE) &obcaseinsensitive, &size); (LPBYTE) &obcaseinsensitive, &size);
RegCloseKey (key); RegCloseKey (key);
} }
printf ("obcaseinsensitive set to %lu\n\n", obcaseinsensitive); printf ("obcaseinsensitive set to %lu\n\n", obcaseinsensitive);
@ -1930,7 +1930,7 @@ dump_sysinfo ()
if (strcasecmp (f, "cygwin1.dll") == 0) if (strcasecmp (f, "cygwin1.dll") == 0)
{ {
if (!cygwin_dll_count) if (!cygwin_dll_count)
strcpy (cygdll_path, pth->dir); strcpy (cygdll_path, pth->dir);
if (!cygwin_dll_count if (!cygwin_dll_count
|| strcasecmp (cygdll_path, pth->dir) != 0) || strcasecmp (cygdll_path, pth->dir) != 0)
cygwin_dll_count++; cygwin_dll_count++;
@ -2184,32 +2184,32 @@ At least one command option or a PROGRAM is required, as shown above.\n\
\n\ \n\
PROGRAM list library (DLL) dependencies of PROGRAM\n\ PROGRAM list library (DLL) dependencies of PROGRAM\n\
-c, --check-setup show installed version of PACKAGE and verify integrity\n\ -c, --check-setup show installed version of PACKAGE and verify integrity\n\
(or for all installed packages if none specified)\n\ (or for all installed packages if none specified)\n\
-d, --dump-only just list packages, do not verify (with -c)\n\ -d, --dump-only just list packages, do not verify (with -c)\n\
-s, --sysinfo produce diagnostic system information (implies -c)\n\ -s, --sysinfo produce diagnostic system information (implies -c)\n\
-r, --registry also scan registry for Cygwin settings (with -s)\n\ -r, --registry also scan registry for Cygwin settings (with -s)\n\
-k, --keycheck perform a keyboard check session (must be run from a\n\ -k, --keycheck perform a keyboard check session (must be run from a\n\
plain console only, not from a pty/rxvt/xterm)\n\ plain console only, not from a pty/rxvt/xterm)\n\
-f, --find-package find the package to which FILE belongs\n\ -f, --find-package find the package to which FILE belongs\n\
-l, --list-package list contents of PACKAGE (or all packages if none given)\n\ -l, --list-package list contents of PACKAGE (or all packages if none given)\n\
-p, --package-query search for REGEXP in the entire cygwin.com package\n\ -p, --package-query search for REGEXP in the entire cygwin.com package\n\
repository (requires internet connectivity)\n\ repository (requires internet connectivity)\n\
--delete-orphaned-installation-keys\n\ --delete-orphaned-installation-keys\n\
Delete installation keys of old, now unused\n\ Delete installation keys of old, now unused\n\
installations from the registry. Requires the right\n\ installations from the registry. Requires the right\n\
to change the registry.\n\ to change the registry.\n\
--enable-unique-object-names Cygwin-DLL\n\ --enable-unique-object-names Cygwin-DLL\n\
--disable-unique-object-names Cygwin-DLL\n\ --disable-unique-object-names Cygwin-DLL\n\
--show-unique-object-names Cygwin-DLL\n\ --show-unique-object-names Cygwin-DLL\n\
Enable, disable, or show the setting of the\n\ Enable, disable, or show the setting of the\n\
\"unique object names\" setting in the Cygwin DLL\n\ \"unique object names\" setting in the Cygwin DLL\n\
given as argument to this option. The DLL path must\n\ given as argument to this option. The DLL path must\n\
be given as valid Windows(!) path.\n\ be given as valid Windows(!) path.\n\
See the users guide for more information.\n\ See the users guide for more information.\n\
If you don't know what this means, don't change it.\n\ If you don't know what this means, don't change it.\n\
-v, --verbose produce more verbose output\n\ -v, --verbose produce more verbose output\n\
-h, --help annotate output with explanatory comments when given\n\ -h, --help annotate output with explanatory comments when given\n\
with another command, otherwise print this help\n\ with another command, otherwise print this help\n\
-V, --version print the version of cygcheck and exit\n\ -V, --version print the version of cygcheck and exit\n\
\n\ \n\
Note: -c, -f, and -l only report on packages that are currently installed. To\n\ Note: -c, -f, and -l only report on packages that are currently installed. To\n\
@ -2362,12 +2362,12 @@ main (int argc, char **argv)
givehelp = 1; givehelp = 1;
break; break;
case CO_DELETE_KEYS: case CO_DELETE_KEYS:
del_orphaned_reg = 1; del_orphaned_reg = 1;
break; break;
case CO_ENABLE_UON: case CO_ENABLE_UON:
case CO_DISABLE_UON: case CO_DISABLE_UON:
case CO_SHOW_UON: case CO_SHOW_UON:
unique_object_name_opt = i; unique_object_name_opt = i;
break; break;
case 'V': case 'V':
print_version (); print_version ();

View File

@ -223,7 +223,7 @@ could_not_access (int verbose, char *filename, char *package, const char *type)
} }
static const WCHAR tfx_chars[] = { static const WCHAR tfx_chars[] = {
0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3, 0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3,
0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7, 0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7,
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11, 0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15, 0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15,
@ -231,29 +231,29 @@ static const WCHAR tfx_chars[] = {
0xf000 | 20, 0xf000 | 21, 0xf000 | 22, 0xf000 | 23, 0xf000 | 20, 0xf000 | 21, 0xf000 | 22, 0xf000 | 23,
0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27, 0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27,
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31, 0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
' ', '!', 0xf000 | '"', '#', ' ', '!', 0xf000 | '"', '#',
'$', '%', '&', 39, '$', '%', '&', 39,
'(', ')', 0xf000 | '*', '+', '(', ')', 0xf000 | '*', '+',
',', '-', '.', '\\', ',', '-', '.', '\\',
'0', '1', '2', '3', '0', '1', '2', '3',
'4', '5', '6', '7', '4', '5', '6', '7',
'8', '9', 0xf000 | ':', ';', '8', '9', 0xf000 | ':', ';',
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?', 0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
'@', 'A', 'B', 'C', '@', 'A', 'B', 'C',
'D', 'E', 'F', 'G', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', 'X', 'Y', 'Z', '[',
'\\', ']', '^', '_', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', '`', 'a', 'b', 'c',
'd', 'e', 'f', 'g', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', 'x', 'y', 'z', '{',
0xf000 | '|', '}', '~', 127 0xf000 | '|', '}', '~', 127
}; };

View File

@ -867,14 +867,14 @@ static void
print_version () print_version ()
{ {
printf ("dumper (cygwin) %d.%d.%d\n" printf ("dumper (cygwin) %d.%d.%d\n"
"Core Dumper for Cygwin\n" "Core Dumper for Cygwin\n"
"Copyright (C) 1999 - %s Red Hat, Inc.\n" "Copyright (C) 1999 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
int int

View File

@ -424,20 +424,20 @@ printvar (const struct conf_variable *cp, const char *pathname)
errno = 0; errno = 0;
slen = confstr ((int) cp->value, NULL, 0); slen = confstr ((int) cp->value, NULL, 0);
if (slen == 0) if (slen == 0)
{ {
if (errno == 0) if (errno == 0)
print_strvar (cp->name, "undefined"); print_strvar (cp->name, "undefined");
return; return;
} }
if ((sval = malloc (slen)) == NULL) if ((sval = malloc (slen)) == NULL)
error (EXIT_FAILURE, 0, "Can't allocate %zu bytes", slen); error (EXIT_FAILURE, 0, "Can't allocate %zu bytes", slen);
errno = 0; errno = 0;
if (confstr ((int) cp->value, sval, slen) == 0) if (confstr ((int) cp->value, sval, slen) == 0)
print_strvar (cp->name, "undefined"); print_strvar (cp->name, "undefined");
else else
print_strvar (cp->name, sval); print_strvar (cp->name, sval);
free (sval); free (sval);
break; break;
@ -445,25 +445,25 @@ printvar (const struct conf_variable *cp, const char *pathname)
case SYSCONF: case SYSCONF:
errno = 0; errno = 0;
if ((val = sysconf ((int) cp->value)) == -1) if ((val = sysconf ((int) cp->value)) == -1)
{ {
if (a_flag && errno != 0) if (a_flag && errno != 0)
return; /* Just skip invalid variables */ return; /* Just skip invalid variables */
print_strvar (cp->name, "undefined"); print_strvar (cp->name, "undefined");
} }
else else
print_longvar (cp->name, val); print_longvar (cp->name, val);
break; break;
case PATHCONF: case PATHCONF:
errno = 0; errno = 0;
if ((val = pathconf (pathname, (int) cp->value)) == -1) if ((val = pathconf (pathname, (int) cp->value)) == -1)
{ {
if (a_flag && errno != 0) if (a_flag && errno != 0)
return; /* Just skip invalid variables */ return; /* Just skip invalid variables */
print_strvar (cp->name, "undefined"); print_strvar (cp->name, "undefined");
} }
else else
print_longvar (cp->name, val); print_longvar (cp->name, val);
break; break;
} }
} }
@ -493,14 +493,14 @@ static void
print_version () print_version ()
{ {
printf ("getconf (cygwin) %d.%d.%d\n" printf ("getconf (cygwin) %d.%d.%d\n"
"Get configuration values\n" "Get configuration values\n"
"Copyright (C) 2011 - %s Red Hat, Inc.\n" "Copyright (C) 2011 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
struct option longopts[] = { struct option longopts[] = {
@ -525,23 +525,23 @@ main (int argc, char **argv)
while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != -1) while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != -1)
{ {
switch (ch) switch (ch)
{ {
case 'a': case 'a':
a_flag = 1; a_flag = 1;
break; break;
case 'v': case 'v':
v_flag = 1; v_flag = 1;
break; break;
case 'h': case 'h':
usage (0); usage (0);
case 'V': case 'V':
print_version (); print_version ();
return 0; return 0;
default: default:
fprintf (stderr, "Try `%s --help' for more information.\n", fprintf (stderr, "Try `%s --help' for more information.\n",
program_invocation_short_name); program_invocation_short_name);
return 1; return 1;
} }
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
@ -549,18 +549,18 @@ main (int argc, char **argv)
if (v_flag) if (v_flag)
{ {
if (a_flag || argc < 2) if (a_flag || argc < 2)
usage (1); usage (1);
for (sp = spec_table; sp->name != NULL; sp++) for (sp = spec_table; sp->name != NULL; sp++)
{ {
if (strcmp (argv[0], sp->name) == 0) if (strcmp (argv[0], sp->name) == 0)
{ {
if (sp->valid != 1) if (sp->valid != 1)
error (EXIT_FAILURE, 0, "unsupported specification \"%s\"", argv[0]); error (EXIT_FAILURE, 0, "unsupported specification \"%s\"", argv[0]);
break; break;
} }
} }
if (sp->name == NULL) if (sp->name == NULL)
error (EXIT_FAILURE, 0, "unknown specification \"%s\"", argv[0]); error (EXIT_FAILURE, 0, "unknown specification \"%s\"", argv[0]);
argc--; argc--;
argv++; argv++;
} }
@ -568,7 +568,7 @@ main (int argc, char **argv)
if (!a_flag) if (!a_flag)
{ {
if (argc == 0) if (argc == 0)
usage (1); usage (1);
varname = argv[0]; varname = argv[0];
argc--; argc--;
argv++; argv++;
@ -584,16 +584,16 @@ main (int argc, char **argv)
for (cp = conf_table; cp->name != NULL; cp++) for (cp = conf_table; cp->name != NULL; cp++)
{ {
if (a_flag || strcmp (varname, cp->name) == 0) if (a_flag || strcmp (varname, cp->name) == 0)
{ {
/* LINTED weird expression */ /* LINTED weird expression */
if ((cp->type == PATHCONF) == (pathname != NULL)) if ((cp->type == PATHCONF) == (pathname != NULL))
{ {
printvar (cp, pathname); printvar (cp, pathname);
found = 1; found = 1;
} }
else if (!a_flag) else if (!a_flag)
usage (1); usage (1);
} }
} }
if (!a_flag && !found) if (!a_flag && !found)

View File

@ -66,47 +66,47 @@ static void
usage (FILE * stream) usage (FILE * stream)
{ {
fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n" fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n"
"\n" "\n"
"Display file and directory access control lists (ACLs).\n" "Display file and directory access control lists (ACLs).\n"
"\n" "\n"
" -a, --all display the filename, the owner, the group, and\n" " -a, --all display the filename, the owner, the group, and\n"
" the ACL of the file\n" " the ACL of the file\n"
" -d, --dir display the filename, the owner, the group, and\n" " -d, --dir display the filename, the owner, the group, and\n"
" the default ACL of the directory, if it exists\n" " the default ACL of the directory, if it exists\n"
" -h, --help output usage information and exit\n" " -h, --help output usage information and exit\n"
" -n, --noname display user and group IDs instead of names\n" " -n, --noname display user and group IDs instead of names\n"
" -V, --version output version information and exit\n" " -V, --version output version information and exit\n"
"\n" "\n"
"When multiple files are specified on the command line, a blank\n" "When multiple files are specified on the command line, a blank\n"
"line separates the ACLs for each file.\n", prog_name); "line separates the ACLs for each file.\n", prog_name);
if (stream == stdout) if (stream == stdout)
{ {
fprintf (stream, "" fprintf (stream, ""
"For each argument that is a regular file, special file or\n" "For each argument that is a regular file, special file or\n"
"directory, getfacl displays the owner, the group, and the ACL.\n" "directory, getfacl displays the owner, the group, and the ACL.\n"
"For directories getfacl displays additionally the default ACL.\n" "For directories getfacl displays additionally the default ACL.\n"
"\n" "\n"
"With no options specified, getfacl displays the filename, the\n" "With no options specified, getfacl displays the filename, the\n"
"owner, the group, and both the ACL and the default ACL, if it\n" "owner, the group, and both the ACL and the default ACL, if it\n"
"exists.\n" "exists.\n"
"\n" "\n"
"The format for ACL output is as follows:\n" "The format for ACL output is as follows:\n"
" # file: filename\n" " # file: filename\n"
" # owner: name or uid\n" " # owner: name or uid\n"
" # group: name or uid\n" " # group: name or uid\n"
" user::perm\n" " user::perm\n"
" user:name or uid:perm\n" " user:name or uid:perm\n"
" group::perm\n" " group::perm\n"
" group:name or gid:perm\n" " group:name or gid:perm\n"
" mask:perm\n" " mask:perm\n"
" other:perm\n" " other:perm\n"
" default:user::perm\n" " default:user::perm\n"
" default:user:name or uid:perm\n" " default:user:name or uid:perm\n"
" default:group::perm\n" " default:group::perm\n"
" default:group:name or gid:perm\n" " default:group:name or gid:perm\n"
" default:mask:perm\n" " default:mask:perm\n"
" default:other:perm\n" " default:other:perm\n"
"\n"); "\n");
} }
} }
@ -124,14 +124,14 @@ static void
print_version () print_version ()
{ {
printf ("getfacl (cygwin) %d.%d.%d\n" printf ("getfacl (cygwin) %d.%d.%d\n"
"Get POSIX ACL information\n" "Get POSIX ACL information\n"
"Copyright (C) 2000 - %s Red Hat, Inc.\n" "Copyright (C) 2000 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
int int
@ -187,12 +187,12 @@ main (int argc, char **argv)
} }
printf ("# file: %s\n", argv[optind]); printf ("# file: %s\n", argv[optind]);
if (nopt) if (nopt)
{ {
printf ("# owner: %lu\n", (unsigned long)st.st_uid); printf ("# owner: %lu\n", (unsigned long)st.st_uid);
printf ("# group: %lu\n", (unsigned long)st.st_gid); printf ("# group: %lu\n", (unsigned long)st.st_gid);
} }
else else
{ {
printf ("# owner: %s\n", username (st.st_uid)); printf ("# owner: %s\n", username (st.st_uid));
printf ("# group: %s\n", groupname (st.st_gid)); printf ("# group: %s\n", groupname (st.st_gid));
} }

View File

@ -56,14 +56,14 @@ static void
print_version () print_version ()
{ {
printf ("kill (cygwin) %d.%d.%d\n" printf ("kill (cygwin) %d.%d.%d\n"
"Process Signaller\n" "Process Signaller\n"
"Copyright (C) 1996 - %s Red Hat, Inc.\n" "Copyright (C) 1996 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
static const char * static const char *
@ -135,7 +135,7 @@ get_debug_priv (void)
TOKEN_PRIVILEGES tkp; TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken (GetCurrentProcess (), if (!OpenProcessToken (GetCurrentProcess (),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok)) TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok))
return; return;
if (!LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &luid)) if (!LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &luid))
@ -168,8 +168,8 @@ forcekill (int pid, int sig, int wait)
if (!h) if (!h)
{ {
if (!wait || GetLastError () != ERROR_INVALID_PARAMETER) if (!wait || GetLastError () != ERROR_INVALID_PARAMETER)
fprintf (stderr, "%s: couldn't open pid %u\n", fprintf (stderr, "%s: couldn't open pid %u\n",
prog_name, (unsigned) dwpid); prog_name, (unsigned) dwpid);
return; return;
} }
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0) if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
@ -259,8 +259,8 @@ out:
if (!pid) if (!pid)
pid = strtoll (*argv, &p, 10); pid = strtoll (*argv, &p, 10);
if (*p != '\0' if (*p != '\0'
|| (!force && (pid < LONG_MIN || pid > LONG_MAX)) || (!force && (pid < LONG_MIN || pid > LONG_MAX))
|| (force && (pid <= 0 || pid > ULONG_MAX))) || (force && (pid <= 0 || pid > ULONG_MAX)))
{ {
fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv); fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv);
ret = 1; ret = 1;

View File

@ -93,14 +93,14 @@ static void
print_version () print_version ()
{ {
printf ("ldd (cygwin) %d.%d.%d\n" printf ("ldd (cygwin) %d.%d.%d\n"
"Print shared library dependencies\n" "Print shared library dependencies\n"
"Copyright (C) 2009 - %s Chris Faylor\n" "Copyright (C) 2009 - %s Chris Faylor\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
#define print_errno_error_and_return(__fn) \ #define print_errno_error_and_return(__fn) \
@ -439,7 +439,7 @@ dump_import_directory (const void *const section_base,
int len = mbstowcs (NULL, fn, 0); int len = mbstowcs (NULL, fn, 0);
if (len <= 0) if (len <= 0)
continue; continue;
wchar_t fnw[len + 1]; wchar_t fnw[len + 1];
mbstowcs (fnw, fn, len + 1); mbstowcs (fnw, fn, len + 1);
/* output DLL's name */ /* output DLL's name */

View File

@ -251,17 +251,17 @@ add_locale_alias_locales ()
alias_buf[LOCALE_ALIAS_LINE_LEN] = '\0'; alias_buf[LOCALE_ALIAS_LINE_LEN] = '\0';
c = strrchr (alias_buf, '\n'); c = strrchr (alias_buf, '\n');
if (c) if (c)
*c = '\0'; *c = '\0';
c = alias_buf; c = alias_buf;
c += strspn (c, " \t"); c += strspn (c, " \t");
if (!*c || *c == '#') if (!*c || *c == '#')
continue; continue;
alias = c; alias = c;
c += strcspn (c, " \t"); c += strcspn (c, " \t");
*c++ = '\0'; *c++ = '\0';
c += strspn (c, " \t"); c += strspn (c, " \t");
if (*c == '#') if (*c == '#')
continue; continue;
replace = c; replace = c;
c += strcspn (c, " \t"); c += strcspn (c, " \t");
*c++ = '\0'; *c++ = '\0';
@ -524,7 +524,7 @@ print_lc_sepstrings (int key, const char *name, const char *value)
if (key) if (key)
fputc ('"', stdout); fputc ('"', stdout);
if (value && *value) if (value && *value)
fputc (';', stdout); fputc (';', stdout);
} }
fputc ('\n', stdout); fputc ('\n', stdout);
} }
@ -693,7 +693,7 @@ print_lc (int cat, int key, const char *category, const char *name,
for (lc_names_t *lc = lc_name; lc->type != is_end; ++lc) for (lc_names_t *lc = lc_name; lc->type != is_end; ++lc)
if (!name || !strcmp (name, lc->name)) if (!name || !strcmp (name, lc->name))
switch (lc->type) switch (lc->type)
{ {
case is_string_fake: case is_string_fake:
print_lc_svalue (key, lc->name, fake_string[lc->fromval + key]); print_lc_svalue (key, lc->name, fake_string[lc->fromval + key]);
break; break;
@ -746,14 +746,14 @@ print_names (int cat, int key, const char *name)
for (c = categories; c->category; ++c) for (c = categories; c->category; ++c)
if (!strcmp (name, c->category)) if (!strcmp (name, c->category))
{ {
print_lc (cat, key, c->category, NULL, c->lc_names); print_lc (cat, key, c->category, NULL, c->lc_names);
return; return;
} }
for (c = categories; c->category; ++c) for (c = categories; c->category; ++c)
for (lc = c->lc_names; lc->type != is_end; ++lc) for (lc = c->lc_names; lc->type != is_end; ++lc)
if (!strcmp (name, lc->name)) if (!strcmp (name, lc->name))
{ {
print_lc (cat, key, c->category, lc->name, lc); print_lc (cat, key, c->category, lc->name, lc);
return; return;
} }
} }
@ -789,31 +789,31 @@ main (int argc, char **argv)
switch (opt) switch (opt)
{ {
case 'a': case 'a':
all = 1; all = 1;
break; break;
case 'c': case 'c':
cat = 1; cat = 1;
break; break;
case 'k': case 'k':
key = 1; key = 1;
break; break;
case 'm': case 'm':
maps = 1; maps = 1;
break; break;
case 's': case 's':
lcid = GetSystemDefaultUILanguage (); lcid = GetSystemDefaultUILanguage ();
break; break;
case 'u': case 'u':
lcid = GetUserDefaultUILanguage (); lcid = GetUserDefaultUILanguage ();
break; break;
case 'f': case 'f':
lcid = GetUserDefaultLCID (); lcid = GetUserDefaultLCID ();
break; break;
case 'n': case 'n':
lcid = GetSystemDefaultLCID (); lcid = GetSystemDefaultLCID ();
break; break;
case 'U': case 'U':
utf = ".UTF-8"; utf = ".UTF-8";
break; break;
case 'v': case 'v':
verbose = 1; verbose = 1;

View File

@ -668,14 +668,14 @@ static void
print_version () print_version ()
{ {
printf ("mkgroup (cygwin) %d.%d.%d\n" printf ("mkgroup (cygwin) %d.%d.%d\n"
"Group File Generator\n" "Group File Generator\n"
"Copyright (C) 1997 - %s Red Hat, Inc.\n" "Copyright (C) 1997 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
static PPOLICY_PRIMARY_DOMAIN_INFO p_dom; static PPOLICY_PRIMARY_DOMAIN_INFO p_dom;

View File

@ -570,14 +570,14 @@ static void
print_version () print_version ()
{ {
printf ("mkpasswd (cygwin) %d.%d.%d\n" printf ("mkpasswd (cygwin) %d.%d.%d\n"
"Passwd File Generator\n" "Passwd File Generator\n"
"Copyright (C) 1997 - %s Red Hat, Inc.\n" "Copyright (C) 1997 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
static void static void

View File

@ -240,14 +240,14 @@ static void
print_version () print_version ()
{ {
printf ("mount (cygwin) %d.%d.%d\n" printf ("mount (cygwin) %d.%d.%d\n"
"Mount filesystem utility\n" "Mount filesystem utility\n"
"Copyright (C) 1996 - %s Red Hat, Inc.\n" "Copyright (C) 1996 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
static char * static char *
@ -366,7 +366,7 @@ main (int argc, char **argv)
break; break;
case saw_mount_all: case saw_mount_all:
if (optind <= argc) if (optind <= argc)
usage (); usage ();
do_mount_from_fstab (NULL); do_mount_from_fstab (NULL);
break; break;
default: default:
@ -436,7 +436,7 @@ mount_entries (void)
{ {
char *noumount; char *noumount;
if ((noumount = strstr (p->mnt_opts, ",noumount"))) if ((noumount = strstr (p->mnt_opts, ",noumount")))
{ {
char dirname[NT_MAX_PATH]; char dirname[NT_MAX_PATH];
char opts[strlen (p->mnt_opts) + 1]; char opts[strlen (p->mnt_opts) + 1];

View File

@ -83,9 +83,9 @@ EvalRet (int ret, const char *user)
case ERROR_ACCESS_DENIED: case ERROR_ACCESS_DENIED:
if (! user) if (! user)
eprint (0, "You may not change password expiry information."); eprint (0, "You may not change password expiry information.");
else else
eprint (0, "You may not change the password for %s.", user); eprint (0, "You may not change the password for %s.", user);
break; break;
eprint (0, "Bad password: Invalid."); eprint (0, "Bad password: Invalid.");
@ -180,13 +180,13 @@ PrintPW (PUSER_INFO_3 ui, LPCWSTR server)
PUSER_MODALS_INFO_0 mi; PUSER_MODALS_INFO_0 mi;
printf ("Account disabled : %s", printf ("Account disabled : %s",
(ui->usri3_flags & UF_ACCOUNTDISABLE) ? "yes\n" : "no\n"); (ui->usri3_flags & UF_ACCOUNTDISABLE) ? "yes\n" : "no\n");
printf ("Password not required : %s", printf ("Password not required : %s",
(ui->usri3_flags & UF_PASSWD_NOTREQD) ? "yes\n" : "no\n"); (ui->usri3_flags & UF_PASSWD_NOTREQD) ? "yes\n" : "no\n");
printf ("User can't change password : %s", printf ("User can't change password : %s",
(ui->usri3_flags & UF_PASSWD_CANT_CHANGE) ? "yes\n" : "no\n"); (ui->usri3_flags & UF_PASSWD_CANT_CHANGE) ? "yes\n" : "no\n");
printf ("Password never expires : %s", printf ("Password never expires : %s",
(ui->usri3_flags & UF_DONT_EXPIRE_PASSWD) ? "yes\n" : "no\n"); (ui->usri3_flags & UF_DONT_EXPIRE_PASSWD) ? "yes\n" : "no\n");
printf ("Password expired : %s", printf ("Password expired : %s",
(ui->usri3_password_expired) ? "yes\n" : "no\n"); (ui->usri3_password_expired) ? "yes\n" : "no\n");
printf ("Latest password change : %s", ctime(&t)); printf ("Latest password change : %s", ctime(&t));
@ -194,22 +194,22 @@ PrintPW (PUSER_INFO_3 ui, LPCWSTR server)
if (! ret) if (! ret)
{ {
if (mi->usrmod0_max_passwd_age == TIMEQ_FOREVER) if (mi->usrmod0_max_passwd_age == TIMEQ_FOREVER)
mi->usrmod0_max_passwd_age = 0; mi->usrmod0_max_passwd_age = 0;
if (mi->usrmod0_min_passwd_age == TIMEQ_FOREVER) if (mi->usrmod0_min_passwd_age == TIMEQ_FOREVER)
mi->usrmod0_min_passwd_age = 0; mi->usrmod0_min_passwd_age = 0;
if (mi->usrmod0_force_logoff == TIMEQ_FOREVER) if (mi->usrmod0_force_logoff == TIMEQ_FOREVER)
mi->usrmod0_force_logoff = 0; mi->usrmod0_force_logoff = 0;
if (ui->usri3_priv == USER_PRIV_ADMIN) if (ui->usri3_priv == USER_PRIV_ADMIN)
mi->usrmod0_min_passwd_len = 0; mi->usrmod0_min_passwd_len = 0;
printf ("\nSystem password settings:\n"); printf ("\nSystem password settings:\n");
printf ("Max. password age %ld days\n", printf ("Max. password age %ld days\n",
mi->usrmod0_max_passwd_age / ONE_DAY); mi->usrmod0_max_passwd_age / ONE_DAY);
printf ("Min. password age %ld days\n", printf ("Min. password age %ld days\n",
mi->usrmod0_min_passwd_age / ONE_DAY); mi->usrmod0_min_passwd_age / ONE_DAY);
printf ("Force logout after %ld days\n", printf ("Force logout after %ld days\n",
mi->usrmod0_force_logoff / ONE_DAY); mi->usrmod0_force_logoff / ONE_DAY);
printf ("Min. password length: %ld\n", printf ("Min. password length: %ld\n",
mi->usrmod0_min_passwd_len); mi->usrmod0_min_passwd_len);
} }
} }
@ -351,14 +351,14 @@ static void
print_version () print_version ()
{ {
printf ("passwd (cygwin) %d.%d.%d\n" printf ("passwd (cygwin) %d.%d.%d\n"
"Password Utility\n" "Password Utility\n"
"Copyright (C) 1999 - %s Red Hat, Inc.\n" "Copyright (C) 1999 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
int int
@ -398,20 +398,20 @@ main (int argc, char **argv)
{ {
case 'h': case 'h':
usage (stdout, 0); usage (stdout, 0);
break; break;
case 'i': case 'i':
if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
if ((iarg = atoi (optarg)) < 0 || iarg > 999) if ((iarg = atoi (optarg)) < 0 || iarg > 999)
return eprint (1, "Force logout time must be between 0 and 999."); return eprint (1, "Force logout time must be between 0 and 999.");
break; break;
case 'l': case 'l':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || uopt || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || uopt || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
lopt = 1; lopt = 1;
break; break;
case 'n': case 'n':
if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
@ -420,29 +420,29 @@ main (int argc, char **argv)
return eprint (1, "Minimum password age must be between 0 and 999."); return eprint (1, "Minimum password age must be between 0 and 999.");
if (xarg >= 0 && narg > xarg) if (xarg >= 0 && narg > xarg)
return eprint (1, "Minimum password age must be less than " return eprint (1, "Minimum password age must be less than "
"maximum password age."); "maximum password age.");
break; break;
case 'u': case 'u':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
uopt = 1; uopt = 1;
break; break;
case 'c': case 'c':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
copt = 1; copt = 1;
break; break;
case 'C': case 'C':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
Copt = 1; Copt = 1;
break; break;
case 'd': case 'd':
{ {
if (Ropt) if (Ropt)
usage (stderr, 1); usage (stderr, 1);
char *tmpbuf = alloca (strlen (optarg) + 3); char *tmpbuf = alloca (strlen (optarg) + 3);
@ -461,30 +461,30 @@ main (int argc, char **argv)
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
eopt = 1; eopt = 1;
break; break;
case 'E': case 'E':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
Eopt = 1; Eopt = 1;
break; break;
case 'p': case 'p':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
popt = 1; popt = 1;
break; break;
case 'P': case 'P':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
Popt = 1; Popt = 1;
break; break;
case 'V': case 'V':
print_version (); print_version ();
exit (0); exit (0);
break; break;
case 'x': case 'x':
if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
@ -493,23 +493,23 @@ main (int argc, char **argv)
return eprint (1, "Maximum password age must be between 0 and 999."); return eprint (1, "Maximum password age must be between 0 and 999.");
if (narg >= 0 && xarg < narg) if (narg >= 0 && xarg < narg)
return eprint (1, "Maximum password age must be greater than " return eprint (1, "Maximum password age must be greater than "
"minimum password age."); "minimum password age.");
break; break;
case 'L': case 'L':
if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
usage (stderr, 1); usage (stderr, 1);
if ((Larg = atoi (optarg)) < 0 || Larg > LM20_PWLEN) if ((Larg = atoi (optarg)) < 0 || Larg > LM20_PWLEN)
return eprint (1, "Minimum password length must be between " return eprint (1, "Minimum password length must be between "
"0 and %d.", LM20_PWLEN); "0 and %d.", LM20_PWLEN);
break; break;
case 'S': case 'S':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt
|| copt || Copt || eopt || Eopt || popt || Popt || Ropt) || copt || Copt || eopt || Eopt || popt || Popt || Ropt)
usage (stderr, 1); usage (stderr, 1);
Sopt = 1; Sopt = 1;
break; break;
case 'R': case 'R':
if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt
@ -517,10 +517,10 @@ main (int argc, char **argv)
|| server) || server)
usage (stderr, 1); usage (stderr, 1);
Ropt = 1; Ropt = 1;
break; break;
default: default:
fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
return 1; return 1;
} }
@ -559,7 +559,7 @@ main (int argc, char **argv)
"You can delete the stored password by specifying an empty password.\n\n"); "You can delete the stored password by specifying an empty password.\n\n");
strcpy (newpwd, getpass (text1)); strcpy (newpwd, getpass (text1));
if (strcmp (newpwd, getpass (text2))) if (strcmp (newpwd, getpass (text2)))
eprint (0, "Password is not identical."); eprint (0, "Password is not identical.");
else if (cygwin_internal (CW_SET_PRIV_KEY, newpwd, username)) else if (cygwin_internal (CW_SET_PRIV_KEY, newpwd, username))
return eprint (0, "Storing password failed: %s", strerror (errno)); return eprint (0, "Storing password failed: %s", strerror (errno));
return 0; return 0;
@ -568,7 +568,7 @@ main (int argc, char **argv)
if (Larg >= 0 || xarg >= 0 || narg >= 0 || iarg >= 0) if (Larg >= 0 || xarg >= 0 || narg >= 0 || iarg >= 0)
{ {
if (optind < argc) if (optind < argc)
usage (stderr, 1); usage (stderr, 1);
return SetModals (xarg, narg, iarg, Larg, server); return SetModals (xarg, narg, iarg, Larg, server);
} }
@ -597,31 +597,31 @@ main (int argc, char **argv)
uif.usri1008_flags = ui->usri3_flags; uif.usri1008_flags = ui->usri3_flags;
if (lopt) if (lopt)
{ {
if (ui->usri3_priv == USER_PRIV_ADMIN) if (ui->usri3_priv == USER_PRIV_ADMIN)
return eprint (0, "Locking an admin account is disallowed."); return eprint (0, "Locking an admin account is disallowed.");
uif.usri1008_flags |= UF_ACCOUNTDISABLE; uif.usri1008_flags |= UF_ACCOUNTDISABLE;
} }
if (uopt) if (uopt)
uif.usri1008_flags &= ~UF_ACCOUNTDISABLE; uif.usri1008_flags &= ~UF_ACCOUNTDISABLE;
if (copt) if (copt)
uif.usri1008_flags |= UF_PASSWD_CANT_CHANGE; uif.usri1008_flags |= UF_PASSWD_CANT_CHANGE;
if (Copt) if (Copt)
uif.usri1008_flags &= ~UF_PASSWD_CANT_CHANGE; uif.usri1008_flags &= ~UF_PASSWD_CANT_CHANGE;
if (eopt) if (eopt)
uif.usri1008_flags |= UF_DONT_EXPIRE_PASSWD; uif.usri1008_flags |= UF_DONT_EXPIRE_PASSWD;
if (Eopt) if (Eopt)
uif.usri1008_flags &= ~UF_DONT_EXPIRE_PASSWD; uif.usri1008_flags &= ~UF_DONT_EXPIRE_PASSWD;
if (popt) if (popt)
uif.usri1008_flags |= UF_PASSWD_NOTREQD; uif.usri1008_flags |= UF_PASSWD_NOTREQD;
if (Popt) if (Popt)
uif.usri1008_flags &= ~UF_PASSWD_NOTREQD; uif.usri1008_flags &= ~UF_PASSWD_NOTREQD;
if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt) if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt)
{ {
ret = NetUserSetInfo (server, ui->usri3_name, 1008, (LPBYTE) &uif, ret = NetUserSetInfo (server, ui->usri3_name, 1008, (LPBYTE) &uif,
NULL); NULL);
return EvalRet (ret, NULL); return EvalRet (ret, NULL);
} }
// Sopt // Sopt
PrintPW (ui, server); PrintPW (ui, server);
@ -639,18 +639,18 @@ main (int argc, char **argv)
{ {
strcpy (oldpwd, getpass ("Old password: ")); strcpy (oldpwd, getpass ("Old password: "));
if (ChangePW (user, oldpwd, oldpwd, 1, server)) if (ChangePW (user, oldpwd, oldpwd, 1, server))
return 1; return 1;
} }
do do
{ {
strcpy (newpwd, getpass ("New password: ")); strcpy (newpwd, getpass ("New password: "));
if (strcmp (newpwd, getpass ("Re-enter new password: "))) if (strcmp (newpwd, getpass ("Re-enter new password: ")))
eprint (0, "Password is not identical."); eprint (0, "Password is not identical.");
else if (! ChangePW (user, *oldpwd ? oldpwd : NULL, newpwd, 0, server)) else if (! ChangePW (user, *oldpwd ? oldpwd : NULL, newpwd, 0, server))
ret = 1; ret = 1;
if (! ret && cnt < 2) if (! ret && cnt < 2)
eprint (0, "Try again."); eprint (0, "Try again.");
} }
while (! ret && ++cnt < 3); while (! ret && ++cnt < 3);
return ! ret; return ! ret;

View File

@ -205,18 +205,18 @@ readlink (HANDLE fh, char *path, int maxlen)
{ {
cp = buf + sizeof (win_shortcut_hdr); cp = buf + sizeof (win_shortcut_hdr);
if (file_header->flags & WSH_FLAG_IDLIST) /* Skip ITEMIDLIST */ if (file_header->flags & WSH_FLAG_IDLIST) /* Skip ITEMIDLIST */
cp += *(unsigned short *) cp + 2; cp += *(unsigned short *) cp + 2;
if (!(len = *(unsigned short *) cp)) if (!(len = *(unsigned short *) cp))
return false; return false;
cp += 2; cp += 2;
/* Has appended full path? If so, use it instead of description. */ /* Has appended full path? If so, use it instead of description. */
unsigned short relpath_len = *(unsigned short *) (cp + len); unsigned short relpath_len = *(unsigned short *) (cp + len);
if (cp + len + 2 + relpath_len < buf + fi.nFileSizeLow) if (cp + len + 2 + relpath_len < buf + fi.nFileSizeLow)
{ {
cp += len + 2 + relpath_len; cp += len + 2 + relpath_len;
len = *(unsigned short *) cp; len = *(unsigned short *) cp;
cp += 2; cp += 2;
} }
if (*(PWCHAR) cp == 0xfeff) /* BOM */ if (*(PWCHAR) cp == 0xfeff) /* BOM */
{ {
len = wcstombs (NULL, (wchar_t *) (cp + 2), 0); len = wcstombs (NULL, (wchar_t *) (cp + 2), 0);
@ -225,14 +225,14 @@ readlink (HANDLE fh, char *path, int maxlen)
wcstombs (path, (wchar_t *) (cp + 2), len + 1); wcstombs (path, (wchar_t *) (cp + 2), len + 1);
} }
else if (len + 1 > maxlen) else if (len + 1 > maxlen)
return false; return false;
else else
memcpy (path, cp, len); memcpy (path, cp, len);
path[len] = '\0'; path[len] = '\0';
return true; return true;
} }
else if (strncmp (buf, SYMLINK_COOKIE, strlen (SYMLINK_COOKIE)) == 0 else if (strncmp (buf, SYMLINK_COOKIE, strlen (SYMLINK_COOKIE)) == 0
&& buf[fi.nFileSizeLow - 1] == '\0') && buf[fi.nFileSizeLow - 1] == '\0')
{ {
cp = buf + strlen (SYMLINK_COOKIE); cp = buf + strlen (SYMLINK_COOKIE);
if (*(PWCHAR) cp == 0xfeff) /* BOM */ if (*(PWCHAR) cp == 0xfeff) /* BOM */
@ -333,21 +333,21 @@ read_flags (char *options, unsigned &flags)
{ {
char *p = strchr (options, ','); char *p = strchr (options, ',');
if (p) if (p)
*p++ = '\0'; *p++ = '\0';
else else
p = strchr (options, '\0'); p = strchr (options, '\0');
for (opt *o = oopts; for (opt *o = oopts;
o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); o < (oopts + (sizeof (oopts) / sizeof (oopts[0])));
o++) o++)
if (strcmp (options, o->name) == 0) if (strcmp (options, o->name) == 0)
{ {
if (o->clear) if (o->clear)
flags &= ~o->val; flags &= ~o->val;
else else
flags |= o->val; flags |= o->val;
goto gotit; goto gotit;
} }
return false; return false;
gotit: gotit:
@ -405,7 +405,7 @@ from_fstab_line (mnt_t *m, char *line, bool user)
{ {
if ((mount_flags & MOUNT_SYSTEM) || !(sm->flags & MOUNT_SYSTEM)) if ((mount_flags & MOUNT_SYSTEM) || !(sm->flags & MOUNT_SYSTEM))
{ {
if (sm->posix) if (sm->posix)
free (sm->posix); free (sm->posix);
sm->posix = strdup (posix_path); sm->posix = strdup (posix_path);
sm->flags = mount_flags | MOUNT_CYGDRIVE; sm->flags = mount_flags | MOUNT_CYGDRIVE;
@ -428,7 +428,7 @@ from_fstab_line (mnt_t *m, char *line, bool user)
continue; continue;
/* Changing immutable mount points require the override flag. */ /* Changing immutable mount points require the override flag. */
if ((sm->flags & MOUNT_IMMUTABLE) if ((sm->flags & MOUNT_IMMUTABLE)
&& !(mount_flags & MOUNT_OVERRIDE)) && !(mount_flags & MOUNT_OVERRIDE))
return false; return false;
if (mount_flags & MOUNT_OVERRIDE) if (mount_flags & MOUNT_OVERRIDE)
mount_flags |= MOUNT_IMMUTABLE; mount_flags |= MOUNT_IMMUTABLE;
@ -475,9 +475,9 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end)
unconvert_slashes (buf); unconvert_slashes (buf);
char *native_path = buf; char *native_path = buf;
if (!strncmp (native_path, "\\\\?\\", 4)) if (!strncmp (native_path, "\\\\?\\", 4))
native_path += 4; native_path += 4;
if (!strncmp (native_path, "UNC\\", 4)) if (!strncmp (native_path, "UNC\\", 4))
*(native_path += 2) = '\\'; *(native_path += 2) = '\\';
m->posix = strdup ("/"); m->posix = strdup ("/");
m->native = strdup (native_path); m->native = strdup (native_path);
m->flags = MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_IMMUTABLE m->flags = MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_IMMUTABLE
@ -496,8 +496,8 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end)
m->flags = MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC; m->flags = MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC;
++m; ++m;
/* Create a default cygdrive entry. Note that this is a user entry. /* Create a default cygdrive entry. Note that this is a user entry.
This allows to override it with mount, unless the sysadmin created This allows to override it with mount, unless the sysadmin created
a cygdrive entry in /etc/fstab. */ a cygdrive entry in /etc/fstab. */
m->posix = strdup (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX); m->posix = strdup (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX);
m->native = strdup ("cygdrive prefix"); m->native = strdup ("cygdrive prefix");
m->flags = MOUNT_BINARY | MOUNT_CYGDRIVE; m->flags = MOUNT_BINARY | MOUNT_CYGDRIVE;
@ -509,14 +509,14 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end)
if (user) if (user)
mbstowcs (wcscpy (u, L".d\\") + 3, get_user (), BUFSIZE - (u - path)); mbstowcs (wcscpy (u, L".d\\") + 3, get_user (), BUFSIZE - (u - path));
HANDLE h = CreateFileW (path, GENERIC_READ, FILE_SHARE_READ, NULL, HANDLE h = CreateFileW (path, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) if (h == INVALID_HANDLE_VALUE)
return; return;
char *got = buf; char *got = buf;
DWORD len = 0; DWORD len = 0;
/* Using BUFSIZE-1 leaves space to append two \0. */ /* Using BUFSIZE-1 leaves space to append two \0. */
while (ReadFile (h, got, BUFSIZE - 1 - (got - buf), while (ReadFile (h, got, BUFSIZE - 1 - (got - buf),
&len, NULL)) &len, NULL))
{ {
char *end; char *end;
@ -527,17 +527,17 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end)
/* Reset got to start reading at the start of the buffer again. */ /* Reset got to start reading at the start of the buffer again. */
got = buf; got = buf;
while (got < buf + len && (end = strchr (got, '\n'))) while (got < buf + len && (end = strchr (got, '\n')))
{ {
end[end[-1] == '\r' ? -1 : 0] = '\0'; end[end[-1] == '\r' ? -1 : 0] = '\0';
if (from_fstab_line (m, got, user)) if (from_fstab_line (m, got, user))
++m; ++m;
got = end + 1; got = end + 1;
} }
if (len < BUFSIZE - 1) if (len < BUFSIZE - 1)
break; break;
/* We have to read once more. Move remaining bytes to the start of /* We have to read once more. Move remaining bytes to the start of
the buffer and reposition got so that it points to the end of the buffer and reposition got so that it points to the end of
the remaining bytes. */ the remaining bytes. */
len = buf + len - got; len = buf + len - got;
memmove (buf, got, len); memmove (buf, got, len);
got = buf + len; got = buf + len;
@ -768,7 +768,7 @@ rel_vconcat (const char *cwd, const char *s, va_list v)
if (!cwd || *cwd == '\0') if (!cwd || *cwd == '\0')
{ {
if (!GetCurrentDirectory (MAX_PATH, pathbuf)) if (!GetCurrentDirectory (MAX_PATH, pathbuf))
return NULL; return NULL;
cwd = pathbuf; cwd = pathbuf;
} }

View File

@ -133,14 +133,14 @@ static void
print_version () print_version ()
{ {
printf ("ps (cygwin) %d.%d.%d\n" printf ("ps (cygwin) %d.%d.%d\n"
"Show process statistics\n" "Show process statistics\n"
"Copyright (C) 1996 - %s Red Hat, Inc.\n" "Copyright (C) 1996 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
char dosdevs[32000]; char dosdevs[32000];
@ -279,7 +279,7 @@ main (int argc, char *argv[])
status = 'O'; status = 'O';
/* Maximum possible path length under NT. There's no official define /* Maximum possible path length under NT. There's no official define
for that value. */ for that value. */
char pname[NT_MAX_PATH + sizeof (" <defunct>")]; char pname[NT_MAX_PATH + sizeof (" <defunct>")];
if (p->ppid) if (p->ppid)
{ {
@ -355,7 +355,7 @@ main (int argc, char *argv[])
if (!n || !GetModuleFileNameExW (h, hm[0], pwname, NT_MAX_PATH)) if (!n || !GetModuleFileNameExW (h, hm[0], pwname, NT_MAX_PATH))
strcpy (pname, "*** unknown ***"); strcpy (pname, "*** unknown ***");
else else
wcstombs (pname, pwname, NT_MAX_PATH); wcstombs (pname, pwname, NT_MAX_PATH);
} }
FILETIME ct, et, kt, ut; FILETIME ct, et, kt, ut;
if (GetProcessTimes (h, &ct, &et, &kt, &ut)) if (GetProcessTimes (h, &ct, &et, &kt, &ut))

View File

@ -179,14 +179,14 @@ static void
print_version () print_version ()
{ {
printf ("regtool (cygwin) %d.%d.%d\n" printf ("regtool (cygwin) %d.%d.%d\n"
"Registry tool\n" "Registry tool\n"
"Copyright (C) 2000 - %s Red Hat, Inc.\n" "Copyright (C) 2000 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
void void
@ -420,12 +420,12 @@ find_key (int howmanyparts, REGSAM access, int option = 0)
if (RegCreateKeyExW (base, name, 0, NULL, option, access | wow64, if (RegCreateKeyExW (base, name, 0, NULL, option, access | wow64,
NULL, &key2, NULL) NULL, &key2, NULL)
== ERROR_SUCCESS) == ERROR_SUCCESS)
{ {
if (rv == ERROR_SUCCESS) if (rv == ERROR_SUCCESS)
RegCloseKey (key); RegCloseKey (key);
key = key2; key = key2;
rv = ERROR_SUCCESS; rv = ERROR_SUCCESS;
} }
} }
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail (rv); Fail (rv);
@ -587,7 +587,7 @@ cmd_remove ()
{ {
HMODULE mod = LoadLibrary ("advapi32.dll"); HMODULE mod = LoadLibrary ("advapi32.dll");
if (mod) if (mod)
regDeleteKeyEx = (WINADVAPI LONG WINAPI (*)(HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExW"); regDeleteKeyEx = (WINADVAPI LONG WINAPI (*)(HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExW");
} }
if (regDeleteKeyEx) if (regDeleteKeyEx)
rv = (*regDeleteKeyEx) (key, value, wow64, 0); rv = (*regDeleteKeyEx) (key, value, wow64, 0);
@ -639,7 +639,7 @@ cmd_set ()
case REG_NONE: case REG_NONE:
case REG_BINARY: case REG_BINARY:
for (n = 0; argv[n+1]; n++) for (n = 0; argv[n+1]; n++)
; ;
if (n == 1 && strcmp (argv[1], "-") == 0) if (n == 1 && strcmp (argv[1], "-") == 0)
{ /* read from stdin */ { /* read from stdin */
i = n = 0; i = n = 0;

View File

@ -56,7 +56,7 @@ mode_t getperm (char *in)
{ {
int i = atoi (in); int i = atoi (in);
if (i < 0 || i > 7) if (i < 0 || i > 7)
return ILLEGAL_MODE; return ILLEGAL_MODE;
return i << 6 | i << 3 | i; return i << 6 | i << 3 | i;
} }
if (strlen (in) > 3 && strchr (" \t\n\r#", in[3])) if (strlen (in) > 3 && strchr (" \t\n\r#", in[3]))
@ -68,8 +68,8 @@ mode_t getperm (char *in)
|| !strchr ("x-", in[2])) || !strchr ("x-", in[2]))
return ILLEGAL_MODE; return ILLEGAL_MODE;
return (in[0] == 'r' ? S_IROTH : 0) return (in[0] == 'r' ? S_IROTH : 0)
| (in[1] == 'w' ? S_IWOTH : 0) | (in[1] == 'w' ? S_IWOTH : 0)
| (in[2] == 'x' ? S_IXOTH : 0); | (in[2] == 'x' ? S_IXOTH : 0);
} }
BOOL BOOL
@ -127,34 +127,34 @@ getaclentry (action_t action, char *c, aclent_t *ace)
can't be deleted. */ can't be deleted. */
c2 = strchrnul (c + 1, ':'); c2 = strchrnul (c + 1, ':');
if (*c2 == ':') if (*c2 == ':')
*c2++ = '\0'; *c2++ = '\0';
else if (action != Delete) else if (action != Delete)
return FALSE; return FALSE;
else if (!(ace->a_type & ACL_DEFAULT)) else if (!(ace->a_type & ACL_DEFAULT))
return FALSE; return FALSE;
/* Fetch user/group id. */ /* Fetch user/group id. */
if (isdigit ((unsigned char) *c)) if (isdigit ((unsigned char) *c))
{ {
char *c3; char *c3;
ace->a_id = strtol (c, &c3, 10); ace->a_id = strtol (c, &c3, 10);
if (*c3) if (*c3)
return FALSE; return FALSE;
} }
else if (ace->a_type & USER_OBJ) else if (ace->a_type & USER_OBJ)
{ {
struct passwd *pw = getpwnam (c); struct passwd *pw = getpwnam (c);
if (!pw) if (!pw)
return FALSE; return FALSE;
ace->a_id = pw->pw_uid; ace->a_id = pw->pw_uid;
} }
else else
{ {
struct group *gr = getgrnam (c); struct group *gr = getgrnam (c);
if (!gr) if (!gr)
return FALSE; return FALSE;
ace->a_id = gr->gr_gid; ace->a_id = gr->gr_gid;
} }
if (ace->a_type & USER_OBJ) if (ace->a_type & USER_OBJ)
{ {
ace->a_type &= ~USER_OBJ; ace->a_type &= ~USER_OBJ;
@ -194,28 +194,28 @@ getaclentries (action_t action, char *buf, aclent_t *acls, int *idx)
char fbuf[256], *fb; char fbuf[256], *fb;
if (!strcmp (buf, "-")) if (!strcmp (buf, "-"))
fp = stdin; fp = stdin;
else if (! (fp = fopen (buf, "r"))) else if (! (fp = fopen (buf, "r")))
return FALSE; return FALSE;
while ((fb = fgets (fbuf, 256, fp))) while ((fb = fgets (fbuf, 256, fp)))
{ {
while (strchr (" \t", *fb)) while (strchr (" \t", *fb))
++fb; ++fb;
if (strchr ("\n\r#", *fb)) if (strchr ("\n\r#", *fb))
continue; continue;
if (!getaclentry (action, fb, acls + (*idx)++)) if (!getaclentry (action, fb, acls + (*idx)++))
{ {
fclose (fp); fclose (fp);
return FALSE; return FALSE;
} }
} }
if (fp != stdin) if (fp != stdin)
fclose (fp); fclose (fp);
} }
else else
for (c = strtok (buf, ","); c; c = strtok (NULL, ",")) for (c = strtok (buf, ","); c; c = strtok (NULL, ","))
if (!getaclentry (action, c, acls + (*idx)++)) if (!getaclentry (action, c, acls + (*idx)++))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -226,7 +226,7 @@ searchace (aclent_t *aclp, int nentries, int type, int id)
for (i = 0; i < nentries; ++i) for (i = 0; i < nentries; ++i)
if ((aclp[i].a_type == type && (id < 0 || aclp[i].a_id == id)) if ((aclp[i].a_type == type && (id < 0 || aclp[i].a_id == id))
|| !aclp[i].a_type) || !aclp[i].a_type)
return i; return i;
return -1; return -1;
} }
@ -239,24 +239,24 @@ modacl (aclent_t *tgt, int tcnt, aclent_t *src, int scnt)
for (s = 0; s < scnt; ++s) for (s = 0; s < scnt; ++s)
{ {
t = searchace (tgt, MAX_ACL_ENTRIES, src[s].a_type, t = searchace (tgt, MAX_ACL_ENTRIES, src[s].a_type,
(src[s].a_type & (USER | GROUP)) ? src[s].a_id : -1); (src[s].a_type & (USER | GROUP)) ? src[s].a_id : -1);
if (t < 0) if (t < 0)
return -1; return -1;
if (src[s].a_perm == ILLEGAL_MODE) if (src[s].a_perm == ILLEGAL_MODE)
{ {
if (t < tcnt) if (t < tcnt)
{ {
for (i = t + 1; i < tcnt; ++i) for (i = t + 1; i < tcnt; ++i)
tgt[i - 1] = tgt[i]; tgt[i - 1] = tgt[i];
--tcnt; --tcnt;
} }
} }
else else
{ {
tgt[t] = src[s]; tgt[t] = src[s];
if (t >= tcnt) if (t >= tcnt)
++tcnt; ++tcnt;
} }
} }
return tcnt; return tcnt;
} }
@ -290,105 +290,105 @@ static void
usage (FILE * stream) usage (FILE * stream)
{ {
fprintf (stream, "" fprintf (stream, ""
"Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n" "Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n"
" %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n" " %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n"
"\n" "\n"
"Modify file and directory access control lists (ACLs)\n" "Modify file and directory access control lists (ACLs)\n"
"\n" "\n"
" -d, --delete delete one or more specified ACL entries\n" " -d, --delete delete one or more specified ACL entries\n"
" -f, --file set ACL entries for FILE to ACL entries read\n" " -f, --file set ACL entries for FILE to ACL entries read\n"
" from a ACL_FILE\n" " from a ACL_FILE\n"
" -m, --modify modify one or more specified ACL entries\n" " -m, --modify modify one or more specified ACL entries\n"
" -r, --replace replace mask entry with maximum permissions\n" " -r, --replace replace mask entry with maximum permissions\n"
" needed for the file group class\n" " needed for the file group class\n"
" -s, --substitute substitute specified ACL entries for the\n" " -s, --substitute substitute specified ACL entries for the\n"
" ACL of FILE\n" " ACL of FILE\n"
" -h, --help output usage information and exit\n" " -h, --help output usage information and exit\n"
" -V, --version output version information and exit\n" " -V, --version output version information and exit\n"
"\n" "\n"
"At least one of (-d, -f, -m, -s) must be specified\n" "At least one of (-d, -f, -m, -s) must be specified\n"
"\n", prog_name, prog_name); "\n", prog_name, prog_name);
if (stream == stdout) if (stream == stdout)
{ {
printf("" printf(""
" Acl_entries are one or more comma-separated ACL entries \n" " Acl_entries are one or more comma-separated ACL entries \n"
" from the following list:\n" " from the following list:\n"
"\n" "\n"
" u[ser]::perm\n" " u[ser]::perm\n"
" u[ser]:uid:perm\n" " u[ser]:uid:perm\n"
" g[roup]::perm\n" " g[roup]::perm\n"
" g[roup]:gid:perm\n" " g[roup]:gid:perm\n"
" m[ask]:perm\n" " m[ask]:perm\n"
" o[ther]:perm\n" " o[ther]:perm\n"
"\n" "\n"
" Default entries are like the above with the additional\n" " Default entries are like the above with the additional\n"
" default identifier. For example: \n" " default identifier. For example: \n"
"\n" "\n"
" d[efault]:u[ser]:uid:perm\n" " d[efault]:u[ser]:uid:perm\n"
"\n" "\n"
" 'perm' is either a 3-char permissions string in the form\n" " 'perm' is either a 3-char permissions string in the form\n"
" \"rwx\" with the character - for no permission\n" " \"rwx\" with the character - for no permission\n"
" or it is the octal representation of the permissions, a\n" " or it is the octal representation of the permissions, a\n"
" value from 0 (equivalent to \"---\") to 7 (\"rwx\").\n" " value from 0 (equivalent to \"---\") to 7 (\"rwx\").\n"
" 'uid' is a user name or a numerical uid.\n" " 'uid' is a user name or a numerical uid.\n"
" 'gid' is a group name or a numerical gid.\n" " 'gid' is a group name or a numerical gid.\n"
"\n" "\n"
"\n" "\n"
"For each file given as parameter, %s will either replace its\n" "For each file given as parameter, %s will either replace its\n"
"complete ACL (-s, -f), or it will add, modify, or delete ACL\n" "complete ACL (-s, -f), or it will add, modify, or delete ACL\n"
"entries.\n" "entries.\n"
"\n" "\n"
"The following options are supported:\n" "The following options are supported:\n"
"\n" "\n"
"-d Delete one or more specified entries from the file's ACL.\n" "-d Delete one or more specified entries from the file's ACL.\n"
" The owner, group and others entries must not be deleted.\n" " The owner, group and others entries must not be deleted.\n"
" Acl_entries to be deleted should be specified without\n" " Acl_entries to be deleted should be specified without\n"
" permissions, as in the following list:\n" " permissions, as in the following list:\n"
"\n" "\n"
" u[ser]:uid\n" " u[ser]:uid\n"
" g[roup]:gid\n" " g[roup]:gid\n"
" d[efault]:u[ser]:uid\n" " d[efault]:u[ser]:uid\n"
" d[efault]:g[roup]:gid\n" " d[efault]:g[roup]:gid\n"
" d[efault]:m[ask]:\n" " d[efault]:m[ask]:\n"
" d[efault]:o[ther]:\n" " d[efault]:o[ther]:\n"
"\n" "\n"
"-f Take the Acl_entries from ACL_FILE one per line. Whitespace\n" "-f Take the Acl_entries from ACL_FILE one per line. Whitespace\n"
" characters are ignored, and the character \"#\" may be used\n" " characters are ignored, and the character \"#\" may be used\n"
" to start a comment. The special filename \"-\" indicates\n" " to start a comment. The special filename \"-\" indicates\n"
" reading from stdin.\n" " reading from stdin.\n"
" Required entries are\n" " Required entries are\n"
" - One user entry for the owner of the file.\n" " - One user entry for the owner of the file.\n"
" - One group entry for the group of the file.\n" " - One group entry for the group of the file.\n"
" - One other entry.\n" " - One other entry.\n"
" If additional user and group entries are given:\n" " If additional user and group entries are given:\n"
" - A mask entry for the file group class of the file.\n" " - A mask entry for the file group class of the file.\n"
" - No duplicate user or group entries with the same uid/gid.\n" " - No duplicate user or group entries with the same uid/gid.\n"
" If it is a directory:\n" " If it is a directory:\n"
" - One default user entry for the owner of the file.\n" " - One default user entry for the owner of the file.\n"
" - One default group entry for the group of the file.\n" " - One default group entry for the group of the file.\n"
" - One default mask entry for the file group class.\n" " - One default mask entry for the file group class.\n"
" - One default other entry.\n" " - One default other entry.\n"
"\n" "\n"
"-m Add or modify one or more specified ACL entries.\n" "-m Add or modify one or more specified ACL entries.\n"
" Acl_entries is a comma-separated list of entries from the \n" " Acl_entries is a comma-separated list of entries from the \n"
" same list as above.\n" " same list as above.\n"
"\n" "\n"
"-r Causes the permissions specified in the mask entry to be\n" "-r Causes the permissions specified in the mask entry to be\n"
" ignored and replaced by the maximum permissions needed for\n" " ignored and replaced by the maximum permissions needed for\n"
" the file group class.\n" " the file group class.\n"
"\n" "\n"
"-s Like -f, but substitute the file's ACL with Acl_entries\n" "-s Like -f, but substitute the file's ACL with Acl_entries\n"
" specified in a comma-separated list on the command line.\n" " specified in a comma-separated list on the command line.\n"
"\n" "\n"
"While the -d and -m options may be used in the same command, the\n" "While the -d and -m options may be used in the same command, the\n"
"-f and -s options may be used only exclusively.\n" "-f and -s options may be used only exclusively.\n"
"\n" "\n"
"Directories may contain default ACL entries. Files created\n" "Directories may contain default ACL entries. Files created\n"
"in a directory that contains default ACL entries will have\n" "in a directory that contains default ACL entries will have\n"
"permissions according to the combination of the current umask,\n" "permissions according to the combination of the current umask,\n"
"the explicit permissions requested and the default ACL entries\n" "the explicit permissions requested and the default ACL entries\n"
"Note: Under Cygwin, the default ACL entries are not taken into\n" "Note: Under Cygwin, the default ACL entries are not taken into\n"
"account currently.\n\n", prog_name); "account currently.\n\n", prog_name);
} }
else else
fprintf(stream, "Try '%s --help' for more information.\n", prog_name); fprintf(stream, "Try '%s --help' for more information.\n", prog_name);
@ -410,14 +410,14 @@ static void
print_version () print_version ()
{ {
printf ("setfacl (cygwin) %d.%d.%d\n" printf ("setfacl (cygwin) %d.%d.%d\n"
"POSIX ACL modification utility\n" "POSIX ACL modification utility\n"
"Copyright (C) 2000 - %s Red Hat, Inc.\n" "Copyright (C) 2000 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
int int
@ -437,83 +437,83 @@ main (int argc, char **argv)
switch (c) switch (c)
{ {
case 'd': case 'd':
if (action == NoAction) if (action == NoAction)
action = Delete; action = Delete;
else if (action == Modify) else if (action == Modify)
action = ModNDel; action = ModNDel;
else else
{ {
usage (stderr); usage (stderr);
return 1; return 1;
} }
if (! getaclentries (Delete, optarg, acls, &aclidx)) if (! getaclentries (Delete, optarg, acls, &aclidx))
{ {
fprintf (stderr, "%s: illegal acl entries\n", prog_name); fprintf (stderr, "%s: illegal acl entries\n", prog_name);
return 2; return 2;
} }
break; break;
case 'f': case 'f':
if (action == NoAction) if (action == NoAction)
action = Set; action = Set;
else else
{ {
usage (stderr); usage (stderr);
return 1; return 1;
} }
if (! getaclentries (SetFromFile, optarg, acls, &aclidx)) if (! getaclentries (SetFromFile, optarg, acls, &aclidx))
{ {
fprintf (stderr, "%s: illegal acl entries\n", prog_name); fprintf (stderr, "%s: illegal acl entries\n", prog_name);
return 2; return 2;
} }
break; break;
case 'h': case 'h':
usage (stdout); usage (stdout);
return 0; return 0;
case 'm': case 'm':
if (action == NoAction) if (action == NoAction)
action = Modify; action = Modify;
else if (action == Delete) else if (action == Delete)
action = ModNDel; action = ModNDel;
else else
{ {
usage (stderr); usage (stderr);
return 1; return 1;
} }
if (! getaclentries (Modify, optarg, acls, &aclidx)) if (! getaclentries (Modify, optarg, acls, &aclidx))
{ {
fprintf (stderr, "%s: illegal acl entries\n", prog_name); fprintf (stderr, "%s: illegal acl entries\n", prog_name);
return 2; return 2;
} }
break; break;
case 'r': case 'r':
if (!ropt) if (!ropt)
ropt = 1; ropt = 1;
else else
{ {
usage (stderr); usage (stderr);
return 1; return 1;
} }
break; break;
case 's': case 's':
if (action == NoAction) if (action == NoAction)
action = Set; action = Set;
else else
{ {
usage (stderr); usage (stderr);
return 1; return 1;
} }
if (! getaclentries (Set, optarg, acls, &aclidx)) if (! getaclentries (Set, optarg, acls, &aclidx))
{ {
fprintf (stderr, "%s: illegal acl entries\n", prog_name); fprintf (stderr, "%s: illegal acl entries\n", prog_name);
return 2; return 2;
} }
break; break;
case 'V': case 'V':
print_version (); print_version ();
return 0; return 0;
default: default:
fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
return 1; return 1;
} }
if (action == NoAction) if (action == NoAction)
{ {
@ -529,31 +529,31 @@ main (int argc, char **argv)
switch (aclcheck (acls, aclidx, NULL)) switch (aclcheck (acls, aclidx, NULL))
{ {
case GRP_ERROR: case GRP_ERROR:
fprintf (stderr, "%s: more than one group entry.\n", prog_name); fprintf (stderr, "%s: more than one group entry.\n", prog_name);
return 2; return 2;
case USER_ERROR: case USER_ERROR:
fprintf (stderr, "%s: more than one user entry.\n", prog_name); fprintf (stderr, "%s: more than one user entry.\n", prog_name);
return 2; return 2;
case CLASS_ERROR: case CLASS_ERROR:
fprintf (stderr, "%s: more than one mask entry.\n", prog_name); fprintf (stderr, "%s: more than one mask entry.\n", prog_name);
return 2; return 2;
case OTHER_ERROR: case OTHER_ERROR:
fprintf (stderr, "%s: more than one other entry.\n", prog_name); fprintf (stderr, "%s: more than one other entry.\n", prog_name);
return 2; return 2;
case DUPLICATE_ERROR: case DUPLICATE_ERROR:
fprintf (stderr, "%s: duplicate additional user or group.\n", prog_name); fprintf (stderr, "%s: duplicate additional user or group.\n", prog_name);
return 2; return 2;
case ENTRY_ERROR: case ENTRY_ERROR:
fprintf (stderr, "%s: invalid entry type.\n", prog_name); fprintf (stderr, "%s: invalid entry type.\n", prog_name);
return 2; return 2;
case MISS_ERROR: case MISS_ERROR:
fprintf (stderr, "%s: missing entries.\n", prog_name); fprintf (stderr, "%s: missing entries.\n", prog_name);
return 2; return 2;
case MEM_ERROR: case MEM_ERROR:
fprintf (stderr, "%s: out of memory.\n", prog_name); fprintf (stderr, "%s: out of memory.\n", prog_name);
return 2; return 2;
default: default:
break; break;
} }
for (c = optind; c < argc; ++c) for (c = optind; c < argc; ++c)
ret |= setfacl (action, argv[c], acls, aclidx); ret |= setfacl (action, argv[c], acls, aclidx);

View File

@ -48,14 +48,14 @@ void
print_version () print_version ()
{ {
printf ("setmetamode (cygwin) %d.%d.%d\n" printf ("setmetamode (cygwin) %d.%d.%d\n"
"Get or set keyboard meta mode\n" "Get or set keyboard meta mode\n"
"Copyright (C) 2006 - %s Red Hat, Inc.\n" "Copyright (C) 2006 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
struct option longopts[] = { struct option longopts[] = {
@ -89,7 +89,7 @@ main (int ac, char *av[])
switch (opt) switch (opt)
{ {
case 'h': case 'h':
usage (); usage ();
return 0; return 0;
case 'V': case 'V':
print_version (); print_version ();

View File

@ -813,14 +813,14 @@ static void
print_version () print_version ()
{ {
printf ("ssp (cygwin) %d.%d.%d\n" printf ("ssp (cygwin) %d.%d.%d\n"
"Single-Step Profiler\n" "Single-Step Profiler\n"
"Copyright (C) 2000 - %s Red Hat, Inc.\n" "Copyright (C) 2000 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
int int
@ -838,41 +838,41 @@ main (int argc, char **argv)
switch (c) switch (c)
{ {
case 'c': case 'c':
printf ("tracing *all* $eip to the console\n"); printf ("tracing *all* $eip to the console\n");
trace_console = 1; trace_console = 1;
break; break;
case 'd': case 'd':
printf ("stepping disabled; enable via OutputDebugString (\"ssp on\")\n"); printf ("stepping disabled; enable via OutputDebugString (\"ssp on\")\n");
stepping_enabled = 0; stepping_enabled = 0;
break; break;
case 'e': case 'e':
printf ("stepping enabled; disable via OutputDebugString (\"ssp off\")\n"); printf ("stepping enabled; disable via OutputDebugString (\"ssp off\")\n");
stepping_enabled = 1; stepping_enabled = 1;
break; break;
case 'h': case 'h':
usage (stdout); usage (stdout);
break; break;
case 'l': case 'l':
printf ("profiling dll usage\n"); printf ("profiling dll usage\n");
dll_counts = 1; dll_counts = 1;
break; break;
case 's': case 's':
printf ("tracing all sub-threads too, not just the main one\n"); printf ("tracing all sub-threads too, not just the main one\n");
trace_all_threads = 1; trace_all_threads = 1;
break; break;
case 't': case 't':
printf ("tracing all $eip to trace.ssp\n"); printf ("tracing all $eip to trace.ssp\n");
tracing_enabled = 1; tracing_enabled = 1;
break; break;
case 'v': case 'v':
printf ("verbose messages enabled\n"); printf ("verbose messages enabled\n");
verbose = 1; verbose = 1;
break; break;
case 'V': case 'V':
print_version (); print_version ();
exit (0); exit (0);
default: default:
fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
exit (1); exit (1);
} }

View File

@ -310,16 +310,16 @@ attach_process (pid_t pid)
HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, child_pid); HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, child_pid);
if (h) if (h)
{ {
/* Try to turn off DEBUG_ONLY_THIS_PROCESS so we can follow forks */ /* Try to turn off DEBUG_ONLY_THIS_PROCESS so we can follow forks */
/* This is only supported on XP and later */ /* This is only supported on XP and later */
ULONG DebugFlags = DEBUG_PROCESS_DETACH_ON_EXIT; ULONG DebugFlags = DEBUG_PROCESS_DETACH_ON_EXIT;
NTSTATUS status = NtSetInformationProcess (h, ProcessDebugFlags, &DebugFlags, sizeof (DebugFlags)); NTSTATUS status = NtSetInformationProcess (h, ProcessDebugFlags, &DebugFlags, sizeof (DebugFlags));
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
warn (0, "Could not clear DEBUG_ONLY_THIS_PROCESS (%x), will not trace child processes", status); warn (0, "Could not clear DEBUG_ONLY_THIS_PROCESS (%x), will not trace child processes", status);
CloseHandle(h); CloseHandle(h);
} }
} }
return; return;
@ -866,15 +866,15 @@ Trace system calls and signals\n\
-h, --help output usage information and exit\n\ -h, --help output usage information and exit\n\
-m, --mask=MASK set message filter mask\n\ -m, --mask=MASK set message filter mask\n\
-n, --crack-error-numbers output descriptive text instead of error\n\ -n, --crack-error-numbers output descriptive text instead of error\n\
numbers for Windows errors\n\ numbers for Windows errors\n\
-o, --output=FILENAME set output file to FILENAME\n\ -o, --output=FILENAME set output file to FILENAME\n\
-p, --pid=n attach to executing program with cygwin pid n\n\ -p, --pid=n attach to executing program with cygwin pid n\n\
-q, --quiet suppress messages about attaching, detaching, etc.\n\ -q, --quiet suppress messages about attaching, detaching, etc.\n\
-S, --flush-period=PERIOD flush buffered strace output every PERIOD secs\n\ -S, --flush-period=PERIOD flush buffered strace output every PERIOD secs\n\
-t, --timestamp use an absolute hh:mm:ss timestamp insted of \n\ -t, --timestamp use an absolute hh:mm:ss timestamp insted of \n\
the default microsecond timestamp. Implies -d\n\ the default microsecond timestamp. Implies -d\n\
-T, --toggle toggle tracing in a process already being\n\ -T, --toggle toggle tracing in a process already being\n\
traced. Requires -p <pid>\n\ traced. Requires -p <pid>\n\
-u, --usecs toggle printing of microseconds timestamp\n\ -u, --usecs toggle printing of microseconds timestamp\n\
-V, --version output version information and exit\n\ -V, --version output version information and exit\n\
-w, --new-window spawn program under test in a new window\n\ -w, --new-window spawn program under test in a new window\n\
@ -884,7 +884,7 @@ Trace system calls and signals\n\
MASK can be any combination of the following mnemonics and/or hex values\n\ MASK can be any combination of the following mnemonics and/or hex values\n\
(0x is optional). Combine masks with '+' or ',' like so:\n\ (0x is optional). Combine masks with '+' or ',' like so:\n\
\n\ \n\
--mask=wm+system,malloc+0x00800\n\ --mask=wm+system,malloc+0x00800\n\
\n\ \n\
Mnemonic Hex Corresponding Def Description\n\ Mnemonic Hex Corresponding Def Description\n\
=========================================================================\n\ =========================================================================\n\
@ -908,7 +908,7 @@ Trace system calls and signals\n\
malloc 0x020000 (_STRACE_MALLOC) Trace malloc calls.\n\ malloc 0x020000 (_STRACE_MALLOC) Trace malloc calls.\n\
thread 0x040000 (_STRACE_THREAD) Thread-locking calls.\n\ thread 0x040000 (_STRACE_THREAD) Thread-locking calls.\n\
special 0x100000 (_STRACE_SPECIAL) Special debugging printfs for\n\ special 0x100000 (_STRACE_SPECIAL) Special debugging printfs for\n\
non-checked-in code\n\ non-checked-in code\n\
"); ");
if (where == stderr) if (where == stderr)
fprintf (stderr, "Try `%s --help' for more information.\n", pgm); fprintf (stderr, "Try `%s --help' for more information.\n", pgm);
@ -941,14 +941,14 @@ static void
print_version () print_version ()
{ {
printf ("strace (cygwin) %d.%d.%d\n" printf ("strace (cygwin) %d.%d.%d\n"
"System Trace\n" "System Trace\n"
"Copyright (C) 2000 - %s Red Hat, Inc.\n" "Copyright (C) 2000 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
int int

View File

@ -68,22 +68,22 @@ main (int argc, char **argv)
bool pass = (strcmp (result, t.win32) == 0); bool pass = (strcmp (result, t.win32) == 0);
if (pass) if (pass)
{ {
numpass++; numpass++;
printf ("test %03d: PASS cwd=%-18s input=%-22s expected+actual=%s\n", printf ("test %03d: PASS cwd=%-18s input=%-22s expected+actual=%s\n",
curtest, t.cwd, t.posix, result); curtest, t.cwd, t.posix, result);
} }
else else
{ {
printf ("test %03d: FAIL cwd=%-18s input=%-29s expected=%-25s actual=%s\n", printf ("test %03d: FAIL cwd=%-18s input=%-29s expected=%-25s actual=%s\n",
curtest, t.cwd, t.posix, t.win32, result); curtest, t.cwd, t.posix, t.win32, result);
} }
} }
printf ("\n" printf ("\n"
"total tests: %d\n" "total tests: %d\n"
"pass : %d (%.1f%%)\n" "pass : %d (%.1f%%)\n"
"fail : %d (%.1f%%)\n", "fail : %d (%.1f%%)\n",
curtest, numpass, ((float)numpass)/curtest * 100.0F, curtest - numpass, curtest, numpass, ((float)numpass)/curtest * 100.0F, curtest - numpass,
((float)curtest - numpass)/curtest * 100.0F); ((float)curtest - numpass)/curtest * 100.0F);
return (numpass < curtest ? 1 : 0); return (numpass < curtest ? 1 : 0);
} }

View File

@ -57,14 +57,14 @@ static void
print_version () print_version ()
{ {
printf ("umount (cygwin) %d.%d.%d\n" printf ("umount (cygwin) %d.%d.%d\n"
"Unmount filesystem utility\n" "Unmount filesystem utility\n"
"Copyright (C) 1996 - %s Red Hat, Inc.\n" "Copyright (C) 1996 - %s Red Hat, Inc.\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000, CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
strrchr (__DATE__, ' ') + 1); strrchr (__DATE__, ' ') + 1);
} }
int int

View File

@ -1,5 +1,5 @@
/* wide_path.h -- Define class wide_path to convert multibyte win32 path /* wide_path.h -- Define class wide_path to convert multibyte win32 path
to wchar_t Win32 path including long path prefix if to wchar_t Win32 path including long path prefix if
necessary. necessary.
Copyright 2009 Red Hat, Inc. Copyright 2009 Red Hat, Inc.