Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin ANSIfy, KNF, use [gs]etprogname. By Petri Koistinen.
details: https://anonhg.NetBSD.org/src/rev/e5746661ca6f
branches: trunk
changeset: 515120:e5746661ca6f
user: wiz <wiz%NetBSD.org@localhost>
date: Sun Sep 16 22:07:14 2001 +0000
description:
ANSIfy, KNF, use [gs]etprogname. By Petri Koistinen.
diffstat:
bin/mkdir/mkdir.c | 28 ++++++++++++----------------
bin/pwd/pwd.c | 33 +++++++++++++++------------------
2 files changed, 27 insertions(+), 34 deletions(-)
diffs (159 lines):
diff -r 798da19f11e5 -r e5746661ca6f bin/mkdir/mkdir.c
--- a/bin/mkdir/mkdir.c Sun Sep 16 21:57:34 2001 +0000
+++ b/bin/mkdir/mkdir.c Sun Sep 16 22:07:14 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkdir.c,v 1.24 2000/10/10 14:30:40 enami Exp $ */
+/* $NetBSD: mkdir.c,v 1.25 2001/09/16 22:07:14 wiz Exp $ */
/*
* Copyright (c) 1983, 1992, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94";
#else
-__RCSID("$NetBSD: mkdir.c,v 1.24 2000/10/10 14:30:40 enami Exp $");
+__RCSID("$NetBSD: mkdir.c,v 1.25 2001/09/16 22:07:14 wiz Exp $");
#endif
#endif /* not lint */
@@ -58,19 +58,18 @@
#include <string.h>
#include <unistd.h>
-int mkpath __P((char *, mode_t, mode_t));
-void usage __P((void));
-int main __P((int, char *[]));
+int mkpath(char *, mode_t, mode_t);
+void usage(void);
+int main(int, char *[]);
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int ch, exitval, pflag;
void *set;
mode_t mode, dir_mode;
+ setprogname(argv[0]);
(void)setlocale(LC_ALL, "");
/*
@@ -145,15 +144,13 @@
* dir_mode - file mode of intermediate directories
*/
int
-mkpath(path, mode, dir_mode)
- char *path;
- mode_t mode;
- mode_t dir_mode;
+mkpath(char *path, mode_t mode, mode_t dir_mode)
{
struct stat sb;
char *slash;
- int done = 0;
+ int done;
+ done = 0;
slash = path;
while (!done) {
@@ -192,10 +189,9 @@
}
void
-usage()
+usage(void)
{
-
- (void)fprintf(stderr, "usage: mkdir [-p] [-m mode] dirname ...\n");
+ (void)fprintf(stderr, "usage: %s [-p] [-m mode] dirname ...\n", getprogname());
exit(EXIT_FAILURE);
/* NOTREACHED */
}
diff -r 798da19f11e5 -r e5746661ca6f bin/pwd/pwd.c
--- a/bin/pwd/pwd.c Sun Sep 16 21:57:34 2001 +0000
+++ b/bin/pwd/pwd.c Sun Sep 16 22:07:14 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pwd.c,v 1.13 1999/11/09 15:06:32 drochner Exp $ */
+/* $NetBSD: pwd.c,v 1.14 2001/09/16 22:11:56 wiz Exp $ */
/*
* Copyright (c) 1991, 1993, 1994
@@ -43,12 +43,13 @@
#if 0
static char sccsid[] = "@(#)pwd.c 8.3 (Berkeley) 4/1/94";
#else
-__RCSID("$NetBSD: pwd.c,v 1.13 1999/11/09 15:06:32 drochner Exp $");
+__RCSID("$NetBSD: pwd.c,v 1.14 2001/09/16 22:11:56 wiz Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
+
#include <err.h>
#include <errno.h>
#include <stdio.h>
@@ -56,26 +57,25 @@
#include <string.h>
#include <unistd.h>
-static char * getcwd_logical __P((char *, size_t));
-static void usage __P((void));
-int main __P((int, char *[]));
+static char *getcwd_logical(char *, size_t);
+static void usage(void);
+int main(int, char *[]);
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
- int ch;
- int lFlag = 0;
+ int ch, lFlag;
const char *p;
+ setprogname(argv[0]);
+ lFlag = 0;
while ((ch = getopt(argc, argv, "LP")) != -1)
switch (ch) {
case 'L':
- lFlag=1;
+ lFlag = 1;
break;
case 'P':
- lFlag=0;
+ lFlag = 0;
break;
case '?':
default:
@@ -102,9 +102,7 @@
}
static char *
-getcwd_logical(pt, size)
- char *pt;
- size_t size;
+getcwd_logical(char *pt, size_t size)
{
char *pwd;
size_t pwdlen;
@@ -143,10 +141,9 @@
}
static void
-usage()
+usage(void)
{
-
- (void)fprintf(stderr, "usage: pwd [-LP]\n");
+ (void)fprintf(stderr, "usage: %s [-LP]\n", getprogname());
exit(EXIT_FAILURE);
/* NOTREACHED */
}
Home |
Main Index |
Thread Index |
Old Index