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

@ -44,7 +44,7 @@
#define _MCOUNT_DECL static __inline__ void _MCOUNT_CALL _mcount #define _MCOUNT_DECL static __inline__ void _MCOUNT_CALL _mcount
/* FIXME: This works, but it would be cleaner to convert mcount into an /* FIXME: This works, but it would be cleaner to convert mcount into an
assembler stub that calls an extern _mcount. assembler stub that calls an extern _mcount.
Older versions of GCC (pre-4.1) will still fail with regparm since the Older versions of GCC (pre-4.1) will still fail with regparm since the
compiler used %edx to store an unneeded counter variable. */ compiler used %edx to store an unneeded counter variable. */

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

@ -505,7 +505,7 @@ fh_alloc (path_conv& pc)
if (pc.isopen ()) if (pc.isopen ())
fh = cnew (fhandler_pty_master, -1); fh = cnew (fhandler_pty_master, -1);
else else
fhraw = cnew_no_ctor (fhandler_pty_master, -1); fhraw = cnew_no_ctor (fhandler_pty_master, -1);
break; break;
case FH_WINDOWS: case FH_WINDOWS:
fh = cnew (fhandler_windows); fh = cnew (fhandler_windows);
@ -575,7 +575,7 @@ fh_alloc (path_conv& pc)
case FH_TTY: case FH_TTY:
if (!pc.isopen ()) if (!pc.isopen ())
{ {
fhraw = cnew_no_ctor (fhandler_console, -1); fhraw = cnew_no_ctor (fhandler_console, -1);
debug_printf ("not called from open for /dev/tty"); debug_printf ("not called from open for /dev/tty");
} }
else if (myself->ctty <= 0 && last_tty_dev else if (myself->ctty <= 0 && last_tty_dev

View File

@ -302,7 +302,7 @@ static const unsigned char conv_start_chars[256] =
WC, 0, 0, 0, WC, 0, 0, 0, WC, 0, 0, 0, WC, 0, 0, 0,
/* 112 */ /* 112 */
/* p q r s t u v w */ /* p q r s t u v w */
WC, 0, 0, 0, WC, 0, 0, 0, WC, 0, 0, 0, WC, 0, 0, 0,
}; };
static inline char static inline char

View File

