From 1b23b30b29eebbe7c9953f2a7470f31a0feb8702 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 17 Dec 2011 23:39:47 +0000 Subject: [PATCH] Clean up whitespace. --- winsup/cygwin/config/i386/profile.h | 2 +- winsup/cygwin/cygthread.cc | 1 - winsup/cygwin/dcrt0.cc | 4 +- winsup/cygwin/dtable.cc | 4 +- winsup/cygwin/environ.cc | 2 +- winsup/cygwin/fhandler_console.cc | 2 +- winsup/cygwin/fhandler_disk_file.cc | 2 +- winsup/cygwin/fhandler_tty.cc | 6 +- winsup/cygwin/flock.cc | 2 +- winsup/cygwin/include/arpa/nameser.h | 4 +- winsup/cygwin/include/arpa/nameser_compat.h | 4 +- winsup/cygwin/include/fenv.h | 2 +- winsup/cygwin/include/resolv.h | 6 +- winsup/cygwin/lib/_cygwin_crt0_common.cc | 4 +- winsup/cygwin/libc/inet_addr.c | 12 +- winsup/cygwin/libc/minires.c | 26 +- winsup/cygwin/libc/rcmd.cc | 2 +- winsup/cygwin/libc/strfmon.c | 4 +- winsup/cygwin/libc/strptime.cc | 16 +- winsup/cygwin/miscfuncs.cc | 20 +- winsup/cygwin/net.cc | 2 +- winsup/cygwin/nlsfuncs.cc | 2 +- winsup/cygwin/ntdll.h | 2 +- winsup/cygwin/path.cc | 12 +- winsup/cygwin/pinfo.cc | 2 +- winsup/cygwin/pinfo.h | 2 +- winsup/cygwin/pipe.cc | 2 +- winsup/cygwin/sec_helper.cc | 2 +- winsup/cygwin/signal.cc | 2 +- winsup/cygwin/syscalls.cc | 8 +- winsup/cygwin/wow64.cc | 10 +- winsup/utils/bloda.cc | 220 ++++----- winsup/utils/cygcheck.cc | 72 +-- winsup/utils/cygpath.cc | 2 +- winsup/utils/dump_setup.cc | 46 +- winsup/utils/dumper.cc | 14 +- winsup/utils/getconf.c | 120 ++--- winsup/utils/getfacl.c | 96 ++-- winsup/utils/kill.cc | 28 +- winsup/utils/ldd.cc | 20 +- winsup/utils/loadlib.h | 2 +- winsup/utils/locale.cc | 30 +- winsup/utils/mkgroup.c | 14 +- winsup/utils/mkpasswd.c | 14 +- winsup/utils/mount.cc | 20 +- winsup/utils/passwd.c | 128 +++--- winsup/utils/path.cc | 88 ++-- winsup/utils/ps.cc | 18 +- winsup/utils/regtool.cc | 28 +- winsup/utils/setfacl.c | 468 ++++++++++---------- winsup/utils/setmetamode.c | 16 +- winsup/utils/ssp.c | 74 ++-- winsup/utils/strace.cc | 42 +- winsup/utils/testsuite.cc | 30 +- winsup/utils/testsuite.h | 10 +- winsup/utils/umount.cc | 14 +- winsup/utils/wide_path.h | 2 +- 57 files changed, 893 insertions(+), 894 deletions(-) diff --git a/winsup/cygwin/config/i386/profile.h b/winsup/cygwin/config/i386/profile.h index d1de0f98e..8a9d11ab8 100644 --- a/winsup/cygwin/config/i386/profile.h +++ b/winsup/cygwin/config/i386/profile.h @@ -44,7 +44,7 @@ #define _MCOUNT_DECL static __inline__ void _MCOUNT_CALL _mcount /* 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 compiler used %edx to store an unneeded counter variable. */ diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index 2bb8e412f..4cbd3b064 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -140,7 +140,6 @@ cygthread::simplestub (VOID *arg) info->callfunc (true); if (notify) SetEvent (notify); - return 0; } diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 8b6993968..f74c25c09 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -466,7 +466,7 @@ child_info_fork::alloc_stack () esp = getstack (esp); stackaddr = 0; /* 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 computation of _my_tls is correct. */ _tlsbase = (char *) stackbottom; @@ -706,7 +706,7 @@ dll_crt0_0 () { memory_init (true); /* 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 (wincap.is_wow64 ()) wow64_has_64bit_parent = wow64_test_for_64bit_parent (); diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index c8619ca84..05becaaa5 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -505,7 +505,7 @@ fh_alloc (path_conv& pc) if (pc.isopen ()) fh = cnew (fhandler_pty_master, -1); else - fhraw = cnew_no_ctor (fhandler_pty_master, -1); + fhraw = cnew_no_ctor (fhandler_pty_master, -1); break; case FH_WINDOWS: fh = cnew (fhandler_windows); @@ -575,7 +575,7 @@ fh_alloc (path_conv& pc) case FH_TTY: 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"); } else if (myself->ctty <= 0 && last_tty_dev diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 24d59be55..38a190cc3 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -302,7 +302,7 @@ static const unsigned char conv_start_chars[256] = WC, 0, 0, 0, WC, 0, 0, 0, /* 112 */ /* 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 diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 6347bd518..477265fe5 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -136,7 +136,7 @@ fhandler_console::set_unit () if (shared_console_info) { fh_devices this_unit = dev (); - fh_devices shared_unit = + fh_devices shared_unit = (fh_devices) shared_console_info->tty_min_state.getntty (); created = false; devset = (shared_unit == this_unit || this_unit == FH_CONSOLE diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 37040fbd5..fe29570b3 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1457,7 +1457,7 @@ out: first call to either pread or pwrite. This is used for any subsequent pread/pwrite. Thus the current file position of the "normal" file handle is not touched. - + FIXME: Note that this is just a hack. The problem with this approach is that diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 61fb8613d..8238f654c 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1201,7 +1201,7 @@ fhandler_pty_master::fhandler_pty_master (int unit) else if (!setup ()) { dev ().parse (FH_ERROR); - return; + return; } set_name ("/dev/ptmx"); } @@ -1302,8 +1302,8 @@ fhandler_pty_master::close () return 0; } -/* This is just to catch error conditions. Since the constructor - ctually opens some handles, and stat() does not open an fd, they need +/* This is just to catch error conditions. Since the constructor + actually opens some handles, and stat() does not open an fd, they need to be closed when the fhandler goes away. */ fhandler_pty_master::~fhandler_pty_master () { diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc index d88cb418b..bd508719c 100644 --- a/winsup/cygwin/flock.cc +++ b/winsup/cygwin/flock.cc @@ -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. - 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 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 diff --git a/winsup/cygwin/include/arpa/nameser.h b/winsup/cygwin/include/arpa/nameser.h index 3980933f5..ddb32302b 100755 --- a/winsup/cygwin/include/arpa/nameser.h +++ b/winsup/cygwin/include/arpa/nameser.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 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 * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/winsup/cygwin/include/arpa/nameser_compat.h b/winsup/cygwin/include/arpa/nameser_compat.h index af596d400..9579913be 100755 --- a/winsup/cygwin/include/arpa/nameser_compat.h +++ b/winsup/cygwin/include/arpa/nameser_compat.h @@ -1,6 +1,6 @@ /* Copyright (c) 1983, 1989 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 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 * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/winsup/cygwin/include/fenv.h b/winsup/cygwin/include/fenv.h index 454f14a3d..b49033f29 100755 --- a/winsup/cygwin/include/fenv.h +++ b/winsup/cygwin/include/fenv.h @@ -128,7 +128,7 @@ typedef struct _fexcept_t extern const fenv_t *_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 type "pointer to const-qualified fenv_t",may also be specified by the implementation. */ diff --git a/winsup/cygwin/include/resolv.h b/winsup/cygwin/include/resolv.h index 49967c85a..6cafcaaca 100755 --- a/winsup/cygwin/include/resolv.h +++ b/winsup/cygwin/include/resolv.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1983, 1987, 1989 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 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 * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -315,7 +315,7 @@ __END_DECLS #if !defined(SHARED_LIBBIND) || defined(LIB) /* * 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) * Make them go away if a client is including this * diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc index 222f159e1..d44b7c453 100644 --- a/winsup/cygwin/lib/_cygwin_crt0_common.cc +++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc @@ -12,7 +12,7 @@ details. */ #include "crt0.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. */ #define WEAK __attribute__ ((weak)) @@ -55,7 +55,7 @@ extern char __RUNTIME_PSEUDO_RELOC_LIST__; extern char __RUNTIME_PSEUDO_RELOC_LIST_END__; 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 delete), &(operator delete[]), diff --git a/winsup/cygwin/libc/inet_addr.c b/winsup/cygwin/libc/inet_addr.c index d80705257..24028ad95 100644 --- a/winsup/cygwin/libc/inet_addr.c +++ b/winsup/cygwin/libc/inet_addr.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1983, 1990, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -29,14 +29,14 @@ /* * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -92,7 +92,7 @@ __FBSDID("$FreeBSD$"); #include "port_after.h" #endif -/* +/* * Check whether "cp" is a valid ascii representation * of an Internet address and convert to a binary address. * 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'); c = *++cp; digit = 1; - } else if (base == 16 && isascii(c) && + } else if (base == 16 && isascii(c) && isxdigit((unsigned char)c)) { val = (val << 4) | (c + 10 - (islower((unsigned char)c) ? 'a' : 'A')); diff --git a/winsup/cygwin/libc/minires.c b/winsup/cygwin/libc/minires.c index 725112761..b88f039b7 100644 --- a/winsup/cygwin/libc/minires.c +++ b/winsup/cygwin/libc/minires.c @@ -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); } else { - /* dn_expand sets errno */ + /* dn_expand sets errno */ statp->res_h_errno = NETDB_INTERNAL; return -1; } - } + } /* Close the socket if it had been opened before a fork. 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. It is thus extremely likely that such attacks will cause a TRY_AGAIN return, probably causing the calling program to retry after a delay. - + 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 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) { DPRINTF(debug, "Flushed %d bytes\n", rslt); } - DPRINTF(debug && (errno != EWOULDBLOCK), - "Unexpected errno for flushing recvfrom: %s", strerror(errno)); + DPRINTF(debug && (errno != EWOULDBLOCK), + "Unexpected errno for flushing recvfrom: %s", strerror(errno)); /* Send the message */ rslt = cygwin_sendto(statp->sockfd, MsgPtr, MsgLength, 0, @@ -540,8 +540,8 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr, return -1; } 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++) { /* 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) && (memcmp(MsgPtr + HFIXEDSZ, AnsPtr + HFIXEDSZ, MsgLength - HFIXEDSZ) == 0)))) { 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 */ rslt = get_tcp(&statp->nsaddr_list[wServ], MsgPtr, MsgLength, AnsPtr, AnsLength, statp->options & RES_DEBUG); - continue /* Tcp loop */; + continue /* Tcp loop */; } else if ((AnsPtr[6] | AnsPtr[7])!= 0) return rslt; @@ -588,7 +588,7 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr, case FORMERR: statp->res_h_errno = HOST_NOT_FOUND; break; - case SERVFAIL: + case SERVFAIL: statp->res_h_errno = TRY_AGAIN; break; default: @@ -644,7 +644,7 @@ int res_nmkquery (res_state statp, /* Fill the header */ PUTSHORT(statp->id, buf); - PUTSHORT(RD, buf); + PUTSHORT(RD, buf); PUTSHORT(1, buf); /* Number of questions */ for (i = 0; i < 3; i++) PUTSHORT(0, buf); /* Number of answers */ @@ -655,14 +655,14 @@ int res_nmkquery (res_state statp, PUTSHORT(qclass, buf); /* 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); i = 1 + statp->id % 15; /* Between 1 and 16 */ /* id dependent rotation, also brings MSW to LSW */ id4 = (id4 << i) ^ (id4 >> (16 - i)) ^ (id4 >> (32 - i)); if ((short) id4) statp->id ^= (short) id4; - else + else statp->id++; /* Force change */ return len + (HFIXEDSZ + QFIXEDSZ); /* packet size */ diff --git a/winsup/cygwin/libc/rcmd.cc b/winsup/cygwin/libc/rcmd.cc index a09157797..8012790ec 100644 --- a/winsup/cygwin/libc/rcmd.cc +++ b/winsup/cygwin/libc/rcmd.cc @@ -430,7 +430,7 @@ iruserok_sa(const void *ra, int rlen, int superuser, const char *ruser, struct sockaddr_storage ss; /* avoid alignment issue */ - if (rlen > (int) sizeof(ss)) + if (rlen > (int) sizeof(ss)) return(-1); memcpy(&ss, ra, rlen); raddr = (struct sockaddr *)&ss; diff --git a/winsup/cygwin/libc/strfmon.c b/winsup/cygwin/libc/strfmon.c index 79f8ab461..d06bbabf6 100644 --- a/winsup/cygwin/libc/strfmon.c +++ b/winsup/cygwin/libc/strfmon.c @@ -296,9 +296,9 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format, * * = 0 - parentheses enclose the quantity and the * $currency_symbol - * = 1 - the sign string precedes the quantity and the + * = 1 - the sign string precedes the quantity and the * $currency_symbol - * = 2 - the sign string succeeds the quantity and the + * = 2 - the sign string succeeds the quantity and the * $currency_symbol * = 3 - the sign string precedes the $currency_symbol * = 4 - the sign string succeeds the $currency_symbol diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc index 66c249e9a..ca059842a 100644 --- a/winsup/cygwin/libc/strptime.cc +++ b/winsup/cygwin/libc/strptime.cc @@ -275,21 +275,21 @@ find_alt_digits (const unsigned char *bp, alt_digits_t *adi, uint *pval) return NULL; } -static int +static int is_leap_year (int year) -{ +{ return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0); -} +} -static int +static int first_day (int year) -{ +{ int ret = 4; - + while (--year >= 1970) ret = (ret + 365 + is_leap_year (year)) % 7; - return ret; -} + return ret; +} /* This simplifies the calls to conv_num enormously. */ #define ALT_DIGITS ((alt_format & ALT_O) ? *alt_digits : NULL) diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index 414abbf87..9aae6aa8b 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -347,10 +347,10 @@ CreatePipeOverlapped (PHANDLE hr, PHANDLE hw, LPSECURITY_ATTRIBUTES sa) BOOL WINAPI ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len, LPDWORD ret_len, DWORD timeout) -{ +{ OVERLAPPED ov; - BOOL ret; - + BOOL ret; + memset (&ov, 0, sizeof ov); ov.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL); 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) CancelIo (h); ret = GetOverlappedResult (h, &ov, ret_len, FALSE); - } + } CloseHandle (ov.hEvent); - return ret; -} - + return ret; +} + BOOL WINAPI WritePipeOverlapped (HANDLE h, PCVOID buf, DWORD len, LPDWORD ret_len, DWORD timeout) { - OVERLAPPED ov; - BOOL ret; + OVERLAPPED ov; + BOOL ret; memset (&ov, 0, sizeof ov); 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) CancelIo (h); ret = GetOverlappedResult (h, &ov, ret_len, FALSE); - } + } CloseHandle (ov.hEvent); return ret; } diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 785e71a48..2115debab 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -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 socket we switch to inheritance/dup via WSADuplicateSocket/WSASocket for that socket. - + Starting with Vista there's another neat way to workaround these annoying LSP sockets. WSAIoctl allows to fetch the underlying base socket, which is a normal, inheritable IFS handle. So we fetch the base socket, diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc index 873e3fd7f..61255dfc3 100644 --- a/winsup/cygwin/nlsfuncs.cc +++ b/winsup/cygwin/nlsfuncs.cc @@ -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 in that file, it replaces the locale with the correct locale string from that file. - + If successful, it returns a pointer to new_locale, NULL otherwise.*/ extern "C" char * __set_locale_from_locale_alias (const char *locale, char *new_locale) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 0e0c8b506..bb4a70dd0 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -26,7 +26,7 @@ #ifdef STATUS_INVALID_HANDLE /* Defined as unsigned value in winbase.h */ #undef STATUS_INVALID_HANDLE #endif -#define STATUS_INVALID_HANDLE ((NTSTATUS) 0xc0000008) +#define STATUS_INVALID_HANDLE ((NTSTATUS) 0xc0000008) #define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xc000000d) #define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xc000000f) #define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS) 0xc0000010) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index a9d2c8fd7..36a069c89 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -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 which is allocated on the process heap. The new method only requires 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 details depending on OS version from the calling functions. */ class fcwd_access_t { @@ -3640,13 +3640,13 @@ public: { case FCWD_OLD: default: - f_cwd = (fcwd_access_t *) + f_cwd = (fcwd_access_t *) ((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_OLD, Buffer)); case FCWD_W7: - f_cwd = (fcwd_access_t *) + f_cwd = (fcwd_access_t *) ((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_7, Buffer)); case FCWD_W8: - f_cwd = (fcwd_access_t *) + f_cwd = (fcwd_access_t *) ((PBYTE) buf_p - __builtin_offsetof (FAST_CWD_8, Buffer)); } f_cwd->DirectoryHandle () = dir; @@ -3654,7 +3654,7 @@ public: static void SetVersionFromPointer (PBYTE buf_p, bool is_buffer) { /* 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 equals MAX_PATH, and that Path.Buffer == 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(*) we have to figure out the version from the Buffer pointer in the ProcessParameters. - + (*) This is very unlikely to happen when starting the first Cygwin process, since it only happens when starting the process in a directory which can't be used as CWD by Win32, or diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index dacf5256e..180e935cf 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -386,7 +386,7 @@ pinfo::set_acl() pinfo::pinfo (HANDLE parent, pinfo_minimal& from, pid_t pid): pinfo_minimal (), destroy (false), procinfo (NULL), waiter_ready (false), - wait_thread (NULL) + wait_thread (NULL) { HANDLE herr; const char *duperr = NULL; diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index 5d19ff400..8a6e682d8 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -159,7 +159,7 @@ public: waiter_ready (false), wait_thread (NULL) {} pinfo (pid_t n, DWORD flag = 0): pinfo_minimal (), destroy (false), procinfo (NULL), waiter_ready (false), - wait_thread (NULL) + wait_thread (NULL) { init (n, flag, NULL); } diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index e7da0e9c8..2f46a5358 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -404,7 +404,7 @@ pipe_worker (int filedes[2], unsigned int psize, int mode) fdout = fhs[1]; filedes[0] = fdin; filedes[1] = fdout; - } + } return res; } diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index e89f70106..eee4886b1 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -336,7 +336,7 @@ security_descriptor::free () /* Index must match the corresponding foo_PRIVILEGE value, see security.h. */ static const struct { 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 the user token. */ } cygpriv[] = diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 482ccd213..649cda694 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -102,7 +102,7 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp, clock_gettime (clk_id, &tp); /* Check for immediate timeout */ 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; if (clk_id == CLOCK_REALTIME) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index cdf3c8501..ea0c23d0b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -140,7 +140,7 @@ dup2 (int oldfd, int newfd) res = (cfd >= 0) ? oldfd : -1; } else - res = cygheap->fdtab.dup3 (oldfd, newfd, 0); + res = cygheap->fdtab.dup3 (oldfd, newfd, 0); syscall_printf ("%R = dup2(%d, %d)", res, oldfd, newfd); return res; @@ -645,7 +645,7 @@ unlink_nt (path_conv &pc) 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 we can go straight to setting the delete disposition flag. - + NOTE: The missing sharing modes FILE_SHARE_READ and FILE_SHARE_WRITE do NOT result in a STATUS_SHARING_VIOLATION, if another handle is opened for reading/writing metadata only. In other words, if @@ -760,7 +760,7 @@ try_again: if (NT_SUCCESS (status2) && reopened < 20) { /* Workaround rm -r problem: - + Sometimes a deleted directory lingers in its parent dir after the deleting handle has already been closed. This 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 by already deleted entries. If so, we try to move the dir into the bin. This usually works. - + 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 for some reason, just try to delete the directory again, diff --git a/winsup/cygwin/wow64.cc b/winsup/cygwin/wow64.cc index 53defec4f..1f5ca6310 100644 --- a/winsup/cygwin/wow64.cc +++ b/winsup/cygwin/wow64.cc @@ -82,15 +82,15 @@ wow64_test_for_64bit_parent () no simpler way to retrieve the parent process in NT, as far as I know. Hints welcome. */ ret = NtQueryInformationProcess (NtCurrentProcess (), - ProcessBasicInformation, - &pbi, sizeof pbi, NULL); + ProcessBasicInformation, + &pbi, sizeof pbi, NULL); if (NT_SUCCESS (ret) && (parent = OpenProcess (PROCESS_QUERY_INFORMATION, - FALSE, - pbi.InheritedFromUniqueProcessId))) + FALSE, + pbi.InheritedFromUniqueProcessId))) { NtQueryInformationProcess (parent, ProcessWow64Information, - &wow64, sizeof wow64, NULL); + &wow64, sizeof wow64, NULL); CloseHandle (parent); } return !wow64; diff --git a/winsup/utils/bloda.cc b/winsup/utils/bloda.cc index c6443184f..2cd799aea 100644 --- a/winsup/utils/bloda.cc +++ b/winsup/utils/bloda.cc @@ -39,12 +39,12 @@ Kerio, Agnitum or ZoneAlarm Personal Firewall Iolo System Mechanic/AntiVirus/Firewall LanDesk - Windows Defender + Windows Defender Embassy Trust Suite fingerprint reader software containing wxvault.dll - ByteMobile laptop optimization client - - A live version is now being maintained in the Cygwin FAQ, at - http://cygwin.com/faq/faq.using.html#faq.using.bloda + ByteMobile laptop optimization client + + A live version is now being maintained in the Cygwin FAQ, at + 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 }, { FILENAME, "%programfiles%\\common files\\logitech\\lvmvfm\\LVPrcSrv.exe", LOGITECH }, { FILENAME, "%windir%\\System32\\bmnet.dll", BYTEMOBILE }, -}; +}; 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) { if (pslist->ProcessName.Length && pslist->ProcessName.Buffer) - { - dbg_printf (("%S\n", pslist->ProcessName.Buffer)); - if (!_wcsicmp (pslist->ProcessName.Buffer, psname->Buffer)) - return true; - } + { + dbg_printf (("%S\n", pslist->ProcessName.Buffer)); + if (!_wcsicmp (pslist->ProcessName.Buffer, psname->Buffer)) + return true; + } if (!pslist->NextEntryDelta) - break; + break; pslist = (PSYSTEM_PROCESSES)(pslist->NextEntryDelta + (char *)pslist); }; 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 (("= '%s'\n", &modptr->ImageName[modptr->PathLength])); if (!_stricmp (&modptr->ImageName[modptr->PathLength], modname)) - return true; + return true; modptr++; } return false; @@ -185,45 +185,45 @@ expand_path (const char *path, char *outbuf) while ((dst - outbuf) < MAX_PATH) { if (*path != '%') - { - if ((*dst++ = *path++) != 0) - continue; - break; - } + { + if ((*dst++ = *path++) != 0) + continue; + break; + } /* Expand an environ var. */ end = path + 1; while (*end != '%') - { - /* Watch out for unterminated % */ - if (*end++ == 0) - { - end = NULL; - break; - } - } + { + /* Watch out for unterminated % */ + if (*end++ == 0) + { + end = NULL; + break; + } + } /* If we didn't find the end, can't expand it. */ if ((end == NULL) || (end == (path + 1))) - { - /* Unterminated % so copy verbatim. */ - *dst++ = *path++; - continue; - } + { + /* Unterminated % so copy verbatim. */ + *dst++ = *path++; + continue; + } /* Expand the environment var into the new path. */ if ((end - (path + 1)) >= MAX_PATH) - return -1; + return -1; memcpy (envvar, path + 1, end - (path + 1)); envvar[end - (path + 1)] = 0; envval = getenv (envvar); /* If not found, copy env var name verbatim. */ if (envval == NULL) - { - *dst++ = *path++; - continue; - } + { + *dst++ = *path++; + continue; + } /* Check enough room before copying. */ len = strlen (envval); if ((dst + len - outbuf) >= MAX_PATH) - return false; + return false; memcpy (dst, envval, len); dst += len; /* 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; } -static bool +static bool detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYSTEM_MODULE_INFORMATION modlist) { HANDLE fh; @@ -248,39 +248,39 @@ detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYST case HKLMKEY: dbg_printf (("Detect reg key hklm '%s'... ", det->param)); if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS) - { - RegCloseKey (hk); - dbg_printf (("found!\n")); - return true; - } + { + RegCloseKey (hk); + dbg_printf (("found!\n")); + return true; + } break; case HKCUKEY: dbg_printf (("Detect reg key hkcu '%s'... ", det->param)); if (RegOpenKeyEx (HKEY_CURRENT_USER, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS) - { - RegCloseKey (hk); - dbg_printf (("found!\n")); - return true; - } + { + RegCloseKey (hk); + dbg_printf (("found!\n")); + return true; + } break; case FILENAME: dbg_printf (("Detect filename '%s'... ", det->param)); if (!expand_path (det->param, expandedname)) - { - printf ("Expansion failure!\n"); - break; - } + { + printf ("Expansion failure!\n"); + break; + } dbg_printf (("('%s' after expansion)... ", expandedname)); 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) - { - CloseHandle (fh); - dbg_printf (("found!\n")); - return true; - } + { + CloseHandle (fh); + dbg_printf (("found!\n")); + return true; + } break; case PROCESSNAME: @@ -290,26 +290,26 @@ detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYST ansiname.Buffer = (CHAR *) det->param; rv = RtlAnsiStringToUnicodeString (&unicodename, &ansiname, TRUE); if (rv != STATUS_SUCCESS) - { - printf ("Ansi to unicode conversion failure $%08x\n", (unsigned int) rv); - break; - } + { + printf ("Ansi to unicode conversion failure $%08x\n", (unsigned int) rv); + break; + } found = find_process_in_list (pslist, &unicodename); RtlFreeUnicodeString (&unicodename); if (found) - { - dbg_printf (("found!\n")); - return true; - } + { + dbg_printf (("found!\n")); + return true; + } break; case HOOKDLLNAME: dbg_printf (("Detect hookdll '%s'... ", det->param)); if (find_module_in_list (modlist, det->param)) - { - dbg_printf (("found!\n")); - return true; - } + { + dbg_printf (("found!\n")); + return true; + } break; } @@ -324,7 +324,7 @@ find_dodgy_app_info (enum bad_app which_app) for (i = 0; i < num_of_dodgy_apps; i++) { 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; } @@ -357,50 +357,50 @@ dump_dodgy_apps (int verbose) /* Not found would mean we coded the lists bad. */ assert (found); if (detected) - { - ++n_det; - found->found_it |= (1 << det->type); - } + { + ++n_det; + found->found_it |= (1 << det->type); + } } if (n_det) { printf ("\nPotential app conflicts:\n\n"); for (i = 0; i < num_of_dodgy_apps; i++) - { - if (big_list_of_dodgy_apps[i].found_it) - { - printf ("%s%s", big_list_of_dodgy_apps[i].details, - verbose ? "\nDetected: " : ".\n"); - if (!verbose) - continue; - const char *sep = ""; - if (big_list_of_dodgy_apps[i].found_it & (1 << HKLMKEY)) - { - printf ("HKLM Registry Key"); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << HKCUKEY)) - { - printf ("%sHKCU Registry Key", sep); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << FILENAME)) - { - printf ("%sNamed file", sep); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << PROCESSNAME)) - { - printf ("%sNamed process", sep); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << HOOKDLLNAME)) - { - printf ("%sLoaded hook DLL", sep); - } - printf (".\n\n"); - } - } + { + if (big_list_of_dodgy_apps[i].found_it) + { + printf ("%s%s", big_list_of_dodgy_apps[i].details, + verbose ? "\nDetected: " : ".\n"); + if (!verbose) + continue; + const char *sep = ""; + if (big_list_of_dodgy_apps[i].found_it & (1 << HKLMKEY)) + { + printf ("HKLM Registry Key"); + sep = ", "; + } + if (big_list_of_dodgy_apps[i].found_it & (1 << HKCUKEY)) + { + printf ("%sHKCU Registry Key", sep); + sep = ", "; + } + if (big_list_of_dodgy_apps[i].found_it & (1 << FILENAME)) + { + printf ("%sNamed file", sep); + sep = ", "; + } + if (big_list_of_dodgy_apps[i].found_it & (1 << PROCESSNAME)) + { + printf ("%sNamed process", sep); + sep = ", "; + } + if (big_list_of_dodgy_apps[i].found_it & (1 << HOOKDLLNAME)) + { + printf ("%sLoaded hook DLL", sep); + } + printf (".\n\n"); + } + } } /* Tidy up allocations. */ free (pslist); diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index 9170d5645..52411c881 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -869,7 +869,7 @@ find_app_on_path (const char *app, bool showall = false) static char tmp[SYMLINK_MAX + 1]; if (!readlink (fh, tmp, SYMLINK_MAX)) display_error("readlink failed"); - + /* Resolve the linkname relative to the directory of the link. */ char *ptr = cygpath_rel (dirname (papp), tmp, NULL); printf (" -> %s\n", ptr); @@ -884,7 +884,7 @@ find_app_on_path (const char *app, bool showall = false) if (!CloseHandle (fh)) display_error ("find_app_on_path: CloseHandle()"); /* 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); } @@ -1250,7 +1250,7 @@ handle_reg_installation (handle_reg_t what) { char *path = data + 4; if (path[1] != ':') - *(path += 2) = '\\'; + *(path += 2) = '\\'; if (what == PRINT_KEY) printf (" %s Key: %s Path: %s", i ? "User: " : "System:", name, path); @@ -1286,20 +1286,20 @@ del_orphaned_reg_installations () /* Unfortunately neither mingw nor Windows know this function. */ char * memmem (char *haystack, size_t haystacklen, - const char *needle, size_t needlelen) + const char *needle, size_t needlelen) { if (needlelen == 0) return haystack; while (needlelen <= haystacklen) { if (!memcmp (haystack, needle, needlelen)) - return haystack; + return haystack; haystack++; haystacklen--; } return NULL; } - + int handle_unique_object_name (int opt, char *path) { @@ -1358,7 +1358,7 @@ handle_unique_object_name (int opt, char *path) else { 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, CYGWIN_PROPS_MAGIC, sizeof (CYGWIN_PROPS_MAGIC)); if (!cygwin_props) @@ -1449,7 +1449,7 @@ dump_sysinfo () #define PRODUCT_UNLICENSED 0xabcdabcd #define PRODUCT_ULTIMATE_E 0x00000047 const char *products[] = - { + { /* 0x00000000 */ "", /* 0x00000001 */ " Ultimate", /* 0x00000002 */ " Home Basic", @@ -1524,11 +1524,11 @@ dump_sysinfo () /* 0x00000047 */ " Ultimate E" }; if (prod == PRODUCT_UNLICENSED) - strcat (osname, "Unlicensed"); + strcat (osname, "Unlicensed"); else if (prod > PRODUCT_ULTIMATE_E) - strcat (osname, ""); + strcat (osname, ""); else - strcat (osname, products[prod]); + strcat (osname, products[prod]); } else { @@ -1540,7 +1540,7 @@ dump_sysinfo () { strcpy (osname, "2000"); if (osversion.wProductType == VER_NT_WORKSTATION) - strcat (osname, " Professional"); + strcat (osname, " Professional"); else if (osversion.wSuiteMask & VER_SUITE_DATACENTER) strcat (osname, " Datacenter Server"); else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE) @@ -1566,7 +1566,7 @@ dump_sysinfo () { strcpy (osname, "2003 Server"); if (GetSystemMetrics (SM_SERVERR2)) - strcat (osname, " R2"); + strcat (osname, " R2"); if (osversion.wSuiteMask & VER_SUITE_BLADE) strcat (osname, " Web Edition"); else if (osversion.wSuiteMask & VER_SUITE_DATACENTER) @@ -1574,18 +1574,18 @@ dump_sysinfo () else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE) strcat (osname, " Enterprise Edition"); else if (osversion.wSuiteMask & VER_SUITE_COMPUTE_SERVER) - strcat (osname, " Compute Cluster Edition"); + strcat (osname, " Compute Cluster Edition"); } } else if (osversion.dwMajorVersion == 4) - { + { strcpy (osname, "NT 4"); if (more_info) { if (osversion.wProductType == VER_NT_WORKSTATION) - strcat (osname, " Workstation"); + strcat (osname, " Workstation"); else - { + { strcat (osname, " Server"); if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE) strcat (osname, " Enterprise Edition"); @@ -1733,12 +1733,12 @@ dump_sysinfo () printf ("Use '-r' to scan registry\n\n"); if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\kernel", - 0, KEY_READ, &key) == ERROR_SUCCESS) + "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\kernel", + 0, KEY_READ, &key) == ERROR_SUCCESS) { DWORD size; RegQueryValueEx (key, "obcaseinsensitive", NULL, NULL, - (LPBYTE) &obcaseinsensitive, &size); + (LPBYTE) &obcaseinsensitive, &size); RegCloseKey (key); } printf ("obcaseinsensitive set to %lu\n\n", obcaseinsensitive); @@ -1930,7 +1930,7 @@ dump_sysinfo () if (strcasecmp (f, "cygwin1.dll") == 0) { if (!cygwin_dll_count) - strcpy (cygdll_path, pth->dir); + strcpy (cygdll_path, pth->dir); if (!cygwin_dll_count || strcasecmp (cygdll_path, pth->dir) != 0) cygwin_dll_count++; @@ -2184,32 +2184,32 @@ At least one command option or a PROGRAM is required, as shown above.\n\ \n\ PROGRAM list library (DLL) dependencies of PROGRAM\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\ -s, --sysinfo produce diagnostic system information (implies -c)\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\ - 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\ -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\ - repository (requires internet connectivity)\n\ + repository (requires internet connectivity)\n\ --delete-orphaned-installation-keys\n\ - Delete installation keys of old, now unused\n\ - installations from the registry. Requires the right\n\ - to change the registry.\n\ + Delete installation keys of old, now unused\n\ + installations from the registry. Requires the right\n\ + to change the registry.\n\ --enable-unique-object-names Cygwin-DLL\n\ --disable-unique-object-names Cygwin-DLL\n\ --show-unique-object-names Cygwin-DLL\n\ - Enable, disable, or show the setting of the\n\ - \"unique object names\" setting in the Cygwin DLL\n\ - given as argument to this option. The DLL path must\n\ - be given as valid Windows(!) path.\n\ - See the users guide for more information.\n\ - If you don't know what this means, don't change it.\n\ + Enable, disable, or show the setting of the\n\ + \"unique object names\" setting in the Cygwin DLL\n\ + given as argument to this option. The DLL path must\n\ + be given as valid Windows(!) path.\n\ + See the users guide for more information.\n\ + If you don't know what this means, don't change it.\n\ -v, --verbose produce more verbose output\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\ \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; break; case CO_DELETE_KEYS: - del_orphaned_reg = 1; + del_orphaned_reg = 1; break; case CO_ENABLE_UON: case CO_DISABLE_UON: case CO_SHOW_UON: - unique_object_name_opt = i; + unique_object_name_opt = i; break; case 'V': print_version (); diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc index 1e7905b51..662112fe5 100644 --- a/winsup/utils/cygpath.cc +++ b/winsup/utils/cygpath.cc @@ -286,7 +286,7 @@ get_device_name (char *path) { /* If there's a trailing path, it's a perfectly valid 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. */ if ((len = strlen (ret + 4)) >= MAX_PATH) ret[2] = '?'; diff --git a/winsup/utils/dump_setup.cc b/winsup/utils/dump_setup.cc index b6868e9b3..70f03eed5 100644 --- a/winsup/utils/dump_setup.cc +++ b/winsup/utils/dump_setup.cc @@ -223,7 +223,7 @@ could_not_access (int verbose, char *filename, char *package, const char *type) } 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 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11, 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 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27, 0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31, - ' ', '!', 0xf000 | '"', '#', - '$', '%', '&', 39, - '(', ')', 0xf000 | '*', '+', - ',', '-', '.', '\\', - '0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', 0xf000 | ':', ';', + ' ', '!', 0xf000 | '"', '#', + '$', '%', '&', 39, + '(', ')', 0xf000 | '*', '+', + ',', '-', '.', '\\', + '0', '1', '2', '3', + '4', '5', '6', '7', + '8', '9', 0xf000 | ':', ';', 0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?', - '@', 'A', 'B', 'C', - 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', - 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', - 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', - '\\', ']', '^', '_', - '`', 'a', 'b', 'c', - 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', - 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', - 't', 'u', 'v', 'w', - 'x', 'y', 'z', '{', + '@', 'A', 'B', 'C', + 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', + 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', + '\\', ']', '^', '_', + '`', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', + 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', 0xf000 | '|', '}', '~', 127 }; diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc index 6aa5e077e..3b92bcc18 100644 --- a/winsup/utils/dumper.cc +++ b/winsup/utils/dumper.cc @@ -867,14 +867,14 @@ static void print_version () { printf ("dumper (cygwin) %d.%d.%d\n" - "Core Dumper for Cygwin\n" - "Copyright (C) 1999 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Core Dumper for Cygwin\n" + "Copyright (C) 1999 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } int diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c index e71c52043..7e0b5f595 100644 --- a/winsup/utils/getconf.c +++ b/winsup/utils/getconf.c @@ -424,20 +424,20 @@ printvar (const struct conf_variable *cp, const char *pathname) errno = 0; slen = confstr ((int) cp->value, NULL, 0); if (slen == 0) - { - if (errno == 0) - print_strvar (cp->name, "undefined"); - return; - } + { + if (errno == 0) + print_strvar (cp->name, "undefined"); + return; + } 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; if (confstr ((int) cp->value, sval, slen) == 0) - print_strvar (cp->name, "undefined"); + print_strvar (cp->name, "undefined"); else - print_strvar (cp->name, sval); + print_strvar (cp->name, sval); free (sval); break; @@ -445,25 +445,25 @@ printvar (const struct conf_variable *cp, const char *pathname) case SYSCONF: errno = 0; if ((val = sysconf ((int) cp->value)) == -1) - { - if (a_flag && errno != 0) - return; /* Just skip invalid variables */ - print_strvar (cp->name, "undefined"); - } + { + if (a_flag && errno != 0) + return; /* Just skip invalid variables */ + print_strvar (cp->name, "undefined"); + } else - print_longvar (cp->name, val); + print_longvar (cp->name, val); break; case PATHCONF: errno = 0; if ((val = pathconf (pathname, (int) cp->value)) == -1) - { - if (a_flag && errno != 0) - return; /* Just skip invalid variables */ - print_strvar (cp->name, "undefined"); - } + { + if (a_flag && errno != 0) + return; /* Just skip invalid variables */ + print_strvar (cp->name, "undefined"); + } else - print_longvar (cp->name, val); + print_longvar (cp->name, val); break; } } @@ -471,7 +471,7 @@ printvar (const struct conf_variable *cp, const char *pathname) static void usage (int ret) { - fprintf (ret ? stderr : stdout, + fprintf (ret ? stderr : stdout, "Usage: %1$s [-v specification] variable_name [pathname]\n" " %1$s -a [pathname]\n" "\n" @@ -493,14 +493,14 @@ static void print_version () { printf ("getconf (cygwin) %d.%d.%d\n" - "Get configuration values\n" - "Copyright (C) 2011 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Get configuration values\n" + "Copyright (C) 2011 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } struct option longopts[] = { @@ -525,23 +525,23 @@ main (int argc, char **argv) while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != -1) { switch (ch) - { - case 'a': - a_flag = 1; - break; - case 'v': - v_flag = 1; - break; - case 'h': - usage (0); + { + case 'a': + a_flag = 1; + break; + case 'v': + v_flag = 1; + break; + case 'h': + usage (0); case 'V': print_version (); return 0; - default: + default: fprintf (stderr, "Try `%s --help' for more information.\n", program_invocation_short_name); return 1; - } + } } argc -= optind; argv += optind; @@ -549,18 +549,18 @@ main (int argc, char **argv) if (v_flag) { if (a_flag || argc < 2) - usage (1); + usage (1); for (sp = spec_table; sp->name != NULL; sp++) - { - if (strcmp (argv[0], sp->name) == 0) - { - if (sp->valid != 1) - error (EXIT_FAILURE, 0, "unsupported specification \"%s\"", argv[0]); - break; - } - } + { + if (strcmp (argv[0], sp->name) == 0) + { + if (sp->valid != 1) + error (EXIT_FAILURE, 0, "unsupported specification \"%s\"", argv[0]); + break; + } + } if (sp->name == NULL) - error (EXIT_FAILURE, 0, "unknown specification \"%s\"", argv[0]); + error (EXIT_FAILURE, 0, "unknown specification \"%s\"", argv[0]); argc--; argv++; } @@ -568,7 +568,7 @@ main (int argc, char **argv) if (!a_flag) { if (argc == 0) - usage (1); + usage (1); varname = argv[0]; argc--; argv++; @@ -584,16 +584,16 @@ main (int argc, char **argv) for (cp = conf_table; cp->name != NULL; cp++) { if (a_flag || strcmp (varname, cp->name) == 0) - { - /* LINTED weird expression */ - if ((cp->type == PATHCONF) == (pathname != NULL)) - { - printvar (cp, pathname); - found = 1; - } - else if (!a_flag) - usage (1); - } + { + /* LINTED weird expression */ + if ((cp->type == PATHCONF) == (pathname != NULL)) + { + printvar (cp, pathname); + found = 1; + } + else if (!a_flag) + usage (1); + } } if (!a_flag && !found) diff --git a/winsup/utils/getfacl.c b/winsup/utils/getfacl.c index 455431343..cbde4668a 100644 --- a/winsup/utils/getfacl.c +++ b/winsup/utils/getfacl.c @@ -66,47 +66,47 @@ static void usage (FILE * stream) { fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n" - "\n" - "Display file and directory access control lists (ACLs).\n" - "\n" - " -a, --all display the filename, the owner, the group, and\n" - " the ACL of the file\n" - " -d, --dir display the filename, the owner, the group, and\n" - " the default ACL of the directory, if it exists\n" - " -h, --help output usage information and exit\n" - " -n, --noname display user and group IDs instead of names\n" - " -V, --version output version information and exit\n" - "\n" - "When multiple files are specified on the command line, a blank\n" - "line separates the ACLs for each file.\n", prog_name); - if (stream == stdout) + "\n" + "Display file and directory access control lists (ACLs).\n" + "\n" + " -a, --all display the filename, the owner, the group, and\n" + " the ACL of the file\n" + " -d, --dir display the filename, the owner, the group, and\n" + " the default ACL of the directory, if it exists\n" + " -h, --help output usage information and exit\n" + " -n, --noname display user and group IDs instead of names\n" + " -V, --version output version information and exit\n" + "\n" + "When multiple files are specified on the command line, a blank\n" + "line separates the ACLs for each file.\n", prog_name); + if (stream == stdout) { fprintf (stream, "" - "For each argument that is a regular file, special file or\n" - "directory, getfacl displays the owner, the group, and the ACL.\n" - "For directories getfacl displays additionally the default ACL.\n" - "\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" - "exists.\n" - "\n" - "The format for ACL output is as follows:\n" - " # file: filename\n" - " # owner: name or uid\n" - " # group: name or uid\n" - " user::perm\n" - " user:name or uid:perm\n" - " group::perm\n" - " group:name or gid:perm\n" - " mask:perm\n" - " other:perm\n" - " default:user::perm\n" - " default:user:name or uid:perm\n" - " default:group::perm\n" - " default:group:name or gid:perm\n" - " default:mask:perm\n" - " default:other:perm\n" - "\n"); + "For each argument that is a regular file, special file or\n" + "directory, getfacl displays the owner, the group, and the ACL.\n" + "For directories getfacl displays additionally the default ACL.\n" + "\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" + "exists.\n" + "\n" + "The format for ACL output is as follows:\n" + " # file: filename\n" + " # owner: name or uid\n" + " # group: name or uid\n" + " user::perm\n" + " user:name or uid:perm\n" + " group::perm\n" + " group:name or gid:perm\n" + " mask:perm\n" + " other:perm\n" + " default:user::perm\n" + " default:user:name or uid:perm\n" + " default:group::perm\n" + " default:group:name or gid:perm\n" + " default:mask:perm\n" + " default:other:perm\n" + "\n"); } } @@ -124,14 +124,14 @@ static void print_version () { printf ("getfacl (cygwin) %d.%d.%d\n" - "Get POSIX ACL information\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Get POSIX ACL information\n" + "Copyright (C) 2000 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } int @@ -187,12 +187,12 @@ main (int argc, char **argv) } printf ("# file: %s\n", argv[optind]); if (nopt) - { + { printf ("# owner: %lu\n", (unsigned long)st.st_uid); printf ("# group: %lu\n", (unsigned long)st.st_gid); } else - { + { printf ("# owner: %s\n", username (st.st_uid)); printf ("# group: %s\n", groupname (st.st_gid)); } diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc index a223e7f9d..a65c0463e 100644 --- a/winsup/utils/kill.cc +++ b/winsup/utils/kill.cc @@ -56,14 +56,14 @@ static void print_version () { printf ("kill (cygwin) %d.%d.%d\n" - "Process Signaller\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Process Signaller\n" + "Copyright (C) 1996 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } static const char * @@ -135,7 +135,7 @@ get_debug_priv (void) TOKEN_PRIVILEGES tkp; if (!OpenProcessToken (GetCurrentProcess (), - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok)) + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok)) return; 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); if (!h) { - if (!wait || GetLastError () != ERROR_INVALID_PARAMETER) - fprintf (stderr, "%s: couldn't open pid %u\n", - prog_name, (unsigned) dwpid); + if (!wait || GetLastError () != ERROR_INVALID_PARAMETER) + fprintf (stderr, "%s: couldn't open pid %u\n", + prog_name, (unsigned) dwpid); return; } if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0) if (sig && !TerminateProcess (h, sig << 8) && 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 ()); CloseHandle (h); } @@ -259,8 +259,8 @@ out: if (!pid) pid = strtoll (*argv, &p, 10); if (*p != '\0' - || (!force && (pid < LONG_MIN || pid > LONG_MAX)) - || (force && (pid <= 0 || pid > ULONG_MAX))) + || (!force && (pid < LONG_MIN || pid > LONG_MAX)) + || (force && (pid <= 0 || pid > ULONG_MAX))) { fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv); ret = 1; diff --git a/winsup/utils/ldd.cc b/winsup/utils/ldd.cc index 018cdccb3..6cefeb8af 100644 --- a/winsup/utils/ldd.cc +++ b/winsup/utils/ldd.cc @@ -93,14 +93,14 @@ static void print_version () { printf ("ldd (cygwin) %d.%d.%d\n" - "Print shared library dependencies\n" - "Copyright (C) 2009 - %s Chris Faylor\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Print shared library dependencies\n" + "Copyright (C) 2009 - %s Chris Faylor\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } #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); if (len <= 0) - continue; + continue; wchar_t fnw[len + 1]; mbstowcs (fnw, fn, len + 1); /* output DLL's name */ @@ -492,7 +492,7 @@ map_file (const wchar_t *filename) CloseHandle (hFile); return 0; } - + CloseHandle (hMapping); CloseHandle (hFile); @@ -658,7 +658,7 @@ process_file (const wchar_t *filename) UnmapViewOfFile (basepointer); return 8; } - + UnmapViewOfFile (basepointer); return 0; } diff --git a/winsup/utils/loadlib.h b/winsup/utils/loadlib.h index 7f3a9cc2b..b2da8c76d 100644 --- a/winsup/utils/loadlib.h +++ b/winsup/utils/loadlib.h @@ -49,7 +49,7 @@ _load_sys_library (const wchar_t *dll) if (wcscmp (dll, L"cygwin1.dll") == 0) return LoadLibraryExW (L"cygwin1.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - + wcscpy (dllpath, sysdir); wcscpy (dllpath + sysdir_len, dll); return LoadLibraryExW (dllpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); diff --git a/winsup/utils/locale.cc b/winsup/utils/locale.cc index 572ed4bcf..e3c39c049 100644 --- a/winsup/utils/locale.cc +++ b/winsup/utils/locale.cc @@ -251,17 +251,17 @@ add_locale_alias_locales () alias_buf[LOCALE_ALIAS_LINE_LEN] = '\0'; c = strrchr (alias_buf, '\n'); if (c) - *c = '\0'; + *c = '\0'; c = alias_buf; c += strspn (c, " \t"); if (!*c || *c == '#') - continue; + continue; alias = c; c += strcspn (c, " \t"); *c++ = '\0'; c += strspn (c, " \t"); if (*c == '#') - continue; + continue; replace = c; c += strcspn (c, " \t"); *c++ = '\0'; @@ -524,7 +524,7 @@ print_lc_sepstrings (int key, const char *name, const char *value) if (key) fputc ('"', stdout); if (value && *value) - fputc (';', stdout); + fputc (';', 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) if (!name || !strcmp (name, lc->name)) switch (lc->type) - { + { case is_string_fake: print_lc_svalue (key, lc->name, fake_string[lc->fromval + key]); break; @@ -746,14 +746,14 @@ print_names (int cat, int key, const char *name) for (c = categories; c->category; ++c) 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; } for (c = categories; c->category; ++c) for (lc = c->lc_names; lc->type != is_end; ++lc) if (!strcmp (name, lc->name)) { - print_lc (cat, key, c->category, lc->name, lc); + print_lc (cat, key, c->category, lc->name, lc); return; } } @@ -789,31 +789,31 @@ main (int argc, char **argv) switch (opt) { case 'a': - all = 1; + all = 1; break; case 'c': - cat = 1; + cat = 1; break; case 'k': - key = 1; + key = 1; break; case 'm': maps = 1; break; case 's': - lcid = GetSystemDefaultUILanguage (); + lcid = GetSystemDefaultUILanguage (); break; case 'u': - lcid = GetUserDefaultUILanguage (); + lcid = GetUserDefaultUILanguage (); break; case 'f': - lcid = GetUserDefaultLCID (); + lcid = GetUserDefaultLCID (); break; case 'n': - lcid = GetSystemDefaultLCID (); + lcid = GetSystemDefaultLCID (); break; case 'U': - utf = ".UTF-8"; + utf = ".UTF-8"; break; case 'v': verbose = 1; diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c index 2297a5149..393d8f8f7 100644 --- a/winsup/utils/mkgroup.c +++ b/winsup/utils/mkgroup.c @@ -668,14 +668,14 @@ static void print_version () { printf ("mkgroup (cygwin) %d.%d.%d\n" - "Group File Generator\n" - "Copyright (C) 1997 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Group File Generator\n" + "Copyright (C) 1997 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } static PPOLICY_PRIMARY_DOMAIN_INFO p_dom; diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c index 33bc408c8..c873664f9 100644 --- a/winsup/utils/mkpasswd.c +++ b/winsup/utils/mkpasswd.c @@ -570,14 +570,14 @@ static void print_version () { printf ("mkpasswd (cygwin) %d.%d.%d\n" - "Passwd File Generator\n" - "Copyright (C) 1997 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Passwd File Generator\n" + "Copyright (C) 1997 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } static void diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc index c502be34a..0995f3462 100644 --- a/winsup/utils/mount.cc +++ b/winsup/utils/mount.cc @@ -240,14 +240,14 @@ static void print_version () { printf ("mount (cygwin) %d.%d.%d\n" - "Mount filesystem utility\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Mount filesystem utility\n" + "Copyright (C) 1996 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } static char * @@ -366,7 +366,7 @@ main (int argc, char **argv) break; case saw_mount_all: if (optind <= argc) - usage (); + usage (); do_mount_from_fstab (NULL); break; default: @@ -436,7 +436,7 @@ mount_entries (void) { char *noumount; if ((noumount = strstr (p->mnt_opts, ",noumount"))) - { + { char dirname[NT_MAX_PATH]; char opts[strlen (p->mnt_opts) + 1]; @@ -456,7 +456,7 @@ mount_entries (void) } } endmntent (m); - + exit(0); } diff --git a/winsup/utils/passwd.c b/winsup/utils/passwd.c index c92a26bf7..cd2ca47bd 100644 --- a/winsup/utils/passwd.c +++ b/winsup/utils/passwd.c @@ -83,9 +83,9 @@ EvalRet (int ret, const char *user) case ERROR_ACCESS_DENIED: if (! user) - eprint (0, "You may not change password expiry information."); + eprint (0, "You may not change password expiry information."); else - eprint (0, "You may not change the password for %s.", user); + eprint (0, "You may not change the password for %s.", user); break; eprint (0, "Bad password: Invalid."); @@ -121,7 +121,7 @@ GetPW (char *user, int print_win_name, LPCWSTR server) PUSER_INFO_3 ui; struct passwd *pw; char *domain = (char *) alloca (INTERNET_MAX_HOST_NAME_LENGTH + 1); - + /* Try getting a Win32 username in case the user edited /etc/passwd */ if ((pw = getpwnam (user))) { @@ -180,13 +180,13 @@ PrintPW (PUSER_INFO_3 ui, LPCWSTR server) PUSER_MODALS_INFO_0 mi; 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", - (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", - (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", - (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", (ui->usri3_password_expired) ? "yes\n" : "no\n"); printf ("Latest password change : %s", ctime(&t)); @@ -194,22 +194,22 @@ PrintPW (PUSER_INFO_3 ui, LPCWSTR server) if (! ret) { 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) - mi->usrmod0_min_passwd_age = 0; + mi->usrmod0_min_passwd_age = 0; if (mi->usrmod0_force_logoff == TIMEQ_FOREVER) - mi->usrmod0_force_logoff = 0; + mi->usrmod0_force_logoff = 0; 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 ("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", - mi->usrmod0_min_passwd_age / ONE_DAY); + mi->usrmod0_min_passwd_age / ONE_DAY); 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", - mi->usrmod0_min_passwd_len); + mi->usrmod0_min_passwd_len); } } @@ -312,7 +312,7 @@ caller_is_admin () DWORD size; PTOKEN_GROUPS grps; SID_IDENTIFIER_AUTHORITY nt_auth = {SECURITY_NT_AUTHORITY}; - PSID admin_grp; + PSID admin_grp; DWORD i; if (is_admin == -1) @@ -351,14 +351,14 @@ static void print_version () { printf ("passwd (cygwin) %d.%d.%d\n" - "Password Utility\n" - "Copyright (C) 1999 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Password Utility\n" + "Copyright (C) 1999 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } int @@ -398,20 +398,20 @@ main (int argc, char **argv) { case 'h': usage (stdout, 0); - break; + break; case 'i': if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) usage (stderr, 1); if ((iarg = atoi (optarg)) < 0 || iarg > 999) return eprint (1, "Force logout time must be between 0 and 999."); - break; + break; case 'l': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || uopt || Sopt || Ropt) usage (stderr, 1); lopt = 1; - break; + break; case 'n': 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."); if (xarg >= 0 && narg > xarg) return eprint (1, "Minimum password age must be less than " - "maximum password age."); - break; + "maximum password age."); + break; case 'u': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || Sopt || Ropt) usage (stderr, 1); uopt = 1; - break; + break; case 'c': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) usage (stderr, 1); copt = 1; - break; + break; case 'C': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) usage (stderr, 1); Copt = 1; - break; + break; case 'd': - { + { if (Ropt) usage (stderr, 1); 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) usage (stderr, 1); eopt = 1; - break; + break; case 'E': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) usage (stderr, 1); Eopt = 1; - break; + break; case 'p': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) usage (stderr, 1); popt = 1; - break; + break; case 'P': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) usage (stderr, 1); Popt = 1; - break; + break; case 'V': print_version (); - exit (0); - break; + exit (0); + break; case 'x': 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."); if (narg >= 0 && xarg < narg) return eprint (1, "Maximum password age must be greater than " - "minimum password age."); - break; + "minimum password age."); + break; case 'L': if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) usage (stderr, 1); if ((Larg = atoi (optarg)) < 0 || Larg > LM20_PWLEN) return eprint (1, "Minimum password length must be between " - "0 and %d.", LM20_PWLEN); - break; + "0 and %d.", LM20_PWLEN); + break; case 'S': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Ropt) usage (stderr, 1); Sopt = 1; - break; + break; case 'R': if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt @@ -517,10 +517,10 @@ main (int argc, char **argv) || server) usage (stderr, 1); Ropt = 1; - break; + break; 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; } @@ -559,7 +559,7 @@ main (int argc, char **argv) "You can delete the stored password by specifying an empty password.\n\n"); strcpy (newpwd, getpass (text1)); 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)) return eprint (0, "Storing password failed: %s", strerror (errno)); return 0; @@ -568,7 +568,7 @@ main (int argc, char **argv) if (Larg >= 0 || xarg >= 0 || narg >= 0 || iarg >= 0) { if (optind < argc) - usage (stderr, 1); + usage (stderr, 1); return SetModals (xarg, narg, iarg, Larg, server); } @@ -597,31 +597,31 @@ main (int argc, char **argv) uif.usri1008_flags = ui->usri3_flags; if (lopt) - { + { if (ui->usri3_priv == USER_PRIV_ADMIN) return eprint (0, "Locking an admin account is disallowed."); - uif.usri1008_flags |= UF_ACCOUNTDISABLE; - } + uif.usri1008_flags |= UF_ACCOUNTDISABLE; + } if (uopt) - uif.usri1008_flags &= ~UF_ACCOUNTDISABLE; + uif.usri1008_flags &= ~UF_ACCOUNTDISABLE; if (copt) - uif.usri1008_flags |= UF_PASSWD_CANT_CHANGE; + uif.usri1008_flags |= UF_PASSWD_CANT_CHANGE; if (Copt) - uif.usri1008_flags &= ~UF_PASSWD_CANT_CHANGE; + uif.usri1008_flags &= ~UF_PASSWD_CANT_CHANGE; if (eopt) - uif.usri1008_flags |= UF_DONT_EXPIRE_PASSWD; + uif.usri1008_flags |= UF_DONT_EXPIRE_PASSWD; if (Eopt) - uif.usri1008_flags &= ~UF_DONT_EXPIRE_PASSWD; + uif.usri1008_flags &= ~UF_DONT_EXPIRE_PASSWD; if (popt) - uif.usri1008_flags |= UF_PASSWD_NOTREQD; + uif.usri1008_flags |= UF_PASSWD_NOTREQD; if (Popt) - uif.usri1008_flags &= ~UF_PASSWD_NOTREQD; + uif.usri1008_flags &= ~UF_PASSWD_NOTREQD; if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt) { - ret = NetUserSetInfo (server, ui->usri3_name, 1008, (LPBYTE) &uif, - NULL); - return EvalRet (ret, NULL); + ret = NetUserSetInfo (server, ui->usri3_name, 1008, (LPBYTE) &uif, + NULL); + return EvalRet (ret, NULL); } // Sopt PrintPW (ui, server); @@ -639,18 +639,18 @@ main (int argc, char **argv) { strcpy (oldpwd, getpass ("Old password: ")); if (ChangePW (user, oldpwd, oldpwd, 1, server)) - return 1; + return 1; } do { strcpy (newpwd, getpass ("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)) - ret = 1; + ret = 1; if (! ret && cnt < 2) - eprint (0, "Try again."); + eprint (0, "Try again."); } while (! ret && ++cnt < 3); return ! ret; diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc index eaebb6cd1..5f4cf6f15 100644 --- a/winsup/utils/path.cc +++ b/winsup/utils/path.cc @@ -199,24 +199,24 @@ readlink (HANDLE fh, char *path, int maxlen) || !ReadFile (fh, buf, fi.nFileSizeLow, &rv, NULL) || rv != fi.nFileSizeLow) return false; - + if (fi.nFileSizeLow > sizeof (file_header) && cmp_shortcut_header (file_header)) { cp = buf + sizeof (win_shortcut_hdr); if (file_header->flags & WSH_FLAG_IDLIST) /* Skip ITEMIDLIST */ - cp += *(unsigned short *) cp + 2; + cp += *(unsigned short *) cp + 2; if (!(len = *(unsigned short *) cp)) - return false; + return false; cp += 2; /* Has appended full path? If so, use it instead of description. */ unsigned short relpath_len = *(unsigned short *) (cp + len); if (cp + len + 2 + relpath_len < buf + fi.nFileSizeLow) - { - cp += len + 2 + relpath_len; - len = *(unsigned short *) cp; - cp += 2; - } + { + cp += len + 2 + relpath_len; + len = *(unsigned short *) cp; + cp += 2; + } if (*(PWCHAR) cp == 0xfeff) /* BOM */ { 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); } else if (len + 1 > maxlen) - return false; + return false; else memcpy (path, cp, len); path[len] = '\0'; return true; } 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); if (*(PWCHAR) cp == 0xfeff) /* BOM */ @@ -247,7 +247,7 @@ readlink (HANDLE fh, char *path, int maxlen) else strcpy (path, cp); return true; - } + } else return false; } @@ -333,21 +333,21 @@ read_flags (char *options, unsigned &flags) { char *p = strchr (options, ','); if (p) - *p++ = '\0'; + *p++ = '\0'; else - p = strchr (options, '\0'); + p = strchr (options, '\0'); for (opt *o = oopts; - o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); - o++) - if (strcmp (options, o->name) == 0) - { - if (o->clear) - flags &= ~o->val; - else - flags |= o->val; - goto gotit; - } + o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); + o++) + if (strcmp (options, o->name) == 0) + { + if (o->clear) + flags &= ~o->val; + else + flags |= o->val; + goto gotit; + } return false; 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 (sm->posix) + if (sm->posix) free (sm->posix); sm->posix = strdup (posix_path); sm->flags = mount_flags | MOUNT_CYGDRIVE; @@ -428,7 +428,7 @@ from_fstab_line (mnt_t *m, char *line, bool user) continue; /* Changing immutable mount points require the override flag. */ if ((sm->flags & MOUNT_IMMUTABLE) - && !(mount_flags & MOUNT_OVERRIDE)) + && !(mount_flags & MOUNT_OVERRIDE)) return false; if (mount_flags & MOUNT_OVERRIDE) mount_flags |= MOUNT_IMMUTABLE; @@ -475,9 +475,9 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end) unconvert_slashes (buf); char *native_path = buf; if (!strncmp (native_path, "\\\\?\\", 4)) - native_path += 4; + native_path += 4; if (!strncmp (native_path, "UNC\\", 4)) - *(native_path += 2) = '\\'; + *(native_path += 2) = '\\'; m->posix = strdup ("/"); m->native = strdup (native_path); 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; /* Create a default cygdrive entry. Note that this is a user entry. - This allows to override it with mount, unless the sysadmin created - a cygdrive entry in /etc/fstab. */ + This allows to override it with mount, unless the sysadmin created + a cygdrive entry in /etc/fstab. */ m->posix = strdup (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX); m->native = strdup ("cygdrive prefix"); m->flags = MOUNT_BINARY | MOUNT_CYGDRIVE; @@ -509,14 +509,14 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end) if (user) mbstowcs (wcscpy (u, L".d\\") + 3, get_user (), BUFSIZE - (u - path)); 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) return; char *got = buf; DWORD len = 0; /* Using BUFSIZE-1 leaves space to append two \0. */ while (ReadFile (h, got, BUFSIZE - 1 - (got - buf), - &len, NULL)) + &len, NULL)) { 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. */ got = buf; while (got < buf + len && (end = strchr (got, '\n'))) - { - end[end[-1] == '\r' ? -1 : 0] = '\0'; - if (from_fstab_line (m, got, user)) - ++m; - got = end + 1; - } + { + end[end[-1] == '\r' ? -1 : 0] = '\0'; + if (from_fstab_line (m, got, user)) + ++m; + got = end + 1; + } if (len < BUFSIZE - 1) - break; + break; /* 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 remaining bytes. */ + the buffer and reposition got so that it points to the end of + the remaining bytes. */ len = buf + len - got; memmove (buf, got, 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 *mb = (const mnt_t *) b; int ret; - + ret = (ma->flags & MOUNT_CYGDRIVE) - (mb->flags & MOUNT_CYGDRIVE); if (ret) return ret; @@ -768,7 +768,7 @@ rel_vconcat (const char *cwd, const char *s, va_list v) if (!cwd || *cwd == '\0') { if (!GetCurrentDirectory (MAX_PATH, pathbuf)) - return NULL; + return NULL; cwd = pathbuf; } @@ -878,9 +878,9 @@ char * cygpath (const char *s, ...) { va_list v; - + va_start (v, s); - + return vcygpath (NULL, s, v); } diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc index f91849a9b..fad0cb867 100644 --- a/winsup/utils/ps.cc +++ b/winsup/utils/ps.cc @@ -133,14 +133,14 @@ static void print_version () { printf ("ps (cygwin) %d.%d.%d\n" - "Show process statistics\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Show process statistics\n" + "Copyright (C) 1996 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } char dosdevs[32000]; @@ -279,7 +279,7 @@ main (int argc, char *argv[]) status = 'O'; /* Maximum possible path length under NT. There's no official define - for that value. */ + for that value. */ char pname[NT_MAX_PATH + sizeof (" ")]; if (p->ppid) { @@ -355,7 +355,7 @@ main (int argc, char *argv[]) if (!n || !GetModuleFileNameExW (h, hm[0], pwname, NT_MAX_PATH)) strcpy (pname, "*** unknown ***"); else - wcstombs (pname, pwname, NT_MAX_PATH); + wcstombs (pname, pwname, NT_MAX_PATH); } FILETIME ct, et, kt, ut; if (GetProcessTimes (h, &ct, &et, &kt, &ut)) diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc index 501fff36c..cc28d485e 100644 --- a/winsup/utils/regtool.cc +++ b/winsup/utils/regtool.cc @@ -179,14 +179,14 @@ static void print_version () { printf ("regtool (cygwin) %d.%d.%d\n" - "Registry tool\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Registry tool\n" + "Copyright (C) 2000 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } void @@ -420,18 +420,18 @@ find_key (int howmanyparts, REGSAM access, int option = 0) if (RegCreateKeyExW (base, name, 0, NULL, option, access | wow64, NULL, &key2, NULL) == ERROR_SUCCESS) - { + { if (rv == ERROR_SUCCESS) RegCloseKey (key); key = key2; rv = ERROR_SUCCESS; - } + } } if (rv != ERROR_SUCCESS) Fail (rv); } else if (argv[1]) - { + { ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0); wchar_t 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); } else - { + { rv = RegUnLoadKeyW (base, name); if (rv != ERROR_SUCCESS) Fail (rv); @@ -587,7 +587,7 @@ cmd_remove () { HMODULE mod = LoadLibrary ("advapi32.dll"); 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) rv = (*regDeleteKeyEx) (key, value, wow64, 0); @@ -639,7 +639,7 @@ cmd_set () case REG_NONE: case REG_BINARY: for (n = 0; argv[n+1]; n++) - ; + ; if (n == 1 && strcmp (argv[1], "-") == 0) { /* read from stdin */ i = n = 0; @@ -720,7 +720,7 @@ cmd_set () rv = ERROR_INVALID_CATEGORY; break; } - + if (data) free(data); diff --git a/winsup/utils/setfacl.c b/winsup/utils/setfacl.c index 857be7971..66739c043 100644 --- a/winsup/utils/setfacl.c +++ b/winsup/utils/setfacl.c @@ -56,7 +56,7 @@ mode_t getperm (char *in) { int i = atoi (in); if (i < 0 || i > 7) - return ILLEGAL_MODE; + return ILLEGAL_MODE; return i << 6 | i << 3 | i; } if (strlen (in) > 3 && strchr (" \t\n\r#", in[3])) @@ -68,8 +68,8 @@ mode_t getperm (char *in) || !strchr ("x-", in[2])) return ILLEGAL_MODE; return (in[0] == 'r' ? S_IROTH : 0) - | (in[1] == 'w' ? S_IWOTH : 0) - | (in[2] == 'x' ? S_IXOTH : 0); + | (in[1] == 'w' ? S_IWOTH : 0) + | (in[2] == 'x' ? S_IXOTH : 0); } BOOL @@ -127,34 +127,34 @@ getaclentry (action_t action, char *c, aclent_t *ace) can't be deleted. */ c2 = strchrnul (c + 1, ':'); if (*c2 == ':') - *c2++ = '\0'; + *c2++ = '\0'; else if (action != Delete) return FALSE; else if (!(ace->a_type & ACL_DEFAULT)) return FALSE; /* Fetch user/group id. */ if (isdigit ((unsigned char) *c)) - { - char *c3; + { + char *c3; - ace->a_id = strtol (c, &c3, 10); - if (*c3) - return FALSE; - } + ace->a_id = strtol (c, &c3, 10); + if (*c3) + return FALSE; + } else if (ace->a_type & USER_OBJ) - { - struct passwd *pw = getpwnam (c); - if (!pw) - return FALSE; - ace->a_id = pw->pw_uid; - } + { + struct passwd *pw = getpwnam (c); + if (!pw) + return FALSE; + ace->a_id = pw->pw_uid; + } else - { - struct group *gr = getgrnam (c); - if (!gr) - return FALSE; - ace->a_id = gr->gr_gid; - } + { + struct group *gr = getgrnam (c); + if (!gr) + return FALSE; + ace->a_id = gr->gr_gid; + } if (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; if (!strcmp (buf, "-")) - fp = stdin; + fp = stdin; else if (! (fp = fopen (buf, "r"))) - return FALSE; + return FALSE; while ((fb = fgets (fbuf, 256, fp))) - { + { while (strchr (" \t", *fb)) ++fb; if (strchr ("\n\r#", *fb)) continue; - if (!getaclentry (action, fb, acls + (*idx)++)) - { - fclose (fp); - return FALSE; - } - } + if (!getaclentry (action, fb, acls + (*idx)++)) + { + fclose (fp); + return FALSE; + } + } if (fp != stdin) fclose (fp); } else for (c = strtok (buf, ","); c; c = strtok (NULL, ",")) if (!getaclentry (action, c, acls + (*idx)++)) - return FALSE; + return FALSE; return TRUE; } @@ -226,7 +226,7 @@ searchace (aclent_t *aclp, int nentries, int type, int id) for (i = 0; i < nentries; ++i) if ((aclp[i].a_type == type && (id < 0 || aclp[i].a_id == id)) - || !aclp[i].a_type) + || !aclp[i].a_type) return i; return -1; } @@ -239,24 +239,24 @@ modacl (aclent_t *tgt, int tcnt, aclent_t *src, int scnt) for (s = 0; s < scnt; ++s) { 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) - return -1; + return -1; if (src[s].a_perm == ILLEGAL_MODE) - { - if (t < tcnt) - { - for (i = t + 1; i < tcnt; ++i) - tgt[i - 1] = tgt[i]; - --tcnt; - } - } + { + if (t < tcnt) + { + for (i = t + 1; i < tcnt; ++i) + tgt[i - 1] = tgt[i]; + --tcnt; + } + } else - { - tgt[t] = src[s]; - if (t >= tcnt) - ++tcnt; - } + { + tgt[t] = src[s]; + if (t >= tcnt) + ++tcnt; + } } return tcnt; } @@ -290,105 +290,105 @@ static void usage (FILE * stream) { fprintf (stream, "" - "Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n" - " %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n" - "\n" - "Modify file and directory access control lists (ACLs)\n" - "\n" - " -d, --delete delete one or more specified ACL entries\n" - " -f, --file set ACL entries for FILE to ACL entries read\n" - " from a ACL_FILE\n" - " -m, --modify modify one or more specified ACL entries\n" - " -r, --replace replace mask entry with maximum permissions\n" - " needed for the file group class\n" - " -s, --substitute substitute specified ACL entries for the\n" - " ACL of FILE\n" - " -h, --help output usage information and exit\n" - " -V, --version output version information and exit\n" - "\n" - "At least one of (-d, -f, -m, -s) must be specified\n" - "\n", prog_name, prog_name); - if (stream == stdout) + "Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n" + " %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n" + "\n" + "Modify file and directory access control lists (ACLs)\n" + "\n" + " -d, --delete delete one or more specified ACL entries\n" + " -f, --file set ACL entries for FILE to ACL entries read\n" + " from a ACL_FILE\n" + " -m, --modify modify one or more specified ACL entries\n" + " -r, --replace replace mask entry with maximum permissions\n" + " needed for the file group class\n" + " -s, --substitute substitute specified ACL entries for the\n" + " ACL of FILE\n" + " -h, --help output usage information and exit\n" + " -V, --version output version information and exit\n" + "\n" + "At least one of (-d, -f, -m, -s) must be specified\n" + "\n", prog_name, prog_name); + if (stream == stdout) { printf("" - " Acl_entries are one or more comma-separated ACL entries \n" - " from the following list:\n" - "\n" - " u[ser]::perm\n" - " u[ser]:uid:perm\n" - " g[roup]::perm\n" - " g[roup]:gid:perm\n" - " m[ask]:perm\n" - " o[ther]:perm\n" - "\n" - " Default entries are like the above with the additional\n" - " default identifier. For example: \n" - "\n" - " d[efault]:u[ser]:uid:perm\n" - "\n" - " 'perm' is either a 3-char permissions string in the form\n" - " \"rwx\" with the character - for no permission\n" - " or it is the octal representation of the permissions, a\n" - " value from 0 (equivalent to \"---\") to 7 (\"rwx\").\n" - " 'uid' is a user name or a numerical uid.\n" - " 'gid' is a group name or a numerical gid.\n" - "\n" - "\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" - "entries.\n" - "\n" - "The following options are supported:\n" - "\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" - " Acl_entries to be deleted should be specified without\n" - " permissions, as in the following list:\n" - "\n" - " u[ser]:uid\n" - " g[roup]:gid\n" - " d[efault]:u[ser]:uid\n" - " d[efault]:g[roup]:gid\n" - " d[efault]:m[ask]:\n" - " d[efault]:o[ther]:\n" - "\n" - "-f Take the Acl_entries from ACL_FILE one per line. Whitespace\n" - " characters are ignored, and the character \"#\" may be used\n" - " to start a comment. The special filename \"-\" indicates\n" - " reading from stdin.\n" - " Required entries are\n" - " - One user entry for the owner of the file.\n" - " - One group entry for the group of the file.\n" - " - One other entry.\n" - " If additional user and group entries are given:\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" - " If it is a directory:\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 mask entry for the file group class.\n" - " - One default other entry.\n" - "\n" - "-m Add or modify one or more specified ACL entries.\n" - " Acl_entries is a comma-separated list of entries from the \n" - " same list as above.\n" - "\n" - "-r Causes the permissions specified in the mask entry to be\n" - " ignored and replaced by the maximum permissions needed for\n" - " the file group class.\n" - "\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" - "\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" - "\n" - "Directories may contain default ACL entries. Files created\n" - "in a directory that contains default ACL entries will have\n" - "permissions according to the combination of the current umask,\n" - "the explicit permissions requested and the default ACL entries\n" - "Note: Under Cygwin, the default ACL entries are not taken into\n" - "account currently.\n\n", prog_name); + " Acl_entries are one or more comma-separated ACL entries \n" + " from the following list:\n" + "\n" + " u[ser]::perm\n" + " u[ser]:uid:perm\n" + " g[roup]::perm\n" + " g[roup]:gid:perm\n" + " m[ask]:perm\n" + " o[ther]:perm\n" + "\n" + " Default entries are like the above with the additional\n" + " default identifier. For example: \n" + "\n" + " d[efault]:u[ser]:uid:perm\n" + "\n" + " 'perm' is either a 3-char permissions string in the form\n" + " \"rwx\" with the character - for no permission\n" + " or it is the octal representation of the permissions, a\n" + " value from 0 (equivalent to \"---\") to 7 (\"rwx\").\n" + " 'uid' is a user name or a numerical uid.\n" + " 'gid' is a group name or a numerical gid.\n" + "\n" + "\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" + "entries.\n" + "\n" + "The following options are supported:\n" + "\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" + " Acl_entries to be deleted should be specified without\n" + " permissions, as in the following list:\n" + "\n" + " u[ser]:uid\n" + " g[roup]:gid\n" + " d[efault]:u[ser]:uid\n" + " d[efault]:g[roup]:gid\n" + " d[efault]:m[ask]:\n" + " d[efault]:o[ther]:\n" + "\n" + "-f Take the Acl_entries from ACL_FILE one per line. Whitespace\n" + " characters are ignored, and the character \"#\" may be used\n" + " to start a comment. The special filename \"-\" indicates\n" + " reading from stdin.\n" + " Required entries are\n" + " - One user entry for the owner of the file.\n" + " - One group entry for the group of the file.\n" + " - One other entry.\n" + " If additional user and group entries are given:\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" + " If it is a directory:\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 mask entry for the file group class.\n" + " - One default other entry.\n" + "\n" + "-m Add or modify one or more specified ACL entries.\n" + " Acl_entries is a comma-separated list of entries from the \n" + " same list as above.\n" + "\n" + "-r Causes the permissions specified in the mask entry to be\n" + " ignored and replaced by the maximum permissions needed for\n" + " the file group class.\n" + "\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" + "\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" + "\n" + "Directories may contain default ACL entries. Files created\n" + "in a directory that contains default ACL entries will have\n" + "permissions according to the combination of the current umask,\n" + "the explicit permissions requested and the default ACL entries\n" + "Note: Under Cygwin, the default ACL entries are not taken into\n" + "account currently.\n\n", prog_name); } else fprintf(stream, "Try '%s --help' for more information.\n", prog_name); @@ -410,14 +410,14 @@ static void print_version () { printf ("setfacl (cygwin) %d.%d.%d\n" - "POSIX ACL modification utility\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "POSIX ACL modification utility\n" + "Copyright (C) 2000 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } int @@ -437,83 +437,83 @@ main (int argc, char **argv) switch (c) { case 'd': - if (action == NoAction) - action = Delete; - else if (action == Modify) - action = ModNDel; - else - { - usage (stderr); - return 1; + if (action == NoAction) + action = Delete; + else if (action == Modify) + action = ModNDel; + else + { + usage (stderr); + return 1; } - if (! getaclentries (Delete, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; + if (! getaclentries (Delete, optarg, acls, &aclidx)) + { + fprintf (stderr, "%s: illegal acl entries\n", prog_name); + return 2; + } + break; case 'f': - if (action == NoAction) - action = Set; - else - { - usage (stderr); - return 1; + if (action == NoAction) + action = Set; + else + { + usage (stderr); + return 1; } - if (! getaclentries (SetFromFile, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; + if (! getaclentries (SetFromFile, optarg, acls, &aclidx)) + { + fprintf (stderr, "%s: illegal acl entries\n", prog_name); + return 2; + } + break; case 'h': - usage (stdout); - return 0; + usage (stdout); + return 0; case 'm': - if (action == NoAction) - action = Modify; - else if (action == Delete) - action = ModNDel; - else - { - usage (stderr); - return 1; + if (action == NoAction) + action = Modify; + else if (action == Delete) + action = ModNDel; + else + { + usage (stderr); + return 1; } - if (! getaclentries (Modify, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; + if (! getaclentries (Modify, optarg, acls, &aclidx)) + { + fprintf (stderr, "%s: illegal acl entries\n", prog_name); + return 2; + } + break; case 'r': - if (!ropt) - ropt = 1; - else - { - usage (stderr); - return 1; + if (!ropt) + ropt = 1; + else + { + usage (stderr); + return 1; } - break; + break; case 's': - if (action == NoAction) - action = Set; - else - { - usage (stderr); - return 1; + if (action == NoAction) + action = Set; + else + { + usage (stderr); + return 1; } - if (! getaclentries (Set, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; + if (! getaclentries (Set, optarg, acls, &aclidx)) + { + fprintf (stderr, "%s: illegal acl entries\n", prog_name); + return 2; + } + break; case 'V': - print_version (); - return 0; + print_version (); + return 0; default: - fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); - return 1; + fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); + return 1; } if (action == NoAction) { @@ -529,31 +529,31 @@ main (int argc, char **argv) switch (aclcheck (acls, aclidx, NULL)) { case GRP_ERROR: - fprintf (stderr, "%s: more than one group entry.\n", prog_name); - return 2; + fprintf (stderr, "%s: more than one group entry.\n", prog_name); + return 2; case USER_ERROR: - fprintf (stderr, "%s: more than one user entry.\n", prog_name); - return 2; + fprintf (stderr, "%s: more than one user entry.\n", prog_name); + return 2; case CLASS_ERROR: - fprintf (stderr, "%s: more than one mask entry.\n", prog_name); - return 2; + fprintf (stderr, "%s: more than one mask entry.\n", prog_name); + return 2; case OTHER_ERROR: - fprintf (stderr, "%s: more than one other entry.\n", prog_name); - return 2; + fprintf (stderr, "%s: more than one other entry.\n", prog_name); + return 2; case DUPLICATE_ERROR: - fprintf (stderr, "%s: duplicate additional user or group.\n", prog_name); - return 2; + fprintf (stderr, "%s: duplicate additional user or group.\n", prog_name); + return 2; case ENTRY_ERROR: - fprintf (stderr, "%s: invalid entry type.\n", prog_name); - return 2; + fprintf (stderr, "%s: invalid entry type.\n", prog_name); + return 2; case MISS_ERROR: - fprintf (stderr, "%s: missing entries.\n", prog_name); - return 2; + fprintf (stderr, "%s: missing entries.\n", prog_name); + return 2; case MEM_ERROR: - fprintf (stderr, "%s: out of memory.\n", prog_name); - return 2; + fprintf (stderr, "%s: out of memory.\n", prog_name); + return 2; default: - break; + break; } for (c = optind; c < argc; ++c) ret |= setfacl (action, argv[c], acls, aclidx); diff --git a/winsup/utils/setmetamode.c b/winsup/utils/setmetamode.c index de8c45544..fc1059f7c 100644 --- a/winsup/utils/setmetamode.c +++ b/winsup/utils/setmetamode.c @@ -48,14 +48,14 @@ void print_version () { printf ("setmetamode (cygwin) %d.%d.%d\n" - "Get or set keyboard meta mode\n" - "Copyright (C) 2006 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Get or set keyboard meta mode\n" + "Copyright (C) 2006 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } struct option longopts[] = { @@ -89,7 +89,7 @@ main (int ac, char *av[]) switch (opt) { case 'h': - usage (); + usage (); return 0; case 'V': print_version (); diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c index 662c0847d..63aa9197e 100644 --- a/winsup/utils/ssp.c +++ b/winsup/utils/ssp.c @@ -662,7 +662,7 @@ usage (FILE * stream) " -h, --help output usage information and exit\n" " -l, --dll enable dll profiling. A chart of relative DLL usage\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" " -t, --trace-eip trace every EIP value to a file TRACE.SSP. This\n" " gets big *fast*.\n" @@ -813,14 +813,14 @@ static void print_version () { printf ("ssp (cygwin) %d.%d.%d\n" - "Single-Step Profiler\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Single-Step Profiler\n" + "Copyright (C) 2000 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } int @@ -838,48 +838,48 @@ main (int argc, char **argv) switch (c) { case 'c': - printf ("tracing *all* $eip to the console\n"); - trace_console = 1; - break; + printf ("tracing *all* $eip to the console\n"); + trace_console = 1; + break; case 'd': - printf ("stepping disabled; enable via OutputDebugString (\"ssp on\")\n"); - stepping_enabled = 0; - break; + printf ("stepping disabled; enable via OutputDebugString (\"ssp on\")\n"); + stepping_enabled = 0; + break; case 'e': - printf ("stepping enabled; disable via OutputDebugString (\"ssp off\")\n"); - stepping_enabled = 1; - break; + printf ("stepping enabled; disable via OutputDebugString (\"ssp off\")\n"); + stepping_enabled = 1; + break; case 'h': - usage (stdout); - break; + usage (stdout); + break; case 'l': - printf ("profiling dll usage\n"); - dll_counts = 1; - break; + printf ("profiling dll usage\n"); + dll_counts = 1; + break; case 's': - printf ("tracing all sub-threads too, not just the main one\n"); - trace_all_threads = 1; - break; + printf ("tracing all sub-threads too, not just the main one\n"); + trace_all_threads = 1; + break; case 't': - printf ("tracing all $eip to trace.ssp\n"); - tracing_enabled = 1; - break; + printf ("tracing all $eip to trace.ssp\n"); + tracing_enabled = 1; + break; case 'v': - printf ("verbose messages enabled\n"); - verbose = 1; - break; + printf ("verbose messages enabled\n"); + verbose = 1; + break; case 'V': - print_version (); - exit (0); - default: - fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); + print_version (); + exit (0); + default: + fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); exit (1); } if ( (argc - optind) < 3 ) usage (stderr); - sscanf (argv[optind++], "%i", &low_pc); - sscanf (argv[optind++], "%i", &high_pc); + sscanf (argv[optind++], "%i", &low_pc); + sscanf (argv[optind++], "%i", &high_pc); if (low_pc > high_pc-8) { diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index c84fede85..42fb955be 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -310,16 +310,16 @@ attach_process (pid_t pid) HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, child_pid); if (h) - { - /* Try to turn off DEBUG_ONLY_THIS_PROCESS so we can follow forks */ - /* This is only supported on XP and later */ - ULONG DebugFlags = DEBUG_PROCESS_DETACH_ON_EXIT; - NTSTATUS status = NtSetInformationProcess (h, ProcessDebugFlags, &DebugFlags, sizeof (DebugFlags)); - if (!NT_SUCCESS (status)) - warn (0, "Could not clear DEBUG_ONLY_THIS_PROCESS (%x), will not trace child processes", status); + { + /* Try to turn off DEBUG_ONLY_THIS_PROCESS so we can follow forks */ + /* This is only supported on XP and later */ + ULONG DebugFlags = DEBUG_PROCESS_DETACH_ON_EXIT; + NTSTATUS status = NtSetInformationProcess (h, ProcessDebugFlags, &DebugFlags, sizeof (DebugFlags)); + if (!NT_SUCCESS (status)) + warn (0, "Could not clear DEBUG_ONLY_THIS_PROCESS (%x), will not trace child processes", status); - CloseHandle(h); - } + CloseHandle(h); + } } return; @@ -866,15 +866,15 @@ Trace system calls and signals\n\ -h, --help output usage information and exit\n\ -m, --mask=MASK set message filter mask\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\ -p, --pid=n attach to executing program with cygwin pid n\n\ -q, --quiet suppress messages about attaching, detaching, etc.\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\ - the default microsecond timestamp. Implies -d\n\ + the default microsecond timestamp. Implies -d\n\ -T, --toggle toggle tracing in a process already being\n\ - traced. Requires -p \n\ + traced. Requires -p \n\ -u, --usecs toggle printing of microseconds timestamp\n\ -V, --version output version information and exit\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\ (0x is optional). Combine masks with '+' or ',' like so:\n\ \n\ - --mask=wm+system,malloc+0x00800\n\ + --mask=wm+system,malloc+0x00800\n\ \n\ Mnemonic Hex Corresponding Def Description\n\ =========================================================================\n\ @@ -908,7 +908,7 @@ Trace system calls and signals\n\ malloc 0x020000 (_STRACE_MALLOC) Trace malloc calls.\n\ thread 0x040000 (_STRACE_THREAD) Thread-locking calls.\n\ special 0x100000 (_STRACE_SPECIAL) Special debugging printfs for\n\ - non-checked-in code\n\ + non-checked-in code\n\ "); if (where == stderr) fprintf (stderr, "Try `%s --help' for more information.\n", pgm); @@ -941,14 +941,14 @@ static void print_version () { printf ("strace (cygwin) %d.%d.%d\n" - "System Trace\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "System Trace\n" + "Copyright (C) 2000 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } int diff --git a/winsup/utils/testsuite.cc b/winsup/utils/testsuite.cc index b87f85cf8..b6762052c 100644 --- a/winsup/utils/testsuite.cc +++ b/winsup/utils/testsuite.cc @@ -66,24 +66,24 @@ main (int argc, char **argv) { char *result = cygpath (t.posix, NULL); bool pass = (strcmp (result, t.win32) == 0); - + if (pass) - { - numpass++; - printf ("test %03d: PASS cwd=%-18s input=%-22s expected+actual=%s\n", - curtest, t.cwd, t.posix, result); - } + { + numpass++; + printf ("test %03d: PASS cwd=%-18s input=%-22s expected+actual=%s\n", + curtest, t.cwd, t.posix, result); + } else - { - printf ("test %03d: FAIL cwd=%-18s input=%-29s expected=%-25s actual=%s\n", - curtest, t.cwd, t.posix, t.win32, result); - } + { + printf ("test %03d: FAIL cwd=%-18s input=%-29s expected=%-25s actual=%s\n", + curtest, t.cwd, t.posix, t.win32, result); + } } printf ("\n" - "total tests: %d\n" - "pass : %d (%.1f%%)\n" - "fail : %d (%.1f%%)\n", - curtest, numpass, ((float)numpass)/curtest * 100.0F, curtest - numpass, - ((float)curtest - numpass)/curtest * 100.0F); + "total tests: %d\n" + "pass : %d (%.1f%%)\n" + "fail : %d (%.1f%%)\n", + curtest, numpass, ((float)numpass)/curtest * 100.0F, curtest - numpass, + ((float)curtest - numpass)/curtest * 100.0F); return (numpass < curtest ? 1 : 0); } diff --git a/winsup/utils/testsuite.h b/winsup/utils/testsuite.h index 3bc360ab5..a75d6d1e1 100644 --- a/winsup/utils/testsuite.h +++ b/winsup/utils/testsuite.h @@ -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/lib/file.ext", TESTSUITE_ROOT"\\lib\\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/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, "/usr/file.ext", TESTSUITE_ROOT"\\usr\\file.ext" }, - { NO_CWD, "/usr/share/file.ext", TESTSUITE_ROOT"\\usr\\share\\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/dir/file.ext", TESTSUITE_ROOT"\\home\\foo\\dir\\file.ext" }, + { NO_CWD, "/usr/file.ext", TESTSUITE_ROOT"\\usr\\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/bar", TESTSUITE_ROOT"\\foo\\bar" }, diff --git a/winsup/utils/umount.cc b/winsup/utils/umount.cc index de27ff335..82730530b 100644 --- a/winsup/utils/umount.cc +++ b/winsup/utils/umount.cc @@ -57,14 +57,14 @@ static void print_version () { printf ("umount (cygwin) %d.%d.%d\n" - "Unmount filesystem utility\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" + "Unmount filesystem utility\n" + "Copyright (C) 1996 - %s Red Hat, Inc.\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", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); + CYGWIN_VERSION_DLL_MAJOR / 1000, + CYGWIN_VERSION_DLL_MAJOR % 1000, + CYGWIN_VERSION_DLL_MINOR, + strrchr (__DATE__, ' ') + 1); } int diff --git a/winsup/utils/wide_path.h b/winsup/utils/wide_path.h index 8c49c5bf8..3194ecf97 100644 --- a/winsup/utils/wide_path.h +++ b/winsup/utils/wide_path.h @@ -1,5 +1,5 @@ /* 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. Copyright 2009 Red Hat, Inc.