Mon Jan 22 10:40:40 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-960123
authorRoland McGrath <roland@gnu.org>
Tue, 23 Jan 1996 10:00:23 +0000 (10:00 +0000)
committerRoland McGrath <roland@gnu.org>
Tue, 23 Jan 1996 10:00:23 +0000 (10:00 +0000)
* sysdeps/posix/getcwd.c [__GNU_LIBRARY__]: Include unistd.h.

* io/fts.h (FTSENT): Define fts_compar member with prototype.

* hurd/hurd.h: Use prototype in getcttyid decl.

* stdlib/l64a.c: Fix typo in last change.

* stdlib/drand48-iter.c: Test limits.h macros instead of sizeof
for determining size of types.
* stdlib/srand48_r.c: Likewise.

* misc/utmp.h: Declare login, logout, logwtmp.
* misc/logout.c: Declare argument as pointer to const.
* misc/login.c: Likewise.
* misc/logwtmp.c: Likewise.
Include time.h, string.h.

* misc/efgcvt_r.c: Include stdlib.h.

* io/mknod.c: Include sys/types.h.

* gmon/sys/gmon.h: Declare monstartup, _mcleanup.

* csu/gmon-start.c (_start, etext): Declare with prototypes.

* stdio-common/vfscanf.c (%[): Fix range handling.

17 files changed:
ChangeLog
csu/gmon-start.c
gmon/sys/gmon.h
hurd/hurd.h
io/fts.h
io/mknod.c
misc/efgcvt_r.c
misc/login.c
misc/logout.c
misc/logwtmp.c
misc/utmp.h
stdio-common/vfscanf.c
stdlib/drand48-iter.c
stdlib/l64a.c
stdlib/srand48_r.c
sysdeps/posix/getcwd.c
sysdeps/unix/syscalls.list

index 761fb90..dcc409c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+Mon Jan 22 10:40:40 1996  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
+
+       * sysdeps/posix/getcwd.c [__GNU_LIBRARY__]: Include unistd.h.
+
+       * io/fts.h (FTSENT): Define fts_compar member with prototype.
+
+       * hurd/hurd.h: Use prototype in getcttyid decl.
+
+       * stdlib/l64a.c: Fix typo in last change.
+
+       * stdlib/drand48-iter.c: Test limits.h macros instead of sizeof
+       for determining size of types.
+       * stdlib/srand48_r.c: Likewise.
+
+       * misc/utmp.h: Declare login, logout, logwtmp.
+       * misc/logout.c: Declare argument as pointer to const.
+       * misc/login.c: Likewise.
+       * misc/logwtmp.c: Likewise.
+       Include time.h, string.h.
+
+       * misc/efgcvt_r.c: Include stdlib.h.
+
+       * io/mknod.c: Include sys/types.h.
+
+       * gmon/sys/gmon.h: Declare monstartup, _mcleanup.
+
+       * csu/gmon-start.c (_start, etext): Declare with prototypes.
+
+       * stdio-common/vfscanf.c (%[): Fix range handling.
+
 Sun Jan 21 00:55:25 1996  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
        * misc/Makefile (headers): Rename queue.h to sys/queue.h.
index 2ebbbf1..aaff084 100644 (file)
@@ -23,12 +23,7 @@ Cambridge, MA 02139, USA.  */
 #include <unistd.h>
 
 /* Beginning and end of our code segment.  */
-extern void _start (), etext ();
-
-/* These functions are defined in gmon/gmon.c;
-   they do all the work of setting up and cleaning up profiling.  */
-extern void monstartup (u_long, u_long);
-extern void _mcleanup (void);
+extern void _start (void), etext (void);
 
 #ifndef HAVE_INITFINI
 /* This function gets called at startup by the normal constructor
index 6a682d0..7064a43 100644 (file)
@@ -36,6 +36,7 @@
 #ifndef _SYS_GMON_H_
 #define _SYS_GMON_H_
 
+#include <sys/cdefs.h>
 #include <machine-gmon.h>
 
 /*
@@ -75,7 +76,7 @@ struct gmonhdr {
  *     calls   $0,(r0)
  *     calls   $0,(r0)
  *
- * which is separated by only three bytes, thus HASHFRACTION is 
+ * which is separated by only three bytes, thus HASHFRACTION is
  * calculated as:
  *
  *     HASHFRACTION = 3 / (2 * 2 - 1) = 1
@@ -83,9 +84,9 @@ struct gmonhdr {
  * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
  * is less than three, this algorithm will not work!
  *
- * In practice, however, call instructions are rarely at a minimal 
+ * In practice, however, call instructions are rarely at a minimal
  * distance.  Hence, we will define HASHFRACTION to be 2 across all
- * architectures.  This saves a reasonable amount of space for 
+ * architectures.  This saves a reasonable amount of space for
  * profiling data structures without (in practice) sacrificing
  * any granularity.
  */
@@ -106,7 +107,7 @@ struct tostruct {
 };
 
 /*
- * a raw arc, with pointers to the calling site and 
+ * a raw arc, with pointers to the calling site and
  * the called site and a count.
  */
 struct rawarc {
@@ -156,4 +157,15 @@ extern struct gmonparam _gmonparam;
 #define        GPROF_FROMS     2       /* struct: from location hash bucket */
 #define        GPROF_TOS       3       /* struct: destination/count structure */
 #define        GPROF_GMONPARAM 4       /* struct: profiling parameters (see above) */
+
+__BEGIN_DECLS
+
+/* Set up data structures and start profiling.  */
+void monstartup __P ((u_long lowpc, u_long highpc));
+
+/* Clean up profiling and write out gmon.out.  */
+void _mcleanup __P ((void));
+
+__END_DECLS
+
 #endif /* !_SYS_GMON_H_ */
index 17b5c45..55be157 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -146,7 +146,7 @@ extern error_t _hurd_ports_set (unsigned int which, mach_port_t newport);
 extern process_t getproc (void);
 extern file_t getcwdir (void), getcrdir (void);
 extern auth_t getauth (void);
-extern mach_port_t getcttyid ();
+extern mach_port_t getcttyid (void);
 extern int setproc (process_t);
 extern int setcwdir (file_t), setcrdir (file_t);
 extern int setcttyid (mach_port_t);
index 84dbe14..643a027 100644 (file)
--- a/io/fts.h
+++ b/io/fts.h
@@ -36,6 +36,8 @@
 #ifndef        _FTS_H_
 #define        _FTS_H_
 
+#include <sys/cdefs.h>
+
 typedef struct {
        struct _ftsent *fts_cur;        /* current node */
        struct _ftsent *fts_child;      /* linked list of children */
@@ -45,7 +47,7 @@ typedef struct {
        int fts_rfd;                    /* fd for root */
        int fts_pathlen;                /* sizeof(path) */
        int fts_nitems;                 /* elements in the sort array */
-       int (*fts_compar)();            /* compare function */
+       int (*fts_compar) __P((const void *, const void *)); /* compare fn */
 
 #define        FTS_COMFOLLOW   0x001           /* follow command line symlinks */
 #define        FTS_LOGICAL     0x002           /* logical walk */
@@ -111,8 +113,6 @@ typedef struct _ftsent {
        char fts_name[1];               /* file name */
 } FTSENT;
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
 FTSENT *fts_children __P((FTS *, int));
 int     fts_close __P((FTS *));
index b41582c..95ebe5a 100644 (file)
@@ -16,6 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
+#include <sys/types.h>
 #include <sys/stat.h>
 
 /* This definition is only used if inlining fails for this function; see
index 2da5e55..6bead57 100644 (file)
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include <string.h>
 #include <ctype.h>
 #include <math.h>
+#include <stdlib.h>
 
 int
 fcvt_r (value, ndigit, decpt, sign, buf, len)
index 911c289..5b71082 100644 (file)
@@ -45,7 +45,7 @@ static char sccsid[] = "@(#)login.c   8.1 (Berkeley) 6/4/93";
 
 void
 login(ut)
-       struct utmp *ut;
+       const struct utmp *ut;
 {
        register int fd;
        int tty;
index 11da24f..40ae254 100644 (file)
@@ -48,7 +48,7 @@ typedef struct utmp UTMP;
 
 int
 logout(line)
-       register char *line;
+       register const char *line;
 {
        register int fd;
        UTMP ut;
index 5b3c8de..7734ca9 100644 (file)
@@ -37,21 +37,20 @@ static char sccsid[] = "@(#)logwtmp.c       8.1 (Berkeley) 6/4/93";
 
 #include <sys/types.h>
 #include <sys/file.h>
-#include <sys/time.h>
 #include <sys/stat.h>
+#include <time.h>
+#include <string.h>
 
 #include <unistd.h>
 #include <utmp.h>
 
 void
 logwtmp(line, name, host)
-       char *line, *name, *host;
+     const char *line, *name, *host;
 {
        struct utmp ut;
        struct stat buf;
        int fd;
-       time_t time();
-       char *strncpy();
 
        if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0)
                return;
index 15c4e4f..cfd9438 100644 (file)
@@ -41,6 +41,8 @@
 #ifndef        _UTMP_H_
 #define        _UTMP_H_
 
+#include <sys/cdefs.h>
+
 #define        _PATH_UTMP      "/var/run/utmp"
 #define        _PATH_WTMP      "/var/log/wtmp"
 #define        _PATH_LASTLOG   "/var/log/lastlog"
@@ -49,6 +51,8 @@
 #define        UT_LINESIZE     8
 #define        UT_HOSTSIZE     16
 
+__BEGIN_DECLS
+
 struct lastlog {
        time_t  ll_time;
        char    ll_line[UT_LINESIZE];
@@ -62,4 +66,17 @@ struct utmp {
        long    ut_time;
 };
 
+
+/* Write the given entry into utmp and wtmp.  */
+extern void login __P ((const struct utmp *));
+
+/* Write the utmp entry to say the user on UT_LINE has logged out.  */
+extern int logout __P ((const char *ut_line));
+
+/* Append to wtmp an entry for the current time and the given info.  */
+extern void logwtmp __P ((const char *ut_line, const char *ut_name,
+                         const char *ut_host));
+
+__END_DECLS
+
 #endif /* !_UTMP_H_ */
index c7ea4bb..dd635c9 100644 (file)
@@ -724,13 +724,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 
          while ((fc = *f++) != '\0' && fc != ']')
            {
-             if (*f == '-' && f[1] != '\0' && f[1] != ']' && fc <= f[1])
+             if (fc == '-' && *f != '\0' && *f != ']' &&
+                 (unsigned char) f[-2] <= (unsigned char) *f)
                {
                  /* Add all characters from the one before the '-'
                     up to (but not including) the next format char.  */
-                 f++;
-                 while (fc < *f)
-                   wp[fc++] = 1;
+                 for (fc = f[-2]; fc < *f; ++fc)
+                   wp[fc] = 1;
                }
              else
                /* Add the character to the flag map.  */
index b98f402..967c404 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
 #include <stdlib.h>
+#include <limits.h>
 
 
 /* Global state for non-reentrent functions.  */
@@ -40,18 +41,15 @@ __drand48_iterate (xsubi, buffer)
   /* Initialize buffer, if not yet done.  */
   if (!buffer->init)
     {
-      if (sizeof (unsigned short int) == 2)
-       {
-         buffer->a[2] = 0x5;
-         buffer->a[1] = 0xdeec;
-         buffer->a[0] = 0xe66d;
-       }
-      else
-       {
-         buffer->a[2] = 0x5deecUL;
-         buffer->a[1] = 0xe66d0000UL;
-         buffer->a[0] = 0;
-       }
+#if (USHRT_MAX == 0xffffU)
+      buffer->a[2] = 0x5;
+      buffer->a[1] = 0xdeec;
+      buffer->a[0] = 0xe66d;
+#else
+      buffer->a[2] = 0x5deecUL;
+      buffer->a[1] = 0xe66d0000UL;
+      buffer->a[0] = 0;
+#endif
       buffer->c = 0xb;
       buffer->init = 1;
     }
index ac2cb64..914f0b5 100644 (file)
@@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA.  */
 #include <stdlib.h>
 
 /* Conversion table.  */
-static const char conv_tab[64] =
+static const char conv_table[64] =
 {
   '.', '/', '0', '1', '2', '3', '4', '5',
   '6', '7', '8', '9', 'A', 'B', 'C', 'D',
@@ -32,7 +32,7 @@ static const char conv_tab[64] =
   's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
 };
 
-const char *
+char *
 l64a (n)
      long n;
 {
index 8720854..44cee6d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -18,6 +18,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 #include <stdlib.h>
+#include <limits.h>
 
 int
 srand48_r (seedval, buffer)
@@ -28,18 +29,15 @@ srand48_r (seedval, buffer)
   if (sizeof (long) > 4)
     seedval &= 0xffffffffl;
 
-  if (sizeof (unsigned short int) == 2)
-    {
-      buffer->X[2] = seedval >> 16;
-      buffer->X[1] = seedval & 0xffffl;
-      buffer->X[0] = 0x330e;
-    }
-  else
-    {
-      buffer->X[2] = seedval;
-      buffer->X[1] = 0x330e0000UL;
-      buffer->X[0] = 0;
-    }
+#if (USHRT_MAX == 0xffffU)
+  buffer->X[2] = seedval >> 16;
+  buffer->X[1] = seedval & 0xffffl;
+  buffer->X[0] = 0x330e;
+#else
+  buffer->X[2] = seedval;
+  buffer->X[1] = 0x330e0000UL;
+  buffer->X[0] = 0;
+#endif
 
   return 0;
 }
index 11577eb..0724ef5 100644 (file)
@@ -80,7 +80,7 @@ extern int errno;
 #endif /* USG */
 #endif /* POSIX or DIRENT or __GNU_LIBRARY__ */
 
-#ifdef HAVE_UNISTD_H
+#if    defined (HAVE_UNISTD_H) || defined (__GNU_LIBRARY__)
 #include <unistd.h>
 #endif
 
index 2f5c524..7fba017 100644 (file)
@@ -8,7 +8,7 @@ chown           -       chown           3       __chown         chown
 chroot         -       chroot          1       chroot
 close          -       close           1       __close         close
 dup            -       dup             2       __dup           dup
-dup2           -       dup2            2       __dup2  dup2
+dup2           -       dup2            2       __dup2          dup2
 fchdir         -       fchdir          1       fchdir
 fcntl          -       fcntl           3       __fcntl         fcntl
 fsync          -       fsync           1       fsync
@@ -24,7 +24,7 @@ ioctl         -       ioctl           3       __ioctl         ioctl
 kill           -       kill            2       __kill          kill
 link           -       link            2       __link          link
 lseek          -       lseek           3       __lseek         lseek
-mkdir          -       mkdir           2       __mkdir mkdir
+mkdir          -       mkdir           2       __mkdir         mkdir
 open           -       open            3       __open          open
 profil         -       profil          4       profil
 ptrace         -       ptrace          4       ptrace