@ -136,7 +136,7 @@ fhandler_console::set_unit ()
if (shared_console_info) if (shared_console_info)
{ {
fh_devices this_unit = dev (); fh_devices this_unit = dev ();
fh_devices shared_unit = fh_devices shared_unit =
(fh_devices) shared_console_info->tty_min_state.getntty (); (fh_devices) shared_console_info->tty_min_state.getntty ();
created = false; created = false;
devset = (shared_unit == this_unit || this_unit == FH_CONSOLE devset = (shared_unit == this_unit || this_unit == FH_CONSOLE

View File

@ -1457,7 +1457,7 @@ out:
first call to either pread or pwrite. This is used for any subsequent first call to either pread or pwrite. This is used for any subsequent
pread/pwrite. Thus the current file position of the "normal" file pread/pwrite. Thus the current file position of the "normal" file
handle is not touched. handle is not touched.
FIXME: FIXME:
Note that this is just a hack. The problem with this approach is that Note that this is just a hack. The problem with this approach is that

View File

@ -1201,7 +1201,7 @@ fhandler_pty_master::fhandler_pty_master (int unit)
else if (!setup ()) else if (!setup ())
{ {
dev ().parse (FH_ERROR); dev ().parse (FH_ERROR);
return; return;
} }
set_name ("/dev/ptmx"); set_name ("/dev/ptmx");
} }
@ -1302,8 +1302,8 @@ fhandler_pty_master::close ()
return 0; return 0;
} }
/* 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

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 1983, 1989, 1993 * Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -17,7 +17,7 @@
* 4. Neither the name of the University nor the names of its contributors * 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

View File

@ -1,6 +1,6 @@
/* Copyright (c) 1983, 1989 /* Copyright (c) 1983, 1989
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -16,7 +16,7 @@
* 4. Neither the name of the University nor the names of its contributors * 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

View File

@ -128,7 +128,7 @@ typedef struct _fexcept_t
extern const fenv_t *_fe_dfl_env; extern const fenv_t *_fe_dfl_env;
#define FE_DFL_ENV (_fe_dfl_env) #define FE_DFL_ENV (_fe_dfl_env)
/* Additional implementation-defined environments, with macro /* Additional implementation-defined environments, with macro
definitions beginning with FE_ and an uppercase letter,and having definitions beginning with FE_ and an uppercase letter,and having
type "pointer to const-qualified fenv_t",may also be specified by type "pointer to const-qualified fenv_t",may also be specified by
the implementation. */ the implementation. */

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 1983, 1987, 1989 * Copyright (c) 1983, 1987, 1989
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -17,7 +17,7 @@
* 4. Neither the name of the University nor the names of its contributors * 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -315,7 +315,7 @@ __END_DECLS
#if !defined(SHARED_LIBBIND) || defined(LIB) #if !defined(SHARED_LIBBIND) || defined(LIB)
/* /*
* If libbind is a shared object (well, DLL anyway) * If libbind is a shared object (well, DLL anyway)
* these externs break the linker when resolv.h is * these externs break the linker when resolv.h is
* included by a lib client (like named) * included by a lib client (like named)
* Make them go away if a client is including this * Make them go away if a client is including this
* *

View File

@ -12,7 +12,7 @@ details. */
#include "crt0.h" #include "crt0.h"
#include "cygwin-cxx.h" #include "cygwin-cxx.h"
/* Weaken these declarations so the references don't pull in C++ dependencies /* Weaken these declarations so the references don't pull in C++ dependencies
unnecessarily. */ unnecessarily. */
#define WEAK __attribute__ ((weak)) #define WEAK __attribute__ ((weak))
@ -55,7 +55,7 @@ extern char __RUNTIME_PSEUDO_RELOC_LIST__;
extern char __RUNTIME_PSEUDO_RELOC_LIST_END__; extern char __RUNTIME_PSEUDO_RELOC_LIST_END__;
extern char _image_base__; extern char _image_base__;
struct per_process_cxx_malloc __cygwin_cxx_malloc = struct per_process_cxx_malloc __cygwin_cxx_malloc =
{ {
&(operator new), &(operator new[]), &(operator new), &(operator new[]),
&(operator delete), &(operator delete[]), &(operator delete), &(operator delete[]),

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 1983, 1990, 1993 * Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -13,7 +13,7 @@
* 4. Neither the name of the University nor the names of its contributors * 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -29,14 +29,14 @@
/* /*
* Portions Copyright (c) 1993 by Digital Equipment Corporation. * Portions Copyright (c) 1993 by Digital Equipment Corporation.
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that * copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or * the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without * publicity pertaining to distribution of the document or software without
* specific, written prior permission. * specific, written prior permission.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
@ -92,7 +92,7 @@ __FBSDID("$FreeBSD$");
#include "port_after.h" #include "port_after.h"
#endif #endif
/* /*
* Check whether "cp" is a valid ascii representation * Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address. * of an Internet address and convert to a binary address.
* Returns 1 if the address is valid, 0 if not. * Returns 1 if the address is valid, 0 if not.
@ -134,7 +134,7 @@ cygwin_inet_aton(const char *cp, struct in_addr *addr) {
val = (val * base) + (c - '0'); val = (val * base) + (c - '0');
c = *++cp; c = *++cp;
digit = 1; digit = 1;
} else if (base == 16 && isascii(c) && } else if (base == 16 && isascii(c) &&
isxdigit((unsigned char)c)) { isxdigit((unsigned char)c)) {
val = (val << 4) | val = (val << 4) |
(c + 10 - (islower((unsigned char)c) ? 'a' : 'A')); (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));

View File

@ -451,11 +451,11 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
return ((os_query_t *) statp->os_query)(statp, DomName, Class, Type, AnsPtr, AnsLength); return ((os_query_t *) statp->os_query)(statp, DomName, Class, Type, AnsPtr, AnsLength);
} }
else { else {
/* dn_expand sets errno */ /* dn_expand sets errno */
statp->res_h_errno = NETDB_INTERNAL; statp->res_h_errno = NETDB_INTERNAL;
return -1; return -1;
} }
} }
/* Close the socket if it had been opened before a fork. /* Close the socket if it had been opened before a fork.
Reuse of pid's cannot hurt */ Reuse of pid's cannot hurt */
@ -488,7 +488,7 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
This routine runs through the retry loop for each incorrect answer. This routine runs through the retry loop for each incorrect answer.
It is thus extremely likely that such attacks will cause a TRY_AGAIN return, It is thus extremely likely that such attacks will cause a TRY_AGAIN return,
probably causing the calling program to retry after a delay. probably causing the calling program to retry after a delay.
Note that valid late or duplicate answers to a previous questions also cause Note that valid late or duplicate answers to a previous questions also cause
a retry, although this is minimized by flushing the socket before sending the a retry, although this is minimized by flushing the socket before sending the
new question. new question.
@ -498,8 +498,8 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
while ((rslt = cygwin_recvfrom( statp->sockfd, AnsPtr, AnsLength, 0, NULL, NULL)) >= 0) { while ((rslt = cygwin_recvfrom( statp->sockfd, AnsPtr, AnsLength, 0, NULL, NULL)) >= 0) {
DPRINTF(debug, "Flushed %d bytes\n", rslt); DPRINTF(debug, "Flushed %d bytes\n", rslt);
} }
DPRINTF(debug && (errno != EWOULDBLOCK), DPRINTF(debug && (errno != EWOULDBLOCK),
"Unexpected errno for flushing recvfrom: %s", strerror(errno)); "Unexpected errno for flushing recvfrom: %s", strerror(errno));
/* Send the message */ /* Send the message */
rslt = cygwin_sendto(statp->sockfd, MsgPtr, MsgLength, 0, rslt = cygwin_sendto(statp->sockfd, MsgPtr, MsgLength, 0,
@ -540,8 +540,8 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
return -1; return -1;
} }
DPRINTF(debug, "recvfrom: %d bytes from %08x\n", rslt, dnsSockAddr.sin_addr.s_addr); DPRINTF(debug, "recvfrom: %d bytes from %08x\n", rslt, dnsSockAddr.sin_addr.s_addr);
/* /*
Prepare to retry with tcp Prepare to retry with tcp
*/ */
for (tcp = 0; tcp < 2; tcp++) { for (tcp = 0; tcp < 2; tcp++) {
/* Check if this is the expected message from the expected server */ /* Check if this is the expected message from the expected server */
@ -561,11 +561,11 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
&& (rslt >= MsgLength) && (rslt >= MsgLength)
&& (memcmp(MsgPtr + HFIXEDSZ, AnsPtr + HFIXEDSZ, MsgLength - HFIXEDSZ) == 0)))) { && (memcmp(MsgPtr + HFIXEDSZ, AnsPtr + HFIXEDSZ, MsgLength - HFIXEDSZ) == 0)))) {
if ((AnsPtr[3] & ERR_MASK) == NOERROR) { if ((AnsPtr[3] & ERR_MASK) == NOERROR) {
if ((AnsPtr[2] & TC) && (tcp == 0) && !(statp->options & RES_IGNTC)) { if ((AnsPtr[2] & TC) && (tcp == 0) && !(statp->options & RES_IGNTC)) {
/* Truncated. Try TCP */ /* Truncated. Try TCP */
rslt = get_tcp(&statp->nsaddr_list[wServ], MsgPtr, MsgLength, rslt = get_tcp(&statp->nsaddr_list[wServ], MsgPtr, MsgLength,
AnsPtr, AnsLength, statp->options & RES_DEBUG); AnsPtr, AnsLength, statp->options & RES_DEBUG);
continue /* Tcp loop */; continue /* Tcp loop */;
} }
else if ((AnsPtr[6] | AnsPtr[7])!= 0) else if ((AnsPtr[6] | AnsPtr[7])!= 0)
return rslt; return rslt;
@ -588,7 +588,7 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
case FORMERR: case FORMERR:
statp->res_h_errno = HOST_NOT_FOUND; statp->res_h_errno = HOST_NOT_FOUND;
break; break;
case SERVFAIL: case SERVFAIL:
statp->res_h_errno = TRY_AGAIN; statp->res_h_errno = TRY_AGAIN;
break; break;
default: default:
@ -644,7 +644,7 @@ int res_nmkquery (res_state statp,
/* Fill the header */ /* Fill the header */
PUTSHORT(statp->id, buf); PUTSHORT(statp->id, buf);
PUTSHORT(RD, buf); PUTSHORT(RD, buf);
PUTSHORT(1, buf); /* Number of questions */ PUTSHORT(1, buf); /* Number of questions */
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
PUTSHORT(0, buf); /* Number of answers */ PUTSHORT(0, buf); /* Number of answers */
@ -655,14 +655,14 @@ int res_nmkquery (res_state statp,
PUTSHORT(qclass, buf); PUTSHORT(qclass, buf);
/* Update id. The current query adds entropy to the next query id */ /* Update id. The current query adds entropy to the next query id */
for (id4 = qtype, i = 0, ptr = dnameptr; *ptr; ptr++, i += 3) for (id4 = qtype, i = 0, ptr = dnameptr; *ptr; ptr++, i += 3)
id4 ^= *ptr << (i & 0xF); id4 ^= *ptr << (i & 0xF);
i = 1 + statp->id % 15; /* Between 1 and 16 */ i = 1 + statp->id % 15; /* Between 1 and 16 */
/* id dependent rotation, also brings MSW to LSW */ /* id dependent rotation, also brings MSW to LSW */
id4 = (id4 << i) ^ (id4 >> (16 - i)) ^ (id4 >> (32 - i)); id4 = (id4 << i) ^ (id4 >> (16 - i)) ^ (id4 >> (32 - i));
if ((short) id4) if ((short) id4)
statp->id ^= (short) id4; statp->id ^= (short) id4;
else else
statp->id++; /* Force change */ statp->id++; /* Force change */
return len + (HFIXEDSZ + QFIXEDSZ); /* packet size */ return len + (HFIXEDSZ + QFIXEDSZ); /* packet size */

View File

@ -430,7 +430,7 @@ iruserok_sa(const void *ra, int rlen, int superuser, const char *ruser,
struct sockaddr_storage ss; struct sockaddr_storage ss;
/* avoid alignment issue */ /* avoid alignment issue */
if (rlen > (int) sizeof(ss)) if (rlen > (int) sizeof(ss))
return(-1); return(-1);
memcpy(&ss, ra, rlen); memcpy(&ss, ra, rlen);
raddr = (struct sockaddr *)&ss; raddr = (struct sockaddr *)&ss;

View File

@ -296,9 +296,9 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
* *
* = 0 - parentheses enclose the quantity and the * = 0 - parentheses enclose the quantity and the
* $currency_symbol * $currency_symbol
* = 1 - the sign string precedes the quantity and the * = 1 - the sign string precedes the quantity and the
* $currency_symbol * $currency_symbol
* = 2 - the sign string succeeds the quantity and the * = 2 - the sign string succeeds the quantity and the
* $currency_symbol * $currency_symbol
* = 3 - the sign string precedes the $currency_symbol * = 3 - the sign string precedes the $currency_symbol
* = 4 - the sign string succeeds the $currency_symbol * = 4 - the sign string succeeds the $currency_symbol

View File

@ -275,21 +275,21 @@ find_alt_digits (const unsigned char *bp, alt_digits_t *adi, uint *pval)
return NULL; return NULL;
} }
static int static int
is_leap_year (int year) is_leap_year (int year)
{ {
return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0); return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0);
} }
static int static int
first_day (int year) first_day (int year)
{ {
int ret = 4; int ret = 4;
while (--year >= 1970) while (--year >= 1970)
ret = (ret + 365 + is_leap_year (year)) % 7; ret = (ret + 365 + is_leap_year (year)) % 7;
return ret; return ret;
} }
/* This simplifies the calls to conv_num enormously. */ /* This simplifies the calls to conv_num enormously. */
#define ALT_DIGITS ((alt_format & ALT_O) ? *alt_digits : NULL) #define ALT_DIGITS ((alt_format & ALT_O) ? *alt_digits : NULL)

View File

@ -347,10 +347,10 @@ CreatePipeOverlapped (PHANDLE hr, PHANDLE hw, LPSECURITY_ATTRIBUTES sa)
BOOL WINAPI BOOL WINAPI
ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len, LPDWORD ret_len, ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len, LPDWORD ret_len,
DWORD timeout) DWORD timeout)
{ {
OVERLAPPED ov; OVERLAPPED ov;
BOOL ret; BOOL ret;
memset (&ov, 0, sizeof ov); memset (&ov, 0, sizeof ov);
ov.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL); ov.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
ret = ReadFile (h, buf, len, NULL, &ov); ret = ReadFile (h, buf, len, NULL, &ov);
@ -359,17 +359,17 @@ ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len, LPDWORD ret_len,
if (!ret && WaitForSingleObject (ov.hEvent, timeout) != WAIT_OBJECT_0) if (!ret && WaitForSingleObject (ov.hEvent, timeout) != WAIT_OBJECT_0)
CancelIo (h); CancelIo (h);
ret = GetOverlappedResult (h, &ov, ret_len, FALSE); ret = GetOverlappedResult (h, &ov, ret_len, FALSE);
} }
CloseHandle (ov.hEvent); CloseHandle (ov.hEvent);
return ret; return ret;
} }
BOOL WINAPI BOOL WINAPI
WritePipeOverlapped (HANDLE h, PCVOID buf, DWORD len, LPDWORD ret_len, WritePipeOverlapped (HANDLE h, PCVOID buf, DWORD len, LPDWORD ret_len,
DWORD timeout) DWORD timeout)
{ {
OVERLAPPED ov; OVERLAPPED ov;
BOOL ret; BOOL ret;
memset (&ov, 0, sizeof ov); memset (&ov, 0, sizeof ov);
ov.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL); ov.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
@ -379,7 +379,7 @@ WritePipeOverlapped (HANDLE h, PCVOID buf, DWORD len, LPDWORD ret_len,
if (!ret && WaitForSingleObject (ov.hEvent, timeout) != WAIT_OBJECT_0) if (!ret && WaitForSingleObject (ov.hEvent, timeout) != WAIT_OBJECT_0)
CancelIo (h); CancelIo (h);
ret = GetOverlappedResult (h, &ov, ret_len, FALSE); ret = GetOverlappedResult (h, &ov, ret_len, FALSE);
} }
CloseHandle (ov.hEvent); CloseHandle (ov.hEvent);
return ret; return ret;
} }

