Source-Changes-HG archive

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

[src/netbsd-1-4]: src/usr.bin Pull up revision 1.6 (requested by he):



details:   https://anonhg.NetBSD.org/src/rev/c4b38b84160b
branches:  netbsd-1-4
changeset: 471094:c4b38b84160b
user:      he <he%NetBSD.org@localhost>
date:      Thu Oct 19 16:32:42 2000 +0000

description:
Pull up revision 1.6 (requested by he):
  Format string cleanup.

diffstat:

 usr.bin/rs/rs.c      |  19 ++++++++++++-------
 usr.bin/sed/extern.h |   7 ++++---
 2 files changed, 16 insertions(+), 10 deletions(-)

diffs (93 lines):

diff -r 777391c91c63 -r c4b38b84160b usr.bin/rs/rs.c
--- a/usr.bin/rs/rs.c   Thu Oct 19 16:32:41 2000 +0000
+++ b/usr.bin/rs/rs.c   Thu Oct 19 16:32:42 2000 +0000
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)rs.c       8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: rs.c,v 1.4 1997/10/19 14:22:16 lukem Exp $");
+__RCSID("$NetBSD: rs.c,v 1.4.4.1 2000/10/19 16:32:42 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -56,6 +56,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 
 long   flags;
 #define        TRANSPOSE       000001
@@ -94,7 +95,8 @@
 char   isep = ' ', osep = ' ';
 int    owidth = 80, gutter = 2;
 
-void     usage __P((char *, char *));
+void     usage __P((char *, ...))
+     __attribute__((__format__(__printf__, 1, 2)));
 void     getargs __P((int, char *[]));
 void     getfile __P((void));
 int      getline __P((void));
@@ -239,10 +241,13 @@
 }
 
 void
-usage(msg, s)
-       char *msg, *s;
+usage(char *msg, ...)
 {
-       warnx(msg, s);
+       va_list ap;
+
+       va_start(ap, msg);
+       vwarnx(msg, ap);
+       va_end(ap);
        fprintf(stderr,
 "Usage:  rs [ -[csCS][x][kKgGw][N]tTeEnyjhHm ] [ rows [ cols ] ]\n");
        exit(1);
@@ -427,7 +432,7 @@
                        case 'w':               /* window width, default 80 */
                                p = getnum(&owidth, p, 0);
                                if (owidth <= 0)
-                               usage("Width must be a positive integer", "");
+                               usage("Width must be a positive integer");
                                break;
                        case 'K':                       /* skip N lines */
                                flags |= SKIPPRINT;
@@ -497,7 +502,7 @@
        case 0:
                break;
        default:
-               usage("Too many arguments.", "");
+               usage("Too many arguments.");
        }
 }
 
diff -r 777391c91c63 -r c4b38b84160b usr.bin/sed/extern.h
--- a/usr.bin/sed/extern.h      Thu Oct 19 16:32:41 2000 +0000
+++ b/usr.bin/sed/extern.h      Thu Oct 19 16:32:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.5 1997/01/09 20:21:29 tls Exp $   */
+/*     $NetBSD: extern.h,v 1.5.4.1 2000/10/19 16:32:45 he Exp $        */
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)extern.h      8.1 (Berkeley) 6/6/93
- *     $NetBSD: extern.h,v 1.5 1997/01/09 20:21:29 tls Exp $
+ *     $NetBSD: extern.h,v 1.5.4.1 2000/10/19 16:32:45 he Exp $
  */
 
 extern struct s_command *prog;
@@ -54,7 +54,8 @@
 void    compile __P((void));
 void    cspace __P((SPACE *, char *, size_t, enum e_spflag));
 char   *cu_fgets __P((char *, int));
-void    err __P((int, const char *, ...));
+void    err __P((int, const char *, ...))
+     __attribute__((__format__(__printf__, 2, 3)));
 int     mf_fgets __P((SPACE *, enum e_spflag));
 void    process __P((void));
 char   *strregerror __P((int, regex_t *));



Home | Main Index | Thread Index | Old Index