diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-09-18 17:59:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-09-18 17:59:03 +0000 |
commit | 00bc5db059212a20afb42da40b38d7f145a46dfd (patch) | |
tree | 090b419ffc6087f15fe9cba759f3055cb5d315ca | |
parent | 88263bc9ac99b5c99659173239a5a6e1bef25df6 (diff) | |
download | glibc-00bc5db059212a20afb42da40b38d7f145a46dfd.zip glibc-00bc5db059212a20afb42da40b38d7f145a46dfd.tar.gz glibc-00bc5db059212a20afb42da40b38d7f145a46dfd.tar.bz2 |
Update.
1998-09-18 17:41 Ulrich Drepper <drepper@cygnus.com>
* libio/fileops.c (_IO_new_file_underflow): Before allocating
buffer make sure the pushback buffer is destroyed.
(_IO_new_file_seekoff): Likewise.
If mode==0 quit early with the result.
Clear OEF flag after successful fseek.
* libio/libio.h (_IO_FILE_complete): Add _IO_save_ptr.
* libio/ftello.c (ftello): Add offset from original buffer if
stream has pushed back characters.
* libio/ftello64.c (ftello64): Likewise.
* libio/iofgetpos.c (_IO_fgetpos): Likewise.
* libio/iofgetpos64.c (_IO_fgetpos64): Likewise.
* libio/ioftell.c (_IO_ftell): Likewise.
* libio/genops.c (_IO_switch_to_main_get_area): Swap _IO_read_ptr
and _IO_save_ptr.
(_IO_switch_to_backup_area): Save _IO_read_ptr in _IO_save_ptr.
(_IO_default_pbackfail): Only stored push back character in original
buffer if it is the same as the one in the file at this position.
* libio/iofclose.c: Free backup buffer if one is available.
* libio/ioseekoff.c (_IO_seekoff): Only remove pushback buffer if
mode!=0.
* strdlib/strtol.c (strtol): Handle 0x... string for base!=0 correctly.
* time/strftime.c [_LIBC] (ampm): Use tp->tm_hour not hour12.
1998-09-18 Mark Kettenis <kettenis@phys.uva.nl>
* login/programs/pt_chown.c (more_help): Correct message that
describes the purpose of the program.
* login/openpty.c: Do not include pty-private.h.
(pts_name): New function. Return name of slave pseudo terminal in
an allocated buffer if necessary.
(openpty): Use pts_name to get name of the slave end of the pseudo
terminal pair.
* sysdeps/unix/grantpt.c (grantpt): Free buffer allocated by
pts_name before return.
1998-09-18 11:15 Ulrich Drepper <drepper@cygnus.com>
* math/math.h: Define __NO_MATH_INLINES if __STRICT_ANSI__.
-rw-r--r-- | ChangeLog | 45 | ||||
-rw-r--r-- | libio/fileops.c | 30 | ||||
-rw-r--r-- | libio/ftello.c | 2 | ||||
-rw-r--r-- | libio/ftello64.c | 2 | ||||
-rw-r--r-- | libio/genops.c | 21 | ||||
-rw-r--r-- | libio/iofclose.c | 2 | ||||
-rw-r--r-- | libio/iofgetpos.c | 2 | ||||
-rw-r--r-- | libio/iofgetpos64.c | 2 | ||||
-rw-r--r-- | libio/ioftell.c | 2 | ||||
-rw-r--r-- | libio/ioseekoff.c | 3 | ||||
-rw-r--r-- | libio/libio.h | 4 | ||||
-rw-r--r-- | login/openpty.c | 129 | ||||
-rw-r--r-- | login/programs/pt_chown.c | 13 | ||||
-rw-r--r-- | math/math.h | 7 | ||||
-rw-r--r-- | stdlib/strtol.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/grantpt.c | 34 | ||||
-rw-r--r-- | time/strftime.c | 5 |
17 files changed, 237 insertions, 68 deletions
@@ -1,3 +1,48 @@ +1998-09-18 17:41 Ulrich Drepper <drepper@cygnus.com> + + * libio/fileops.c (_IO_new_file_underflow): Before allocating + buffer make sure the pushback buffer is destroyed. + (_IO_new_file_seekoff): Likewise. + If mode==0 quit early with the result. + Clear OEF flag after successful fseek. + * libio/libio.h (_IO_FILE_complete): Add _IO_save_ptr. + * libio/ftello.c (ftello): Add offset from original buffer if + stream has pushed back characters. + * libio/ftello64.c (ftello64): Likewise. + * libio/iofgetpos.c (_IO_fgetpos): Likewise. + * libio/iofgetpos64.c (_IO_fgetpos64): Likewise. + * libio/ioftell.c (_IO_ftell): Likewise. + * libio/genops.c (_IO_switch_to_main_get_area): Swap _IO_read_ptr + and _IO_save_ptr. + (_IO_switch_to_backup_area): Save _IO_read_ptr in _IO_save_ptr. + (_IO_default_pbackfail): Only stored push back character in original + buffer if it is the same as the one in the file at this position. + * libio/iofclose.c: Free backup buffer if one is available. + * libio/ioseekoff.c (_IO_seekoff): Only remove pushback buffer if + mode!=0. + + * strdlib/strtol.c (strtol): Handle 0x... string for base!=0 correctly. + + * time/strftime.c [_LIBC] (ampm): Use tp->tm_hour not hour12. + +1998-09-18 Mark Kettenis <kettenis@phys.uva.nl> + + * login/programs/pt_chown.c (more_help): Correct message that + describes the purpose of the program. + + * login/openpty.c: Do not include pty-private.h. + (pts_name): New function. Return name of slave pseudo terminal in + an allocated buffer if necessary. + (openpty): Use pts_name to get name of the slave end of the pseudo + terminal pair. + + * sysdeps/unix/grantpt.c (grantpt): Free buffer allocated by + pts_name before return. + +1998-09-18 11:15 Ulrich Drepper <drepper@cygnus.com> + + * math/math.h: Define __NO_MATH_INLINES if __STRICT_ANSI__. + 1998-09-18 Andreas Jaeger <aj@arthur.rhein-neckar.de> * login/openpty.c: Include pty-private.h instead of diff --git a/libio/fileops.c b/libio/fileops.c index a2017f2..be65d42 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -34,6 +34,9 @@ #include <sys/stat.h> #include <string.h> #include <errno.h> +#ifdef __STDC__ +#include <stdlib.h> +#endif #ifndef errno extern int errno; #endif @@ -341,7 +344,15 @@ _IO_new_file_underflow (fp) return *(unsigned char *) fp->_IO_read_ptr; if (fp->_IO_buf_base == NULL) - _IO_doallocbuf (fp); + { + /* Maybe we already have a push back pointer. */ + if (fp->_IO_save_base != NULL) + { + free (fp->_IO_save_base); + fp->_flags &= ~_IO_IN_BACKUP; + } + _IO_doallocbuf (fp); + } /* Flush all line buffered files before reading. */ /* FIXME This can/should be moved to genops ?? */ @@ -493,6 +504,12 @@ _IO_new_file_seekoff (fp, offset, dir, mode) if (fp->_IO_buf_base == NULL) { + /* It could be that we already have a pushback buffer. */ + if (fp->_IO_read_base != NULL) + { + free (fp->_IO_read_base); + fp->_flags &= ~_IO_IN_BACKUP; + } _IO_doallocbuf (fp); _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); @@ -526,6 +543,10 @@ _IO_new_file_seekoff (fp, offset, dir, mode) } /* At this point, dir==_IO_seek_set. */ + /* If we are only interested in the current position we've found it now. */ + if (mode == 0) + return offset; + /* If destination is within current buffer, optimize: */ if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL && !_IO_in_backup (fp)) @@ -544,7 +565,10 @@ _IO_new_file_seekoff (fp, offset, dir, mode) _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset, fp->_IO_read_end); _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); - return offset; + { + _IO_mask_flags (fp, 0, _IO_EOF_SEEN); + return offset; + } } #ifdef TODO /* If we have streammarkers, seek forward by reading ahead. */ @@ -554,6 +578,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode) - (fp->_IO_read_ptr - fp->_IO_read_base); if (ignore (to_skip) != to_skip) goto dumb; + _IO_mask_flags (fp, 0, _IO_EOF_SEEN); return offset; } #endif @@ -564,6 +589,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode) if (!_IO_in_backup (fp)) _IO_switch_to_backup_area (fp); gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr); + _IO_mask_flags (fp, 0, _IO_EOF_SEEN); return offset; } #endif diff --git a/libio/ftello.c b/libio/ftello.c index 662b954..2d8a8a7 100644 --- a/libio/ftello.c +++ b/libio/ftello.c @@ -37,6 +37,8 @@ ftello (fp) _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); + if (_IO_in_backup (fp)) + pos -= fp->_IO_save_end - fp->_IO_save_base; _IO_funlockfile (fp); _IO_cleanup_region_end (0); if (pos == _IO_pos_BAD) diff --git a/libio/ftello64.c b/libio/ftello64.c index 96eeb18..6214549 100644 --- a/libio/ftello64.c +++ b/libio/ftello64.c @@ -38,6 +38,8 @@ ftello64 (fp) _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); + if (_IO_in_backup (fp)) + pos -= fp->_IO_save_end - fp->_IO_save_base; _IO_funlockfile (fp); _IO_cleanup_region_end (0); if (pos == _IO_pos_BAD) diff --git a/libio/genops.c b/libio/genops.c index 4286eef..2dce95f 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -94,8 +94,10 @@ _IO_switch_to_main_get_area (fp) tmp = fp->_IO_read_base; fp->_IO_read_base = fp->_IO_save_base; fp->_IO_save_base = tmp; - - fp->_IO_read_ptr = fp->_IO_read_base; + /* Swap _IO_read_base and _IO_save_ptr. */ + tmp = fp->_IO_read_ptr; + fp->_IO_read_ptr = fp->_IO_save_ptr; + fp->_IO_save_ptr = tmp; } /* Switch current get area from main get area to (end of) backup area. */ @@ -114,7 +116,8 @@ _IO_switch_to_backup_area (fp) tmp = fp->_IO_read_base; fp->_IO_read_base = fp->_IO_save_base; fp->_IO_save_base = tmp; - + /* read _IO_read_ptr. */ + fp->_IO_save_ptr = fp->_IO_read_ptr; fp->_IO_read_ptr = fp->_IO_read_end; } @@ -868,7 +871,10 @@ _IO_default_pbackfail (fp, c) _IO_FILE *fp; int c; { - if (fp->_IO_read_ptr <= fp->_IO_read_base) + if (fp->_IO_read_ptr > fp->_IO_read_base && !_IO_in_backup (fp) + && fp->_IO_read_ptr[-1] == c) + --fp->_IO_read_ptr; + else { /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/ if (_IO_have_backup (fp) && !_IO_in_backup (fp)) @@ -904,11 +910,10 @@ _IO_default_pbackfail (fp, c) new_buf + new_size); fp->_IO_backup_base = fp->_IO_read_ptr; } + + *--fp->_IO_read_ptr = c; } - --fp->_IO_read_ptr; - if (c != EOF && *fp->_IO_read_ptr != c) - *fp->_IO_read_ptr = c; - return (unsigned char) *fp->_IO_read_ptr; + return (unsigned char) c; } _IO_fpos64_t diff --git a/libio/iofclose.c b/libio/iofclose.c index f896e09..61f7800 100644 --- a/libio/iofclose.c +++ b/libio/iofclose.c @@ -45,6 +45,8 @@ _IO_new_fclose (fp) _IO_FINISH (fp); _IO_funlockfile (fp); _IO_cleanup_region_end (0); + if (_IO_have_backup (fp)) + _IO_free_backup_area (fp); if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr) { fp->_IO_file_flags = 0; diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c index 5fed6c3..27f018d 100644 --- a/libio/iofgetpos.c +++ b/libio/iofgetpos.c @@ -36,6 +36,8 @@ _IO_fgetpos (fp, posp) _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); + if (_IO_in_backup (fp)) + pos -= fp->_IO_save_end - fp->_IO_save_base; _IO_funlockfile (fp); _IO_cleanup_region_end (0); if (pos == _IO_pos_BAD) diff --git a/libio/iofgetpos64.c b/libio/iofgetpos64.c index 8a7733b..a705e9e 100644 --- a/libio/iofgetpos64.c +++ b/libio/iofgetpos64.c @@ -37,6 +37,8 @@ _IO_fgetpos64 (fp, posp) _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); + if (_IO_in_backup (fp)) + pos -= fp->_IO_save_end - fp->_IO_save_base; _IO_funlockfile (fp); _IO_cleanup_region_end (0); if (pos == _IO_pos_BAD) diff --git a/libio/ioftell.c b/libio/ioftell.c index 3a0e7a6..3de1ee9 100644 --- a/libio/ioftell.c +++ b/libio/ioftell.c @@ -36,6 +36,8 @@ _IO_ftell (fp) _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); + if (_IO_in_backup (fp)) + pos -= fp->_IO_save_end - fp->_IO_save_base; _IO_funlockfile (fp); _IO_cleanup_region_end (0); if (pos == _IO_pos_BAD) diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c index b83e1ad..54a8d19 100644 --- a/libio/ioseekoff.c +++ b/libio/ioseekoff.c @@ -41,12 +41,13 @@ _IO_seekoff (fp, offset, dir, mode) _IO_flockfile (fp); - if (_IO_have_backup (fp)) + if (mode != 0 && _IO_have_backup (fp)) { if (dir == _IO_seek_cur && _IO_in_backup (fp)) offset -= fp->_IO_read_end - fp->_IO_read_ptr; _IO_free_backup_area (fp); } + retval = _IO_SEEKOFF (fp, offset, dir, mode); _IO_funlockfile (fp); diff --git a/libio/libio.h b/libio/libio.h index a060b42..7b2f70c 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -229,7 +229,9 @@ struct _IO_FILE_complete #endif #if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001 _IO_off64_t _offset; - int _unused2[16]; /* Make sure we don't get into trouble again. */ + char *_IO_save_ptr; + /* Make sure we don't get into trouble again. */ + char _unused2[16 * sizeof (int) - sizeof (char *)]; #endif }; diff --git a/login/openpty.c b/login/openpty.c index 396ca09..630061d 100644 --- a/login/openpty.c +++ b/login/openpty.c @@ -17,7 +17,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <errno.h> #include <fcntl.h> +#include <limits.h> #include <pty.h> #include <stdlib.h> #include <string.h> @@ -25,49 +27,112 @@ #include <unistd.h> #include <sys/types.h> -#include "pty-private.h" +/* Return the result of ptsname_r in the buffer pointed to by PTS, + which should be of length BUF_LEN. If it is too long to fit in + this buffer, a sufficiently long buffer is allocated using malloc, + and returned in PTS. 0 is returned upon success, -1 otherwise. */ +static int +pts_name (int fd, char **pts, size_t buf_len) +{ + int rv; + char *buf = *pts; + + for (;;) + { + char *new_buf; + + if (buf_len) + { + rv = ptsname_r (fd, buf, buf_len); + + if (rv != 0 || memchr (buf, '\0', buf_len)) + /* We either got an error, or we succeeded and the + returned name fit in the buffer. */ + break; + + /* Try again with a longer buffer. */ + buf_len += buf_len; /* Double it */ + } + else + /* No initial buffer; start out by mallocing one. */ + buf_len = 128; /* First time guess. */ + + if (buf != *pts) + /* We've already malloced another buffer at least once. */ + new_buf = realloc (buf, buf_len); + else + new_buf = malloc (buf_len); + if (! new_buf) + { + rv = -1; + __set_errno (ENOMEM); + break; + } + buf = new_buf; + } + + if (rv == 0) + *pts = buf; /* Return buffer to the user. */ + else if (buf != *pts) + free (buf); /* Free what we malloced when returning an error. */ + + return rv; +} + +/* Create pseudo tty master slave pair and set terminal attributes + according to TERMP and WINP. Return handles for both ends in + AMASTER and ASLAVE, and return the name of the slave end in NAME. */ int -openpty (pmast, pslave, pname, tio, wins) - int *pmast; - int *pslave; - char *pname; - struct termios *tio; - struct winsize *wins; +openpty (int *amaster, int *aslave, char *name, struct termios *termp, + struct winsize *winp) { - int pfd, tfd; - char name[PTYNAMELEN]; +#ifdef PATH_MAX + char _buf[PATH_MAX]; +#else + char _buf[512]; +#endif + char *buf = _buf; + int master, slave; - pfd = getpt (); - if (pfd == -1) + master = getpt (); + if (master == -1) return -1; - if (grantpt (pfd)) - goto bail; + if (grantpt (master)) + goto fail; + + if (unlockpt (master)) + goto fail; - if (unlockpt (pfd)) - goto bail; + if (pts_name (master, &buf, sizeof (_buf))) + goto fail; - if (ptsname_r (pfd, name, PTYNAMELEN) != 0) - goto bail; + slave = open (buf, O_RDWR); + if (slave == -1) + { + if (buf != _buf) + free (buf); - tfd = open (name, O_RDWR); - if (tfd == -1) - goto bail; + goto fail; + } /* XXX Should we ignore errors here? */ - if(tio) - tcsetattr (tfd, TCSAFLUSH, tio); - if (wins) - ioctl (tfd, TIOCSWINSZ, wins); - - *pmast = pfd; - *pslave = tfd; - if (pname != NULL) - strcpy (pname, name); - return 0; + if(termp) + tcsetattr (slave, TCSAFLUSH, termp); + if (winp) + ioctl (slave, TIOCSWINSZ, winp); + + *amaster = master; + *aslave = slave; + if (name != NULL) + strcpy (name, buf); -bail: - close (pfd); + if (buf != _buf) + free (buf); + return 0; + + fail: + close (master); return -1; } diff --git a/login/programs/pt_chown.c b/login/programs/pt_chown.c index 6ed8e82..e7cc675 100644 --- a/login/programs/pt_chown.c +++ b/login/programs/pt_chown.c @@ -67,15 +67,16 @@ static char * more_help (int key, const char *text, void *input) { char *cp; - + switch (key) { case ARGP_KEY_HELP_PRE_DOC: asprintf (&cp, gettext ("\ -Set the owner, group and access permission of the terminal passed on\ - file descriptor `%d'. This is the helper program for the `grantpt'\ - function. It is not intended to be run directly from the command\ - line.\n"), +Set the owner, group and access permission of the slave pseudo\ + terminal corresponding to the master pseudo terminal passed on\ + file descriptor `%d'. This is the helper program for the\ + `grantpt' function. It is not intended to be run directly from\ + the command line.\n"), PTY_FILENO); return cp; case ARGP_KEY_HELP_EXTRA: @@ -119,7 +120,7 @@ main (int argc, char *argv[]) program_invocation_short_name); exit (EXIT_FAILURE); } - + /* Check if we are properly installed. */ if (geteuid () != 0) error (FAIL_EXEC, 0, gettext ("needs to be installed setuid `root'")); diff --git a/math/math.h b/math/math.h index d7487dd..2a5f8d3 100644 --- a/math/math.h +++ b/math/math.h @@ -312,6 +312,13 @@ extern int matherr __P ((struct exception *__exc)); #endif +/* When compiling in strict ISO C compatible mode we must not use the + inline functions since they, among other things, do not set the + `errno' variable correctly. */ +#if defined __STRICT_ANSI__ && !defined __NO_MATH_INLINES +# define __NO_MATH_INLINES 1 +#endif + /* Get machine-dependent inline versions (if there are any). */ #ifdef __USE_EXTERN_INLINES # include <bits/mathinline.h> diff --git a/stdlib/strtol.c b/stdlib/strtol.c index 93df6ab..96157ef 100644 --- a/stdlib/strtol.c +++ b/stdlib/strtol.c @@ -306,7 +306,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ if (*s == L_('0')) { - if (TOUPPER (s[1]) == L_('X')) + if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X')) { s += 2; base = 16; diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c index d216baa..76bda07 100644 --- a/sysdeps/unix/grantpt.c +++ b/sysdeps/unix/grantpt.c @@ -90,6 +90,7 @@ pts_name (int fd, char **pts, size_t buf_len) int grantpt (int fd) { + int retval = -1; #ifdef PATH_MAX char _buf[PATH_MAX]; #else @@ -107,9 +108,9 @@ grantpt (int fd) if (pts_name (fd, &buf, sizeof (_buf))) return -1; - + if (__stat (buf, &st) < 0) - return -1; + goto cleanup; /* Make sure that we own the device. */ uid = __getuid (); @@ -143,14 +144,15 @@ grantpt (int fd) goto helper; } - return 0; + retval = 0; + goto cleanup; /* We have to use the helper program. */ helper: pid = __fork (); if (pid == -1) - return -1; + goto cleanup; else if (pid == 0) { /* Disable core dumps. */ @@ -168,36 +170,38 @@ grantpt (int fd) else { int w; - + if (__waitpid (pid, &w, 0) == -1) - return -1; + goto cleanup; if (!WIFEXITED (w)) - { - __set_errno (ENOEXEC); - return -1; - } + __set_errno (ENOEXEC); else switch (WEXITSTATUS(w)) { case 0: + retval = 0; break; case FAIL_EBADF: __set_errno (EBADF); - return -1; + break; case FAIL_EINVAL: __set_errno (EINVAL); - return -1; + break; case FAIL_EACCES: __set_errno (EACCES); - return -1; + break; case FAIL_EXEC: __set_errno (ENOEXEC); - return -1; + break; default: assert(! "getpt: internal error: invalid exit code from pt_chown"); } } - return 0; + cleanup: + if (buf != _buf) + free (buf); + + return retval; } diff --git a/time/strftime.c b/time/strftime.c index 594cbbf..0a830b0 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -427,7 +427,7 @@ my_strftime (s, maxsize, format, tp) # define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday) # define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon) # define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon) -# define ampm _NL_CURRENT (LC_TIME, hour12 > 11 ? PM_STR : AM_STR) +# define ampm _NL_CURRENT (LC_TIME, tp->tm_hour > 11 ? PM_STR : AM_STR) # define aw_len strlen (a_wkday) # define am_len strlen (a_month) @@ -475,7 +475,8 @@ my_strftime (s, maxsize, format, tp) if (hour12 > 12) hour12 -= 12; else - if (hour12 == 0) hour12 = 12; + if (hour12 == 0) + hour12 = 12; for (f = format; *f != '\0'; ++f) { |