View File

@ -511,7 +511,7 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
we only do this on affected systems. If we recognize a non-inheritable we only do this on affected systems. If we recognize a non-inheritable
socket we switch to inheritance/dup via WSADuplicateSocket/WSASocket for socket we switch to inheritance/dup via WSADuplicateSocket/WSASocket for
that socket. that socket.
Starting with Vista there's another neat way to workaround these annoying Starting with Vista there's another neat way to workaround these annoying
LSP sockets. WSAIoctl allows to fetch the underlying base socket, which LSP sockets. WSAIoctl allows to fetch the underlying base socket, which
is a normal, inheritable IFS handle. So we fetch the base socket, is a normal, inheritable IFS handle. So we fetch the base socket,

View File

@ -1406,7 +1406,7 @@ __set_charset_from_locale (const char *locale, char *charset)
which is part of the gettext package, and if it finds the locale alias which is part of the gettext package, and if it finds the locale alias
in that file, it replaces the locale with the correct locale string from in that file, it replaces the locale with the correct locale string from
that file. that file.
If successful, it returns a pointer to new_locale, NULL otherwise.*/ If successful, it returns a pointer to new_locale, NULL otherwise.*/
extern "C" char * extern "C" char *
__set_locale_from_locale_alias (const char *locale, char *new_locale) __set_locale_from_locale_alias (const char *locale, char *new_locale)

