Minor tweaks: including header files to bring prototypes into scope,

explicitly declaring function return values, etc. to make gcc -Wall
shut up.
This commit is contained in:
jtc 1993-08-27 22:30:10 +00:00
parent 5e2ed6648a
commit f7c6bf575a
18 changed files with 93 additions and 27 deletions

View File

@ -39,13 +39,16 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)basename.c 5.1 (Berkeley) 3/9/91";*/
static char rcsid[] = "$Id: basename.c,v 1.2 1993/08/01 18:18:23 mycroft Exp $";
static char rcsid[] = "$Id: basename.c,v 1.3 1993/08/27 22:30:10 jtc Exp $";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void usage();
int
main(argc, argv)
int argc;
char **argv;
@ -126,6 +129,7 @@ main(argc, argv)
exit(0);
}
static void
usage()
{
(void)fprintf(stderr, "usage: basename string [suffix]\n");

View File

@ -42,11 +42,13 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)cut.c 5.4 (Berkeley) 10/30/90";*/
static char rcsid[] = "$Id: cut.c,v 1.4 1993/08/16 22:44:51 jtc Exp $";
static char rcsid[] = "$Id: cut.c,v 1.5 1993/08/27 22:30:16 jtc Exp $";
#endif /* not lint */
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
int cflag;
@ -55,6 +57,7 @@ int dflag;
int fflag;
int sflag;
int
main(argc, argv)
int argc;
char **argv;

View File

@ -39,12 +39,15 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)dirname.c 5.6 (Berkeley) 3/9/91";*/
static char rcsid[] = "$Id: dirname.c,v 1.2 1993/08/01 18:16:55 mycroft Exp $";
static char rcsid[] = "$Id: dirname.c,v 1.3 1993/08/27 22:30:19 jtc Exp $";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
static void usage ();
int
main(argc, argv)
int argc;
char **argv;
@ -133,6 +136,7 @@ main(argc, argv)
exit(0);
}
static void
usage()
{
(void)fprintf(stderr, "usage: dirname path\n");

5
usr.bin/env/env.c vendored
View File

@ -39,15 +39,18 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)env.c 5.3 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: env.c,v 1.3 1993/08/01 18:16:49 mycroft Exp $";
static char rcsid[] = "$Id: env.c,v 1.4 1993/08/27 22:30:23 jtc Exp $";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
static void usage();
int
main(argc, argv)
int argc;
char **argv;

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)head.c 5.5 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: head.c,v 1.3 1993/08/01 18:14:54 mycroft Exp $";
static char rcsid[] = "$Id: head.c,v 1.4 1993/08/27 22:30:27 jtc Exp $";
#endif /* not lint */
#include <stdio.h>
@ -54,6 +54,7 @@ static void usage ();
* Bill Joy UCB August 24, 1977
*/
int
main(argc, argv)
int argc;
char **argv;

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)mkfifo.c 5.3 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: mkfifo.c,v 1.3 1993/08/01 18:11:11 mycroft Exp $";
static char rcsid[] = "$Id: mkfifo.c,v 1.4 1993/08/27 22:30:31 jtc Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -49,9 +49,11 @@ static char rcsid[] = "$Id: mkfifo.c,v 1.3 1993/08/01 18:11:11 mycroft Exp $";
#include <stdlib.h>
#include <string.h>
static void usage();
extern void *setmode();
extern mode_t getmode();
int
main(argc, argv)
int argc;
char **argv;
@ -95,6 +97,7 @@ main(argc, argv)
exit(exitval);
}
static void
usage()
{
(void)fprintf(stderr, "usage: mkfifo [-m mode] fifoname ...\n");

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)nice.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: nice.c,v 1.4 1993/08/27 20:22:06 jtc Exp $";
static char rcsid[] = "$Id: nice.c,v 1.5 1993/08/27 22:30:34 jtc Exp $";
#endif /* not lint */
#include <sys/time.h>
@ -50,10 +50,13 @@ static char rcsid[] = "$Id: nice.c,v 1.4 1993/08/27 20:22:06 jtc Exp $";
#include <ctype.h>
#include <errno.h>
#include <err.h>
#include <unistd.h>
#define DEFNICE 10
/* ARGSUSED */
static void usage();
int
main(argc, argv)
int argc;
char **argv;
@ -97,6 +100,7 @@ main(argc, argv)
err ((errno == ENOENT) ? 127 : 126, argv[0]);
}
static void
usage()
{
(void)fprintf(stderr,

View File

@ -39,9 +39,14 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)pagesize.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: pagesize.c,v 1.3 1993/08/01 18:10:22 mycroft Exp $";
static char rcsid[] = "$Id: pagesize.c,v 1.4 1993/08/27 22:30:37 jtc Exp $";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main()
{
printf("%d\n", getpagesize());

View File

@ -39,15 +39,19 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)printenv.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: printenv.c,v 1.2 1993/08/01 18:10:06 mycroft Exp $";
static char rcsid[] = "$Id: printenv.c,v 1.3 1993/08/27 22:30:40 jtc Exp $";
#endif /* not lint */
#include <stdio.h>
#include <string.h>
/*
* printenv
*
* Bill Joy, UCB
* February, 1979
*/
int
main(argc, argv)
int argc;
char **argv;

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)su.c 5.26 (Berkeley) 7/6/91";*/
static char rcsid[] = "$Id: su.c,v 1.6 1993/08/01 18:08:12 mycroft Exp $";
static char rcsid[] = "$Id: su.c,v 1.7 1993/08/27 22:30:44 jtc Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -47,6 +47,7 @@ static char rcsid[] = "$Id: su.c,v 1.6 1993/08/01 18:08:12 mycroft Exp $";
#include <sys/resource.h>
#include <syslog.h>
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <grp.h>
#include <string.h>
@ -66,7 +67,9 @@ int use_kerberos = 1;
#endif
extern char *crypt();
int chshell();
int
main(argc, argv)
int argc;
char **argv;
@ -254,6 +257,7 @@ main(argc, argv)
exit(1);
}
int
chshell(sh)
char *sh;
{

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)time.c 4.9 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: time.c,v 1.3 1993/08/27 19:05:31 jtc Exp $";
static char rcsid[] = "$Id: time.c,v 1.4 1993/08/27 22:30:47 jtc Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -48,11 +48,14 @@ static char rcsid[] = "$Id: time.c,v 1.3 1993/08/27 19:05:31 jtc Exp $";
#include <sys/signal.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
int lflag;
int portableflag;
int
main(argc, argv)
int argc;
char **argv;

