Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/am-utils Re-integrate most changes done to amd in its o...



details:   https://anonhg.NetBSD.org/src/rev/ccdaa03e56c0
branches:  trunk
changeset: 499440:ccdaa03e56c0
user:      wiz <wiz%NetBSD.org@localhost>
date:      Mon Nov 20 03:19:33 2000 +0000

description:
Re-integrate most changes done to amd in its old location (mostly
FORMAT_AUDIT related, and nits). (Thanks for the reminder, Jason!)

diffstat:

 dist/am-utils/amd/amd.c             |   4 ++--
 dist/am-utils/amd/opts.c            |   4 ++--
 dist/am-utils/amd/sched.c           |   4 ++--
 dist/am-utils/doc/am-utils.texi     |   4 ++--
 dist/am-utils/fixmount/fixmount.8   |   4 ++--
 dist/am-utils/hlfsd/hlfsd.c         |   4 ++--
 dist/am-utils/include/am_utils.h    |   6 +++---
 dist/am-utils/libamu/mount_fs.c     |  10 +++-------
 dist/am-utils/libamu/xutil.c        |  29 +++++++++++++++++------------
 dist/am-utils/wire-test/wire-test.8 |   4 ++--
 10 files changed, 37 insertions(+), 36 deletions(-)

diffs (261 lines):

diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/amd/amd.c
--- a/dist/am-utils/amd/amd.c   Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/amd/amd.c   Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amd.c,v 1.1.1.2 2000/11/19 23:43:33 wiz Exp $  */
+/*     $NetBSD: amd.c,v 1.2 2000/11/20 03:19:33 wiz Exp $      */
 
 /*
  * Copyright (c) 1997-2000 Erez Zadok
@@ -478,7 +478,7 @@
   verstr = strtok(get_version_string(), "\n");
   plog(XLOG_INFO, "AM-UTILS VERSION INFORMATION:");
   while (verstr) {
-    plog(XLOG_INFO, verstr);
+    plog(XLOG_INFO, "%s", verstr);
     verstr = strtok(NULL, "\n");
   }
 
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/amd/opts.c
--- a/dist/am-utils/amd/opts.c  Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/amd/opts.c  Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: opts.c,v 1.1.1.2 2000/11/19 23:43:41 wiz Exp $ */
+/*     $NetBSD: opts.c,v 1.2 2000/11/20 03:19:34 wiz Exp $     */
 
 /*
  * Copyright (c) 1997-2000 Erez Zadok
@@ -872,7 +872,7 @@
 static void
 expand_op(opt_apply *p, int sel_p)
 {
-  static char expand_error[] = "No space to expand \"%s\"";
+  static const char expand_error[] = "No space to expand \"%s\"";
   char expbuf[MAXPATHLEN + 1];
   char nbuf[NLEN + 1];
   char *ep = expbuf;
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/amd/sched.c
--- a/dist/am-utils/amd/sched.c Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/amd/sched.c Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sched.c,v 1.1.1.2 2000/11/19 23:43:42 wiz Exp $        */
+/*     $NetBSD: sched.c,v 1.2 2000/11/20 03:19:34 wiz Exp $    */
 
 /*
  * Copyright (c) 1997-2000 Erez Zadok
@@ -221,7 +221,7 @@
   /*
    * Keep taking the first item off the list and processing it.
    *
-   * Done this way because the the callback can, quite reasonably,
+   * Done this way because the callback can, quite reasonably,
    * queue a new task, so no local reference into the list can be
    * held here.
    */
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/doc/am-utils.texi
--- a/dist/am-utils/doc/am-utils.texi   Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/doc/am-utils.texi   Mon Nov 20 03:19:33 2000 +0000
@@ -1,5 +1,5 @@
 \input texinfo          @c -*-texinfo-*-
-@c $NetBSD: am-utils.texi,v 1.1.1.2 2000/11/19 23:44:05 wiz Exp $
+@c $NetBSD: am-utils.texi,v 1.2 2000/11/20 03:19:34 wiz Exp $
 @c
 @c Copyright (c) 1997-2000 Erez Zadok
 @c Copyright (c) 1989 Jan-Simon Pendry