View File

@ -26,7 +26,7 @@
#ifdef STATUS_INVALID_HANDLE /* Defined as unsigned value in winbase.h */ #ifdef STATUS_INVALID_HANDLE /* Defined as unsigned value in winbase.h */
#undef STATUS_INVALID_HANDLE #undef STATUS_INVALID_HANDLE
#endif #endif
#define STATUS_INVALID_HANDLE ((NTSTATUS) 0xc0000008) #define STATUS_INVALID_HANDLE ((NTSTATUS) 0xc0000008)
#define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xc000000d) #define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xc000000d)
#define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xc000000f) #define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xc000000f)
#define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS) 0xc0000010) #define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS) 0xc0000010)

View File

@ -3489,7 +3489,7 @@ copy_cwd_str (PUNICODE_STRING tgt, PUNICODE_STRING src)
an afterthought now. The actual CWD storage is a FAST_CWD structure an afterthought now. The actual CWD storage is a FAST_CWD structure
which is allocated on the process heap. The new method only requires which is allocated on the process heap. The new method only requires
minimal locking and it's much more multi-thread friendly. Presumably minimal locking and it's much more multi-thread friendly. Presumably
it minimizes contention when accessing the CWD. it minimizes contention when accessing the CWD.
The class fcwd_access_t is supposed to encapsulate the gory implementation The class fcwd_access_t is supposed to encapsulate the gory implementation
details depending on OS version from the calling functions. */ details depending on OS version from the calling functions. */
class fcwd_access_t { class fcwd_access_t {
@ -3640,13 +3640,13 @@ public:
{ {
case FCWD_OLD: case FCWD_OLD:
default: default:
f_cwd = (fcwd_access_t *) f_cwd = (fcwd_access_t *)
((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_OLD, Buffer)); ((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_OLD, Buffer));
case FCWD_W7: case FCWD_W7:
f_cwd = (fcwd_access_t *) f_cwd = (fcwd_access_t *)
((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_7, Buffer)); ((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_7, Buffer));
case FCWD_W8: case FCWD_W8:
f_cwd = (fcwd_access_t *) f_cwd = (fcwd_access_t *)
((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_8, Buffer)); ((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_8, Buffer));
} }
f_cwd->DirectoryHandle () = dir; f_cwd->DirectoryHandle () = dir;
@ -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)
@ -3769,7 +3769,7 @@ find_fast_cwd ()
/* If we couldn't fetch fast_cwd_ptr, or if fast_cwd_ptr is NULL(*) /* If we couldn't fetch fast_cwd_ptr, or if fast_cwd_ptr is NULL(*)
we have to figure out the version from the Buffer pointer in the we have to figure out the version from the Buffer pointer in the
ProcessParameters. ProcessParameters.
(*) This is very unlikely to happen when starting the first (*) This is very unlikely to happen when starting the first
Cygwin process, since it only happens when starting the Cygwin process, since it only happens when starting the
process in a directory which can't be used as CWD by Win32, or process in a directory which can't be used as CWD by Win32, or

View File

@ -386,7 +386,7 @@ pinfo::set_acl()
pinfo::pinfo (HANDLE parent, pinfo_minimal& from, pid_t pid): pinfo::pinfo (HANDLE parent, pinfo_minimal& from, pid_t pid):
pinfo_minimal (), destroy (false), procinfo (NULL), waiter_ready (false), pinfo_minimal (), destroy (false), procinfo (NULL), waiter_ready (false),
wait_thread (NULL) wait_thread (NULL)
{ {
HANDLE herr; HANDLE herr;
const char *duperr = NULL; const char *duperr = NULL;

View File

@ -159,7 +159,7 @@ public:
waiter_ready (false), wait_thread (NULL) {} waiter_ready (false), wait_thread (NULL) {}
pinfo (pid_t n, DWORD flag = 0): pinfo_minimal (), destroy (false), pinfo (pid_t n, DWORD flag = 0): pinfo_minimal (), destroy (false),
procinfo (NULL), waiter_ready (false), procinfo (NULL), waiter_ready (false),
wait_thread (NULL) wait_thread (NULL)
{ {
init (n, flag, NULL); init (n, flag, NULL);
} }

View File

@ -404,7 +404,7 @@ pipe_worker (int filedes[2], unsigned int psize, int mode)
fdout = fhs[1]; fdout = fhs[1];
filedes[0] = fdin; filedes[0] = fdin;
filedes[1] = fdout; filedes[1] = fdout;
} }
return res; return res;
} }

View File

@ -336,7 +336,7 @@ security_descriptor::free ()
/* Index must match the corresponding foo_PRIVILEGE value, see security.h. */ /* Index must match the corresponding foo_PRIVILEGE value, see security.h. */
static const struct { static const struct {
const wchar_t *name; const wchar_t *name;
bool high_integrity; /* UAC: High Mandatory Label required to bool high_integrity; /* UAC: High Mandatory Label required to
be allowed to enable this privilege in be allowed to enable this privilege in
the user token. */ the user token. */
} cygpriv[] = } cygpriv[] =

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

@ -140,7 +140,7 @@ dup2 (int oldfd, int newfd)
res = (cfd >= 0) ? oldfd : -1; res = (cfd >= 0) ? oldfd : -1;
} }
else else
res = cygheap->fdtab.dup3 (oldfd, newfd, 0); res = cygheap->fdtab.dup3 (oldfd, newfd, 0);
syscall_printf ("%R = dup2(%d, %d)", res, oldfd, newfd); syscall_printf ("%R = dup2(%d, %d)", res, oldfd, newfd);
return res; return res;
@ -645,7 +645,7 @@ unlink_nt (path_conv &pc)
bin so that it actually disappears from its directory even though its bin so that it actually disappears from its directory even though its
in use. Otherwise, if opening doesn't fail, the file is not in use and in use. Otherwise, if opening doesn't fail, the file is not in use and
we can go straight to setting the delete disposition flag. we can go straight to setting the delete disposition flag.
NOTE: The missing sharing modes FILE_SHARE_READ and FILE_SHARE_WRITE do NOTE: The missing sharing modes FILE_SHARE_READ and FILE_SHARE_WRITE do
NOT result in a STATUS_SHARING_VIOLATION, if another handle is NOT result in a STATUS_SHARING_VIOLATION, if another handle is
opened for reading/writing metadata only. In other words, if opened for reading/writing metadata only. In other words, if
@ -760,7 +760,7 @@ try_again:
if (NT_SUCCESS (status2) && reopened < 20) if (NT_SUCCESS (status2) && reopened < 20)
{ {
/* Workaround rm -r problem: /* Workaround rm -r problem:
Sometimes a deleted directory lingers in its parent dir Sometimes a deleted directory lingers in its parent dir
after the deleting handle has already been closed. This after the deleting handle has already been closed. This
can break deleting the parent dir. See the comment in can break deleting the parent dir. See the comment in
@ -770,7 +770,7 @@ try_again:
STATUS_SUCCESS, the dir is either empty, or only inhabited STATUS_SUCCESS, the dir is either empty, or only inhabited
by already deleted entries. If so, we try to move the dir by already deleted entries. If so, we try to move the dir
into the bin. This usually works. into the bin. This usually works.
However, if we're on a filesystem which doesn't support However, if we're on a filesystem which doesn't support
the try_to_bin method, or if moving to the bin doesn't work the try_to_bin method, or if moving to the bin doesn't work
for some reason, just try to delete the directory again, for some reason, just try to delete the directory again,

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

@ -39,12 +39,12 @@
Kerio, Agnitum or ZoneAlarm Personal Firewall Kerio, Agnitum or ZoneAlarm Personal Firewall
Iolo System Mechanic/AntiVirus/Firewall Iolo System Mechanic/AntiVirus/Firewall
LanDesk LanDesk
Windows Defender Windows Defender
Embassy Trust Suite fingerprint reader software containing wxvault.dll Embassy Trust Suite fingerprint reader software containing wxvault.dll
ByteMobile laptop optimization client ByteMobile laptop optimization client
A live version is now being maintained in the Cygwin FAQ, at A live version is now being maintained in the Cygwin FAQ, at
http://cygwin.com/faq/faq.using.html#faq.using.bloda http://cygwin.com/faq/faq.using.html#faq.using.bloda
*/ */
@ -85,7 +85,7 @@ static const struct bad_app_det dodgy_app_detects[] =
{ PROCESSNAME, "LVPrcSrv.exe", LOGITECH }, { PROCESSNAME, "LVPrcSrv.exe", LOGITECH },
{ FILENAME, "%programfiles%\\common files\\logitech\\lvmvfm\\LVPrcSrv.exe", LOGITECH }, { FILENAME, "%programfiles%\\common files\\logitech\\lvmvfm\\LVPrcSrv.exe", LOGITECH },
{ FILENAME, "%windir%\\System32\\bmnet.dll", BYTEMOBILE }, { FILENAME, "%windir%\\System32\\bmnet.dll", BYTEMOBILE },
}; };
static const size_t num_of_detects = sizeof (dodgy_app_detects) / sizeof (dodgy_app_detects[0]); static const size_t num_of_detects = sizeof (dodgy_app_detects) / sizeof (dodgy_app_detects[0]);
@ -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. */
@ -232,7 +232,7 @@ expand_path (const char *path, char *outbuf)
return (dst - outbuf) < MAX_PATH; return (dst - outbuf) < MAX_PATH;
} }
static bool static bool
detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYSTEM_MODULE_INFORMATION modlist) detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYSTEM_MODULE_INFORMATION modlist)
{ {
HANDLE fh; HANDLE fh;
@ -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

@ -869,7 +869,7 @@ find_app_on_path (const char *app, bool showall = false)
static char tmp[SYMLINK_MAX + 1]; static char tmp[SYMLINK_MAX + 1];
if (!readlink (fh, tmp, SYMLINK_MAX)) if (!readlink (fh, tmp, SYMLINK_MAX))
display_error("readlink failed"); display_error("readlink failed");
/* Resolve the linkname relative to the directory of the link. */ /* Resolve the linkname relative to the directory of the link. */
char *ptr = cygpath_rel (dirname (papp), tmp, NULL); char *ptr = cygpath_rel (dirname (papp), tmp, NULL);
printf (" -> %s\n", ptr); printf (" -> %s\n", ptr);
@ -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,20 +1286,20 @@ 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--;
} }
return NULL; return NULL;
} }
int int
handle_unique_object_name (int opt, char *path) handle_unique_object_name (int opt, char *path)
{ {
@ -1358,7 +1358,7 @@ handle_unique_object_name (int opt, char *path)
else else
{ {
size_t haystacklen = GetFileSize (fh, NULL); size_t haystacklen = GetFileSize (fh, NULL);
cygwin_props_t *cygwin_props = (cygwin_props_t *) cygwin_props_t *cygwin_props = (cygwin_props_t *)
memmem ((char *) haystack, haystacklen, memmem ((char *) haystack, haystacklen,
CYGWIN_PROPS_MAGIC, sizeof (CYGWIN_PROPS_MAGIC)); CYGWIN_PROPS_MAGIC, sizeof (CYGWIN_PROPS_MAGIC));
if (!cygwin_props) if (!cygwin_props)
@ -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

@ -286,7 +286,7 @@ get_device_name (char *path)
{ {
/* If there's a trailing path, it's a perfectly valid /* If there's a trailing path, it's a perfectly valid
DOS pathname without the \\.\ prefix. Unless it's DOS pathname without the \\.\ prefix. Unless it's
longer than MAX_PATH - 1 in which case it needs longer than MAX_PATH - 1 in which case it needs
the \\?\ prefix. */ the \\?\ prefix. */
if ((len = strlen (ret + 4)) >= MAX_PATH) if ((len = strlen (ret + 4)) >= MAX_PATH)
ret[2] = '?'; ret[2] = '?';

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;
} }
} }
@ -471,7 +471,7 @@ printvar (const struct conf_variable *cp, const char *pathname)
static void static void
usage (int ret) usage (int ret)
{ {
fprintf (ret ? stderr : stdout, fprintf (ret ? stderr : stdout,
"Usage: %1$s [-v specification] variable_name [pathname]\n" "Usage: %1$s [-v specification] variable_name [pathname]\n"
" %1$s -a [pathname]\n" " %1$s -a [pathname]\n"
"\n" "\n"
@ -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))
@ -167,15 +167,15 @@ forcekill (int pid, int sig, int wait)
HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) dwpid); HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) dwpid);
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)
if (sig && !TerminateProcess (h, sig << 8) if (sig && !TerminateProcess (h, sig << 8)
&& WaitForSingleObject (h, 200) != WAIT_OBJECT_0) && WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
fprintf (stderr, "%s: couldn't kill pid %u, %lu\n", fprintf (stderr, "%s: couldn't kill pid %u, %lu\n",
prog_name, (unsigned) dwpid, GetLastError ()); prog_name, (unsigned) dwpid, GetLastError ());
CloseHandle (h); CloseHandle (h);
} }
@ -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 */
@ -492,7 +492,7 @@ map_file (const wchar_t *filename)
CloseHandle (hFile); CloseHandle (hFile);
return 0; return 0;
} }
CloseHandle (hMapping); CloseHandle (hMapping);
CloseHandle (hFile); CloseHandle (hFile);
@ -658,7 +658,7 @@ process_file (const wchar_t *filename)
UnmapViewOfFile (basepointer); UnmapViewOfFile (basepointer);
return 8; return 8;
} }
UnmapViewOfFile (basepointer); UnmapViewOfFile (basepointer);
return 0; return 0;
} }

