mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
pgindent run for 9.4
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
This commit is contained in:
@@ -373,7 +373,7 @@ pg_get_encoding_from_locale(const char *ctype, bool write_message)
|
||||
|
||||
/*
|
||||
* We print a warning if we got a CODESET string but couldn't recognize
|
||||
* it. This means we need another entry in the table.
|
||||
* it. This means we need another entry in the table.
|
||||
*/
|
||||
if (write_message)
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
@@ -118,7 +118,7 @@ typedef int int32_t;
|
||||
* representation is to store one bit per byte in an array of bytes. Bit N of
|
||||
* the NBS spec is stored as the LSB of the Nth byte (index N-1) in the array.
|
||||
* Another representation stores the 64 bits in 8 bytes, with bits 1..8 in the
|
||||
* first byte, 9..16 in the second, and so on. The DES spec apparently has
|
||||
* first byte, 9..16 in the second, and so on. The DES spec apparently has
|
||||
* bit 1 in the MSB of the first byte, but that is particularly noxious so we
|
||||
* bit-reverse each byte so that bit 1 is the LSB of the first byte, bit 8 is
|
||||
* the MSB of the first byte. Specifically, the 64-bit input data and key are
|
||||
@@ -126,21 +126,21 @@ typedef int int32_t;
|
||||
* MSB format.
|
||||
*
|
||||
* DES operates internally on groups of 32 bits which are expanded to 48 bits
|
||||
* by permutation E and shrunk back to 32 bits by the S boxes. To speed up
|
||||
* by permutation E and shrunk back to 32 bits by the S boxes. To speed up
|
||||
* the computation, the expansion is applied only once, the expanded
|
||||
* representation is maintained during the encryption, and a compression
|
||||
* permutation is applied only at the end. To speed up the S-box lookups,
|
||||
* permutation is applied only at the end. To speed up the S-box lookups,
|
||||
* the 48 bits are maintained as eight 6 bit groups, one per byte, which
|
||||
* directly feed the eight S-boxes. Within each byte, the 6 bits are the
|
||||
* most significant ones. The low two bits of each byte are zero. (Thus,
|
||||
* most significant ones. The low two bits of each byte are zero. (Thus,
|
||||
* bit 1 of the 48 bit E expansion is stored as the "4"-valued bit of the
|
||||
* first byte in the eight byte representation, bit 2 of the 48 bit value is
|
||||
* the "8"-valued bit, and so on.) In fact, a combined "SPE"-box lookup is
|
||||
* used, in which the output is the 64 bit result of an S-box lookup which
|
||||
* has been permuted by P and expanded by E, and is ready for use in the next
|
||||
* iteration. Two 32-bit wide tables, SPE[0] and SPE[1], are used for this
|
||||
* lookup. Since each byte in the 48 bit path is a multiple of four, indexed
|
||||
* lookup of SPE[0] and SPE[1] is simple and fast. The key schedule and
|
||||
* lookup. Since each byte in the 48 bit path is a multiple of four, indexed
|
||||
* lookup of SPE[0] and SPE[1] is simple and fast. The key schedule and
|
||||
* "salt" are also converted to this 8*(6+2) format. The SPE table size is
|
||||
* 8*64*8 = 4K bytes.
|
||||
*
|
||||
@@ -154,7 +154,7 @@ typedef int int32_t;
|
||||
* The byte-order problem is unfortunate, since on the one hand it is good
|
||||
* to have a machine-independent C_block representation (bits 1..8 in the
|
||||
* first byte, etc.), and on the other hand it is good for the LSB of the
|
||||
* first byte to be the LSB of i0. We cannot have both these things, so we
|
||||
* first byte to be the LSB of i0. We cannot have both these things, so we
|
||||
* currently use the "little-endian" representation and avoid any multi-byte
|
||||
* operations that depend on byte order. This largely precludes use of the
|
||||
* 64-bit datatype since the relative order of i0 and i1 are unknown. It
|
||||
@@ -181,13 +181,13 @@ typedef int int32_t;
|
||||
* IE3264: MSB->LSB conversion, initial permutation, and expansion.
|
||||
* This is done by collecting the 32 even-numbered bits and applying
|
||||
* a 32->64 bit transformation, and then collecting the 32 odd-numbered
|
||||
* bits and applying the same transformation. Since there are only
|
||||
* bits and applying the same transformation. Since there are only
|
||||
* 32 input bits, the IE3264 transformation table is half the size of
|
||||
* the usual table.
|
||||
* CF6464: Compression, final permutation, and LSB->MSB conversion.
|
||||
* This is done by two trivial 48->32 bit compressions to obtain
|
||||
* a 64-bit block (the bit numbering is given in the "CIFP" table)
|
||||
* followed by a 64->64 bit "cleanup" transformation. (It would
|
||||
* followed by a 64->64 bit "cleanup" transformation. (It would
|
||||
* be possible to group the bits in the 64-bit block so that 2
|
||||
* identical 32->32 bit transformations could be used instead,
|
||||
* saving a factor of 4 in space and possibly 2 in time, but
|
||||
@@ -206,7 +206,7 @@ typedef int int32_t;
|
||||
* transforms 56 bits into 48 bits, dropping 8 bits, so PC2 is not
|
||||
* invertible. We get around that problem by using a modified PC2
|
||||
* which retains the 8 otherwise-lost bits in the unused low-order
|
||||
* bits of each byte. The low-order bits are cleared when the
|
||||
* bits of each byte. The low-order bits are cleared when the
|
||||
* codes are stored into the key schedule.
|
||||
* PC2ROT[1]: Same as PC2ROT[0], but with two rotations.
|
||||
* This is faster than applying PC2ROT[0] twice,
|
||||
@@ -215,7 +215,7 @@ typedef int int32_t;
|
||||
*
|
||||
* The salting is a simple permutation applied to the 48-bit result of E.
|
||||
* Specifically, if bit i (1 <= i <= 24) of the salt is set then bits i and
|
||||
* i+24 of the result are swapped. The salt is thus a 24 bit number, with
|
||||
* i+24 of the result are swapped. The salt is thus a 24 bit number, with
|
||||
* 16777216 possible values. (The original salt was 12 bits and could not
|
||||
* swap bits 13..24 with 36..48.)
|
||||
*
|
||||
@@ -467,7 +467,7 @@ static C_block PC2ROT[2][64 / CHUNKBITS][1 << CHUNKBITS];
|
||||
/* Initial permutation/expansion table */
|
||||
static C_block IE3264[32 / CHUNKBITS][1 << CHUNKBITS];
|
||||
|
||||
/* Table that combines the S, P, and E operations. */
|
||||
/* Table that combines the S, P, and E operations. */
|
||||
static int32_t SPE[2][8][64];
|
||||
|
||||
/* compressed/interleaved => final permutation table */
|
||||
|
@@ -112,7 +112,7 @@ readdir(DIR *d)
|
||||
int
|
||||
closedir(DIR *d)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (d->handle != INVALID_HANDLE_VALUE)
|
||||
ret = !FindClose(d->handle);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* This file supplies pg_erand48(), pg_lrand48(), and pg_srand48(), which
|
||||
* are just like erand48(), lrand48(), and srand48() except that we use
|
||||
* our own implementation rather than the one provided by the operating
|
||||
* system. We used to test for an operating system version rather than
|
||||
* system. We used to test for an operating system version rather than
|
||||
* unconditionally using our own, but (1) some versions of Cygwin have a
|
||||
* buggy erand48() that always returns zero and (2) as of 2011, glibc's
|
||||
* erand48() is strangely coded to be almost-but-not-quite thread-safe,
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* src/port/fls.c
|
||||
*
|
||||
* This file was taken from FreeBSD to provide an implementation of fls()
|
||||
* for platforms that lack it. Note that the operating system's version may
|
||||
* for platforms that lack it. Note that the operating system's version may
|
||||
* be substantially more efficient than ours, since some platforms have an
|
||||
* assembly instruction that does exactly this.
|
||||
*
|
||||
@@ -36,7 +36,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Support getaddrinfo() on platforms that don't have it.
|
||||
*
|
||||
* We also supply getnameinfo() here, assuming that the platform will have
|
||||
* it if and only if it has getaddrinfo(). If this proves false on some
|
||||
* it if and only if it has getaddrinfo(). If this proves false on some
|
||||
* platform, we'll need to split this file and provide a separate configure
|
||||
* test for getnameinfo().
|
||||
*
|
||||
@@ -144,6 +144,7 @@ getaddrinfo(const char *node, const char *service,
|
||||
struct addrinfo hints;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* If Windows has native IPv6 support, use the native Windows routine.
|
||||
* Otherwise, fall through and use our own code.
|
||||
@@ -266,6 +267,7 @@ freeaddrinfo(struct addrinfo * res)
|
||||
if (res)
|
||||
{
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* If Windows has native IPv6 support, use the native Windows routine.
|
||||
* Otherwise, fall through and use our own code.
|
||||
@@ -357,6 +359,7 @@ getnameinfo(const struct sockaddr * sa, int salen,
|
||||
char *service, int servicelen, int flags)
|
||||
{
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* If Windows has native IPv6 support, use the native Windows routine.
|
||||
* Otherwise, fall through and use our own code.
|
||||
|
@@ -21,7 +21,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
|
@@ -22,7 +22,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* The function was been extracted whole from the file inet_aton.c in
|
||||
* Release 5.3.12 of the Linux C library, which is derived from the
|
||||
* GNU C library, by Bryan Henderson in October 1996. The copyright
|
||||
* GNU C library, by Bryan Henderson in October 1996. The copyright
|
||||
* notice from that file is below.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
|
@@ -42,7 +42,7 @@ pgkill(int pid, int sig)
|
||||
/* special case for SIGKILL: just ask the system to terminate the target */
|
||||
if (sig == SIGKILL)
|
||||
{
|
||||
HANDLE prochandle;
|
||||
HANDLE prochandle;
|
||||
|
||||
if ((prochandle = OpenProcess(PROCESS_TERMINATE, FALSE, (DWORD) pid)) == NULL)
|
||||
{
|
||||
|
@@ -53,7 +53,7 @@ static void trim_trailing_separator(char *path);
|
||||
/*
|
||||
* skip_drive
|
||||
*
|
||||
* On Windows, a path may begin with "C:" or "//network/". Advance over
|
||||
* On Windows, a path may begin with "C:" or "//network/". Advance over
|
||||
* this and point to the effective start of the path.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
@@ -226,6 +226,7 @@ canonicalize_path(char *path)
|
||||
int pending_strips;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* The Windows command processor will accept suitably quoted paths with
|
||||
* forward slashes, but barfs badly with mixed forward and back slashes.
|
||||
@@ -276,7 +277,7 @@ canonicalize_path(char *path)
|
||||
* Remove any trailing uses of "." and process ".." ourselves
|
||||
*
|
||||
* Note that "/../.." should reduce to just "/", while "../.." has to be
|
||||
* kept as-is. In the latter case we put back mistakenly trimmed ".."
|
||||
* kept as-is. In the latter case we put back mistakenly trimmed ".."
|
||||
* components below. Also note that we want a Windows drive spec to be
|
||||
* visible to trim_directory(), but it's not part of the logic that's
|
||||
* looking at the name components; hence distinction between path and
|
||||
@@ -375,6 +376,7 @@ path_is_relative_and_below_cwd(const char *path)
|
||||
else if (path_contains_parent_reference(path))
|
||||
return false;
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* On Win32, a drive letter _not_ followed by a slash, e.g. 'E:abc', is
|
||||
* relative to the cwd on that drive, or the drive's root directory if
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
|
@@ -19,14 +19,14 @@
|
||||
* Ultrix and SunOS provide BSD signal(2) semantics by default.
|
||||
*
|
||||
* SVID2 and POSIX signal(2) semantics differ from BSD signal(2)
|
||||
* semantics. We can use the POSIX sigaction(2) on systems that
|
||||
* semantics. We can use the POSIX sigaction(2) on systems that
|
||||
* allow us to request restartable signals (SA_RESTART).
|
||||
*
|
||||
* Some systems don't allow restartable signals at all unless we
|
||||
* link to a special BSD library.
|
||||
*
|
||||
* We devoutly hope that there aren't any Unix-oid systems that provide
|
||||
* neither POSIX signals nor BSD signals. The alternative is to do
|
||||
* neither POSIX signals nor BSD signals. The alternative is to do
|
||||
* signal-handler reinstallation, which doesn't work well at all.
|
||||
*
|
||||
* Windows, of course, is resolutely in a class by itself. In the backend,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
|
@@ -33,7 +33,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
|
@@ -18,7 +18,7 @@
|
||||
* 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
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
@@ -66,7 +66,7 @@
|
||||
* platforms. This implementation is compatible with the Single Unix Spec:
|
||||
*
|
||||
* 1. -1 is returned only if processing is abandoned due to an invalid
|
||||
* parameter, such as incorrect format string. (Although not required by
|
||||
* parameter, such as incorrect format string. (Although not required by
|
||||
* the spec, this happens only when no characters have yet been transmitted
|
||||
* to the destination.)
|
||||
*
|
||||
@@ -87,7 +87,7 @@
|
||||
* Original:
|
||||
* Patrick Powell Tue Apr 11 09:48:21 PDT 1995
|
||||
* A bombproof version of doprnt (dopr) included.
|
||||
* Sigh. This sort of thing is always nasty do deal with. Note that
|
||||
* Sigh. This sort of thing is always nasty do deal with. Note that
|
||||
* the version here does not include floating point. (now it does ... tgl)
|
||||
**************************************************************/
|
||||
|
||||
|
@@ -57,6 +57,7 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
|
||||
return NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* A Windows console has an "input code page" and an "output code page";
|
||||
* these usually match each other, but they rarely match the "Windows ANSI
|
||||
@@ -65,7 +66,7 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
|
||||
* automatically converts text between these code pages when writing to a
|
||||
* console. To identify such file descriptors, it calls GetConsoleMode()
|
||||
* on the underlying HANDLE, which in turn requires GENERIC_READ access on
|
||||
* the HANDLE. Opening termout in mode "w+" allows that detection to
|
||||
* the HANDLE. Opening termout in mode "w+" allows that detection to
|
||||
* succeed. Otherwise, write() would not recognize the descriptor as a
|
||||
* console, and non-ASCII characters would display incorrectly.
|
||||
*
|
||||
@@ -85,11 +86,12 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
|
||||
#endif
|
||||
if (!termin || !termout
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* Direct console I/O does not work from the MSYS 1.0.10 console. Writes
|
||||
* reach nowhere user-visible; reads block indefinitely. XXX This affects
|
||||
* most Windows terminal environments, including rxvt, mintty, Cygwin
|
||||
* xterm, Cygwin sshd, and PowerShell ISE. Switch to a more-generic test.
|
||||
* xterm, Cygwin sshd, and PowerShell ISE. Switch to a more-generic test.
|
||||
*/
|
||||
|| (getenv("OSTYPE") && strcmp(getenv("OSTYPE"), "msys") == 0)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||
* If retval >= siz, truncation occurred.
|
||||
*/
|
||||
|
@@ -36,8 +36,8 @@
|
||||
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
* Function creation history: http://www.gratisoft.us/todd/papers/strlcpy.html
|
||||
*/
|
||||
|
@@ -28,12 +28,12 @@
|
||||
* Additional confusion exists because many operating systems that
|
||||
* use pthread_setspecific/pthread_getspecific() also have *_r versions
|
||||
* of standard library functions for compatibility with operating systems
|
||||
* that require them. However, internally, these *_r functions merely
|
||||
* that require them. However, internally, these *_r functions merely
|
||||
* call the thread-safe standard library functions.
|
||||
*
|
||||
* For example, BSD/OS 4.3 uses Bind 8.2.3 for getpwuid(). Internally,
|
||||
* getpwuid() calls pthread_setspecific/pthread_getspecific() to return
|
||||
* static data to the caller in a thread-safe manner. However, BSD/OS
|
||||
* static data to the caller in a thread-safe manner. However, BSD/OS
|
||||
* also has getpwuid_r(), which merely calls getpwuid() and shifts
|
||||
* around the arguments to match the getpwuid_r() function declaration.
|
||||
* Therefore, while BSD/OS has getpwuid_r(), it isn't required. It also
|
||||
|
@@ -30,7 +30,7 @@ unsetenv(const char *name)
|
||||
* entry. When we clobber the entry in the second step we are ensuring
|
||||
* that we zap the actual environ member. However, there are some libc
|
||||
* implementations (notably recent BSDs) that do not obey SUS but copy the
|
||||
* presented string. This method fails on such platforms. Hopefully all
|
||||
* presented string. This method fails on such platforms. Hopefully all
|
||||
* such platforms have unsetenv() and thus won't be using this hack. See:
|
||||
* http://www.greenend.org.uk/rjk/2008/putenv.html
|
||||
*
|
||||
|
Reference in New Issue
Block a user