@@ -1298,7 +1298,7 @@
 used as a name qualifier and is prepended with the key being located.
 The entire string is then resolved in the @code{automount} context, or
 the @i{amd.conf} parameter @samp{hesiod_base} (@pxref{hesiod_base
-Parameter}).  For example, if the the key is @samp{jsp} and map name is
+Parameter}).  For example, if the key is @samp{jsp} and map name is
 @samp{hesiod.homes} then @dfn{Hesiod} is asked to resolve
 @samp{jsp.homes.automount}.
 
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/fixmount/fixmount.8
--- a/dist/am-utils/fixmount/fixmount.8 Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/fixmount/fixmount.8 Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: fixmount.8,v 1.1.1.2 2000/11/19 23:44:29 wiz Exp $
+.\"    $NetBSD: fixmount.8,v 1.2 2000/11/20 03:19:35 wiz Exp $
 .\"
 .\"
 .\" Copyright (c) 1997-2000 Erez Zadok
@@ -42,7 +42,7 @@
 .\"
 .\" Id: fixmount.8,v 1.3 2000/02/11 02:09:48 ezk Exp
 .\"
-.TH FIXMOUNT 8L "26 Feb 1993"
+.TH FIXMOUNT 8 "26 Feb 1993"
 .SH NAME
 fixmount \- fix remote mount entries
 .SH SYNOPSIS
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/hlfsd/hlfsd.c
--- a/dist/am-utils/hlfsd/hlfsd.c       Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/hlfsd/hlfsd.c       Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hlfsd.c,v 1.1.1.2 2000/11/19 23:43:50 wiz Exp $        */
+/*     $NetBSD: hlfsd.c,v 1.2 2000/11/20 03:19:35 wiz Exp $    */
 
 /*
  * Copyright (c) 1997-2000 Erez Zadok
@@ -949,7 +949,7 @@
                am_get_progname(), lessmess, errno);
     }
   }
-  plog(XLOG_FATAL, mess);
+  plog(XLOG_FATAL, "%s", mess);
 
   hlfsd_going_down(1);
 }
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/include/am_utils.h
--- a/dist/am-utils/include/am_utils.h  Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/include/am_utils.h  Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am_utils.h,v 1.1.1.2 2000/11/19 23:42:59 wiz Exp $     */
+/*     $NetBSD: am_utils.h,v 1.2 2000/11/20 03:19:35 wiz Exp $ */
 
 /*
  * Copyright (c) 1997-2000 Erez Zadok
@@ -646,7 +646,7 @@
 extern void normalize_slash(char *);
 extern void ops_showamfstypes(char *buf);
 extern void ops_showfstypes(char *outbuf);
-extern void plog(int, char *,...)
+extern void plog(int, const char *,...)
      __attribute__ ((__format__ (__printf__, 2, 3)));
 extern void rem_que(qelem *);
 extern void reschedule_timeout_mp(void);
@@ -971,7 +971,7 @@
 extern int debug_flags;                /* Debug options */
 extern int debug_option (char *opt);
 extern struct opt_tab dbg_opt[];
-extern void dplog(char *fmt, ...)
+extern void dplog(const char *fmt, ...)
      __attribute__ ((__format__ (__printf__, 1, 2)));
 
 /**************************************************************************/
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/libamu/mount_fs.c
--- a/dist/am-utils/libamu/mount_fs.c   Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/libamu/mount_fs.c   Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount_fs.c,v 1.1.1.2 2000/11/19 23:43:21 wiz Exp $     */
+/*     $NetBSD: mount_fs.c,v 1.2 2000/11/20 03:19:35 wiz Exp $ */
 
 /*
  * Copyright (c) 1997-2000 Erez Zadok
@@ -179,14 +179,10 @@
   char optsbuf[48];
 # endif /* defined(MNTTAB_OPT_DEV) || (defined(HAVE_FS_NFS3) && defined(MNTTAB_OPT_VERS)) || defined(MNTTAB_OPT_PROTO) */
 #endif /* MOUNT_TABLE_ON_FILE */
-#ifdef DEBUG
-  char buf[80];                        /* buffer for sprintf */
-#endif /* DEBUG */
 
 #ifdef DEBUG