View File

@ -49,7 +49,7 @@ _load_sys_library (const wchar_t *dll)
if (wcscmp (dll, L"cygwin1.dll") == 0) if (wcscmp (dll, L"cygwin1.dll") == 0)
return LoadLibraryExW (L"cygwin1.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH); return LoadLibraryExW (L"cygwin1.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
wcscpy (dllpath, sysdir); wcscpy (dllpath, sysdir);
wcscpy (dllpath + sysdir_len, dll); wcscpy (dllpath + sysdir_len, dll);
return LoadLibraryExW (dllpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); return LoadLibraryExW (dllpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);

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];
@ -456,7 +456,7 @@ mount_entries (void)
} }
} }
endmntent (m); endmntent (m);
exit(0); exit(0);
} }

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.");
@ -121,7 +121,7 @@ GetPW (char *user, int print_win_name, LPCWSTR server)
PUSER_INFO_3 ui; PUSER_INFO_3 ui;
struct passwd *pw; struct passwd *pw;
char *domain = (char *) alloca (INTERNET_MAX_HOST_NAME_LENGTH + 1); char *domain = (char *) alloca (INTERNET_MAX_HOST_NAME_LENGTH + 1);
/* Try getting a Win32 username in case the user edited /etc/passwd */ /* Try getting a Win32 username in case the user edited /etc/passwd */
if ((pw = getpwnam (user))) if ((pw = getpwnam (user)))
{ {
@ -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);
} }
} }
@ -312,7 +312,7 @@ caller_is_admin ()
DWORD size; DWORD size;
PTOKEN_GROUPS grps; PTOKEN_GROUPS grps;
SID_IDENTIFIER_AUTHORITY nt_auth = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY nt_auth = {SECURITY_NT_AUTHORITY};
PSID admin_grp; PSID admin_grp;
DWORD i; DWORD i;
if (is_admin == -1) if (is_admin == -1)
@ -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