View File

@ -33,10 +33,10 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)uniq.1 6.5 (Berkeley) 1/9/92
.\" $Id: uniq.1,v 1.3 1993/08/01 07:26:59 mycroft Exp $
.\" $Id: uniq.1,v 1.4 1993/08/27 22:30:51 jtc Exp $
.\"
.Dd January 9, 1992
.Dt UNIQ
.Dt UNIQ 1
.Os
.Sh NAME
.Nm uniq

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)uudecode.c 5.10 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: uudecode.c,v 1.2 1993/08/01 18:03:42 mycroft Exp $";
static char rcsid[] = "$Id: uudecode.c,v 1.3 1993/08/27 22:30:54 jtc Exp $";
#endif /* not lint */
/*
@ -47,15 +47,18 @@ static char rcsid[] = "$Id: uudecode.c,v 1.2 1993/08/01 18:03:42 mycroft Exp $";
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
static int decode();
static void usage();
char *filename;
/* ARGSUSED */
int
main(argc, argv)
int argc;
char **argv;
{
extern int errno;
int rval;
if (*++argv) {
@ -76,6 +79,7 @@ main(argc, argv)
exit(rval);
}
static int
decode()
{
extern int errno;
@ -174,6 +178,7 @@ decode()
return(0);
}
static void
usage()
{
(void)fprintf(stderr, "usage: uudecode [file ...]\n");

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)uuencode.c 5.9 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: uuencode.c,v 1.2 1993/08/01 18:03:38 mycroft Exp $";
static char rcsid[] = "$Id: uuencode.c,v 1.3 1993/08/27 22:30:57 jtc Exp $";
#endif /* not lint */
/*
@ -44,16 +44,20 @@ static char rcsid[] = "$Id: uuencode.c,v 1.2 1993/08/01 18:03:38 mycroft Exp $";
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
static void encode();
static void usage();
int
main(argc, argv)
int argc;
char **argv;
{
extern int optind;
extern int errno;
struct stat sb;
int mode;
char *strerror();
while (getopt(argc, argv, "") != EOF)
usage();
@ -96,6 +100,7 @@ main(argc, argv)
/*
* copy from in to out, encoding as you go along.
*/
static void
encode()
{
register int ch, n;
@ -136,6 +141,7 @@ encode()
(void)putchar('\n');
}
static void
usage()
{
(void)fprintf(stderr,"usage: uuencode [infile] remotefile\n");

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)wall.c 5.14 (Berkeley) 3/2/91";*/
static char rcsid[] = "$Id: wall.c,v 1.4 1993/08/01 18:03:08 mycroft Exp $";
static char rcsid[] = "$Id: wall.c,v 1.5 1993/08/27 22:31:02 jtc Exp $";
#endif /* not lint */
/*
@ -55,15 +55,19 @@ static char rcsid[] = "$Id: wall.c,v 1.4 1993/08/01 18:03:08 mycroft Exp $";
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <paths.h>
#include <unistd.h>
#define IGNOREUSER "sleeper"
void makemsg();
int nobanner;
int mbufsize;
char *mbuf;
/* ARGSUSED */
int
main(argc, argv)
int argc;
char **argv;
@ -113,6 +117,7 @@ usage:
exit(0);
}
void
makemsg(fname)
char *fname;
{

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)wc.c 5.7 (Berkeley) 3/2/91";*/
static char rcsid[] = "$Id: wc.c,v 1.4 1993/08/17 00:37:11 jtc Exp $";
static char rcsid[] = "$Id: wc.c,v 1.5 1993/08/27 22:31:06 jtc Exp $";
#endif /* not lint */
/* wc line, word and char count */
@ -52,15 +52,18 @@ static char rcsid[] = "$Id: wc.c,v 1.4 1993/08/17 00:37:11 jtc Exp $";
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#define DEL 0177 /* del char */
#define NL 012 /* newline char */
#define SPACE 040 /* space char */
#define TAB 011 /* tab char */
static void cnt();
static long tlinect, twordct, tcharct;
static int doline, doword, dochar;
int
main(argc, argv)
int argc;
char **argv;
@ -122,6 +125,7 @@ main(argc, argv)
exit(0);
}
static void
cnt(file)
char *file;
{
@ -146,7 +150,7 @@ cnt(file)
* the word count requires some logic.
*/
if (doline) {
while(len = read(fd, buf, MAXBSIZE)) {
while((len = read(fd, buf, MAXBSIZE)) != 0) {
if (len == -1) {
fprintf (stderr, "wc: %s: %s\n",
file, strerror(errno));
@ -196,7 +200,7 @@ cnt(file)
else
fd = 0;
/* do it the hard way... */
for (gotsp = 1; len = read(fd, buf, MAXBSIZE);) {
for (gotsp = 1; (len = read(fd, buf, MAXBSIZE));) {
if (len == -1) {
fprintf (stderr, "wc: %s: %s\n", file, strerror(errno));
exit(1);

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)whois.c 5.11 (Berkeley) 3/2/91";*/
static char rcsid[] = "$Id: whois.c,v 1.3 1993/08/01 18:02:49 mycroft Exp $";
static char rcsid[] = "$Id: whois.c,v 1.4 1993/08/27 22:31:09 jtc Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -47,9 +47,15 @@ static char rcsid[] = "$Id: whois.c,v 1.3 1993/08/01 18:02:49 mycroft Exp $";
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define NICHOST "whois.internic.net"
static void usage();
int
main(argc, argv)
int argc;
char **argv;
@ -125,6 +131,7 @@ main(argc, argv)
exit(0);
}
static void
usage()
{
(void)fprintf(stderr, "usage: whois [-h hostname] name ...\n");

View File

@ -42,7 +42,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)xargs.c 5.11 (Berkeley) 6/19/91";*/
static char rcsid[] = "$Id: xargs.c,v 1.4 1993/08/01 18:01:02 mycroft Exp $";
static char rcsid[] = "$Id: xargs.c,v 1.5 1993/08/27 22:31:12 jtc Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -60,6 +60,7 @@ int tflag;
void err __P((const char *, ...));
void run(), usage();
int
main(argc, argv)
int argc;
char **argv;