-  sprintf(buf, "%s%s%s",
-         "%s fstype ", MTYPE_PRINTF_TYPE, " (%s) flags %#x (%s)");
-  dlog(buf, mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts);
+  dlog("%s fstype " MTYPE_PRINTF_TYPE " (%s) flags %#x (%s)",
+       mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts);
 #endif /* DEBUG */
 
 again:
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/libamu/xutil.c
--- a/dist/am-utils/libamu/xutil.c      Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/libamu/xutil.c      Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xutil.c,v 1.1.1.2 2000/11/19 23:43:24 wiz Exp $        */
+/*     $NetBSD: xutil.c,v 1.2 2000/11/20 03:19:36 wiz Exp $    */
 
 /*
  * Copyright (c) 1997-2000 Erez Zadok
@@ -82,7 +82,8 @@
 #endif /* DEBUG_MEM */
 
 /* forward definitions */
-static void real_plog(int lvl, char *fmt, va_list vargs);
+static void real_plog(int lvl, const char *fmt, va_list vargs)
+     __attribute__((__format__(__printf__, 2, 0)));
 
 #ifdef DEBUG
 /*
@@ -288,10 +289,13 @@
  * 'e' never gets longer than maxlen characters.
  */
 static void
-expand_error(char *f, char *e, int maxlen)
+expand_error(const char *f, char *e, int maxlen)
 {
+#ifndef HAVE_STRERROR
   extern int sys_nerr;
-  char *p, *q;
+#endif
+  const char *p;
+  char *q;
   int error = errno;
   int len = 0;
 
@@ -404,7 +408,7 @@
 
 
 void
-dplog(char *fmt, ...)
+dplog(const char *fmt, ...)
 {
   va_list ap;
 
@@ -419,7 +423,7 @@
 
 
 void
-plog(int lvl, char *fmt, ...)
+plog(int lvl, const char *fmt, ...)
 {
   va_list ap;
 
@@ -433,7 +437,7 @@
 
 
 static void
-real_plog(int lvl, char *fmt, va_list vargs)
+real_plog(int lvl, const char *fmt, va_list vargs)
 {
   char msg[1024];
   char efmt[1024];
@@ -454,12 +458,13 @@
   vsnprintf(ptr, 1024, efmt, vargs);
 #else /* not HAVE_VSNPRINTF */
   /*
-   * XXX: ptr is 1024 bytes long.  It is possible to write into it
-   * more than 1024 bytes, if efmt is already large, and vargs expand
-   * as well.  This is not as safe as using vsnprintf().
+   * XXX: ptr is 1024 bytes long, but we may write to ptr[strlen(ptr) + 2]
+   * (to add an '\n', see code below) so we have to limit the string copy
+   * to 1023 (including the '\0').
    */
-  vsprintf(ptr, efmt, vargs);
-  msg[1023] = '\0';            /* null terminate, to be sure */
+  fmt = efmt;
+  vsnprintf(ptr, 1023, fmt, vargs);
+  msg[1022] = '\0';            /* null terminate, to be sure */
 #endif /* not HAVE_VSNPRINTF */
 
   ptr += strlen(ptr);
diff -r a9046a4dac54 -r ccdaa03e56c0 dist/am-utils/wire-test/wire-test.8
--- a/dist/am-utils/wire-test/wire-test.8       Mon Nov 20 03:15:15 2000 +0000
+++ b/dist/am-utils/wire-test/wire-test.8       Mon Nov 20 03:19:33 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: wire-test.8,v 1.1.1.2 2000/11/19 23:44:33 wiz Exp $
+.\"    $NetBSD: wire-test.8,v 1.2 2000/11/20 03:19:36 wiz Exp $
 .\"
 .\"
 .\" Copyright (c) 1997-2000 Erez Zadok
@@ -42,7 +42,7 @@
 .\"
 .\" Id: wire-test.8,v 1.3 2000/02/11 02:09:58 ezk Exp
 .\"
-.TH WIRE-TEST 8L "26 Feb 1993"
+.TH WIRE-TEST 8 "26 Feb 1993"
 .SH NAME
 wire-test \- test your network interfaces and local IP address
 .SH SYNOPSIS



Home | Main Index | Thread Index | Old Index