@ -199,24 +199,24 @@ readlink (HANDLE fh, char *path, int maxlen)
|| !ReadFile (fh, buf, fi.nFileSizeLow, &rv, NULL) || !ReadFile (fh, buf, fi.nFileSizeLow, &rv, NULL)
|| rv != fi.nFileSizeLow) || rv != fi.nFileSizeLow)
return false; return false;
if (fi.nFileSizeLow > sizeof (file_header) if (fi.nFileSizeLow > sizeof (file_header)
&& cmp_shortcut_header (file_header)) && cmp_shortcut_header (file_header))
{ {
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 */
@ -247,7 +247,7 @@ readlink (HANDLE fh, char *path, int maxlen)
else else
strcpy (path, cp); strcpy (path, cp);
return true; return true;
} }
else else
return false; return false;
} }
@ -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;
@ -559,7 +559,7 @@ mnt_sort (const void *a, const void *b)
const mnt_t *ma = (const mnt_t *) a; const mnt_t *ma = (const mnt_t *) a;
const mnt_t *mb = (const mnt_t *) b; const mnt_t *mb = (const mnt_t *) b;
int ret; int ret;
ret = (ma->flags & MOUNT_CYGDRIVE) - (mb->flags & MOUNT_CYGDRIVE); ret = (ma->flags & MOUNT_CYGDRIVE) - (mb->flags & MOUNT_CYGDRIVE);
if (ret) if (ret)
return ret; return ret;
@ -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;
} }
@ -878,9 +878,9 @@ char *
cygpath (const char *s, ...) cygpath (const char *s, ...)
{ {
va_list v; va_list v;
va_start (v, s); va_start (v, s);
return vcygpath (NULL, s, v); return vcygpath (NULL, s, v);
} }

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,18 +420,18 @@ 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);
} }
else if (argv[1]) else if (argv[1])
{ {
ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0); ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0);
wchar_t win32_path[len]; wchar_t win32_path[len];
cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], win32_path, len); cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], win32_path, len);
@ -442,7 +442,7 @@ find_key (int howmanyparts, REGSAM access, int option = 0)
printf ("key %ls loaded from file %ls\n", name, win32_path); printf ("key %ls loaded from file %ls\n", name, win32_path);
} }
else else
{ {
rv = RegUnLoadKeyW (base, name); rv = RegUnLoadKeyW (base, name);
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;
@ -720,7 +720,7 @@ cmd_set ()
rv = ERROR_INVALID_CATEGORY; rv = ERROR_INVALID_CATEGORY;
break; break;
} }
if (data) if (data)
free(data); free(data);

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

@ -662,7 +662,7 @@ usage (FILE * stream)
" -h, --help output usage information and exit\n" " -h, --help output usage information and exit\n"
" -l, --dll enable dll profiling. A chart of relative DLL usage\n" " -l, --dll enable dll profiling. A chart of relative DLL usage\n"
" is produced after the run.\n" " is produced after the run.\n"
" -s, --sub-threads trace sub-threads too. Dangerous if you have\n" " -s, --sub-threads trace sub-threads too. Dangerous if you have\n"
" race conditions.\n" " race conditions.\n"
" -t, --trace-eip trace every EIP value to a file TRACE.SSP. This\n" " -t, --trace-eip trace every EIP value to a file TRACE.SSP. This\n"
" gets big *fast*.\n" " gets big *fast*.\n"
@ -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,48 +838,48 @@ 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);
} }
if ( (argc - optind) < 3 ) if ( (argc - optind) < 3 )
usage (stderr); usage (stderr);
sscanf (argv[optind++], "%i", &low_pc); sscanf (argv[optind++], "%i", &low_pc);
sscanf (argv[optind++], "%i", &high_pc); sscanf (argv[optind++], "%i", &high_pc);
if (low_pc > high_pc-8) if (low_pc > high_pc-8)
{ {

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

@ -66,24 +66,24 @@ main (int argc, char **argv)
{ {
char *result = cygpath (t.posix, NULL); char *result = cygpath (t.posix, NULL);
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

@ -60,11 +60,11 @@ static test_t testsuite_tests[] = {
{ NO_CWD, "/usr/bin/dir/file.ext", TESTSUITE_ROOT"\\bin\\dir\\file.ext" }, { NO_CWD, "/usr/bin/dir/file.ext", TESTSUITE_ROOT"\\bin\\dir\\file.ext" },
{ NO_CWD, "/usr/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" }, { NO_CWD, "/usr/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" },
{ NO_CWD, "/usr/lib/dir/file.ext", TESTSUITE_ROOT"\\lib\\dir\\file.ext" }, { NO_CWD, "/usr/lib/dir/file.ext", TESTSUITE_ROOT"\\lib\\dir\\file.ext" },
{ NO_CWD, "/home/file.ext", TESTSUITE_ROOT"\\home\\file.ext" }, { NO_CWD, "/home/file.ext", TESTSUITE_ROOT"\\home\\file.ext" },
{ NO_CWD, "/home/foo/file.ext", TESTSUITE_ROOT"\\home\\foo\\file.ext" }, { NO_CWD, "/home/foo/file.ext", TESTSUITE_ROOT"\\home\\foo\\file.ext" },
{ NO_CWD, "/home/foo/dir/file.ext", TESTSUITE_ROOT"\\home\\foo\\dir\\file.ext" }, { NO_CWD, "/home/foo/dir/file.ext", TESTSUITE_ROOT"\\home\\foo\\dir\\file.ext" },
{ NO_CWD, "/usr/file.ext", TESTSUITE_ROOT"\\usr\\file.ext" }, { NO_CWD, "/usr/file.ext", TESTSUITE_ROOT"\\usr\\file.ext" },
{ NO_CWD, "/usr/share/file.ext", TESTSUITE_ROOT"\\usr\\share\\file.ext" }, { NO_CWD, "/usr/share/file.ext", TESTSUITE_ROOT"\\usr\\share\\file.ext" },
{ TESTSUITE_ROOT, "foo", TESTSUITE_ROOT"\\foo" }, { TESTSUITE_ROOT, "foo", TESTSUITE_ROOT"\\foo" },
{ TESTSUITE_ROOT, "./foo", TESTSUITE_ROOT"\\foo" }, { TESTSUITE_ROOT, "./foo", TESTSUITE_ROOT"\\foo" },
{ TESTSUITE_ROOT, "foo/bar", TESTSUITE_ROOT"\\foo\\bar" }, { TESTSUITE_ROOT, "foo/bar", TESTSUITE_ROOT"\\foo\\bar" },

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.