diff options
-rw-r--r-- | morse/morse.c | 33 | ||||
-rw-r--r-- | number/number.6 | 10 | ||||
-rw-r--r-- | number/number.c | 30 | ||||
-rw-r--r-- | pig/pig.6 | 6 | ||||
-rw-r--r-- | pig/pig.c | 17 | ||||
-rw-r--r-- | pom/pom.6 | 6 | ||||
-rw-r--r-- | pom/pom.c | 28 | ||||
-rw-r--r-- | ppt/ppt.c | 24 |
8 files changed, 86 insertions, 68 deletions
diff --git a/morse/morse.c b/morse/morse.c index a9045018..a23e7fa5 100644 --- a/morse/morse.c +++ b/morse/morse.c @@ -1,4 +1,4 @@ -/* $NetBSD: morse.c,v 1.3 1995/03/23 08:35:24 cgd Exp $ */ +/* $NetBSD: morse.c,v 1.4 1997/10/10 16:38:40 lukem Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,22 +33,23 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1988, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: morse.c,v 1.3 1995/03/23 08:35:24 cgd Exp $"; +__RCSID("$NetBSD: morse.c,v 1.4 1997/10/10 16:38:40 lukem Exp $"); #endif #endif /* not lint */ -#include <stdio.h> #include <ctype.h> +#include <stdio.h> +#include <unistd.h> static char *digit[] = { @@ -92,18 +93,21 @@ static char "--..", }; +int main __P((int, char *[])); +void morse __P((int)); +void show __P((char *)); + static int sflag; +int main(argc, argv) int argc; char **argv; { - extern char *optarg; - extern int optind; - register int ch; - register char *p; + int ch; + char *p; - while ((ch = getopt(argc, argv, "s")) != EOF) + while ((ch = getopt(argc, argv, "s")) != -1) switch((char)ch) { case 's': sflag = 1; @@ -123,10 +127,12 @@ main(argc, argv) } while (*++argv); else while ((ch = getchar()) != EOF) morse(ch); + exit(0); } +void morse(c) - register int c; + int c; { if (isalpha(c)) show(alph[c - (isupper(c) ? 'A' : 'a')]); @@ -140,8 +146,9 @@ morse(c) show(" ...\n"); } +void show(s) - register char *s; + char *s; { if (sflag) printf(" %s", s); diff --git a/number/number.6 b/number/number.6 index c50c1fb5..9022ece0 100644 --- a/number/number.6 +++ b/number/number.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: number.6,v 1.4 1995/03/23 08:35:29 cgd Exp $ +.\" $NetBSD: number.6,v 1.5 1997/10/10 16:41:37 lukem Exp $ .\" .\" Copyright (c) 1989, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -40,15 +40,15 @@ .Nm number .Nd convert Arabic numerals to English .Sh SYNOPSIS -.Nm number +.Nm .Op # .Sh DESCRIPTION The -.Nm number +.Nm utility prints the English equivalent of the number to the standard output, with each 10^3 magnitude displayed on a separate line. If no argument is specified, -.Nm number +.Nm reads lines from the standard input. .Pp The options are as follows: @@ -58,5 +58,5 @@ Display the number on a single line. .El .Sh BUGS Although -.Nm number +.Nm understand fractions, it doesn't understand exponents. diff --git a/number/number.c b/number/number.c index a0170b43..2fb2ad6f 100644 --- a/number/number.c +++ b/number/number.c @@ -1,4 +1,4 @@ -/* $NetBSD: number.c,v 1.4 1997/01/07 12:16:57 tls Exp $ */ +/* $NetBSD: number.c,v 1.5 1997/10/10 16:41:43 lukem Exp $ */ /* * Copyright (c) 1988, 1993, 1994 @@ -33,17 +33,17 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1988, 1993, 1994\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)number.c 8.3 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$NetBSD: number.c,v 1.4 1997/01/07 12:16:57 tls Exp $"; +__RCSID("$NetBSD: number.c,v 1.5 1997/10/10 16:41:43 lukem Exp $"); #endif #endif /* not lint */ @@ -81,6 +81,7 @@ static char *name1[] = { }; void convert __P((char *)); +int main __P((int, char *[])); int number __P((char *, int)); void pfract __P((int)); void toobig __P((void)); @@ -98,7 +99,7 @@ main(argc, argv) char line[256]; lflag = 0; - while ((ch = getopt(argc, argv, "l")) != EOF) + while ((ch = getopt(argc, argv, "l")) != -1) switch (ch) { case 'l': lflag = 1; @@ -132,9 +133,10 @@ void convert(line) char *line; { - register flen, len, rval; - register char *p, *fraction; + int flen, len, rval; + char *p, *fraction; + flen = 0; fraction = NULL; for (p = line; *p != '\0' && *p != '\n'; ++p) { if (isblank(*p)) { @@ -165,7 +167,7 @@ badnum: errx(1, "illegal number: %s", line); *p = '\0'; if ((len = strlen(line)) > MAXNUM || - fraction != NULL && (flen = strlen(fraction)) > MAXNUM) + (fraction != NULL && (flen = strlen(fraction)) > MAXNUM)) errx(1, "number too large, max %d digits.", MAXNUM); if (*line == '-') { @@ -197,10 +199,10 @@ badnum: errx(1, "illegal number: %s", line); int unit(len, p) - register int len; - register char *p; + int len; + char *p; { - register int off, rval; + int off, rval; rval = 0; if (len > 3) { @@ -233,10 +235,10 @@ unit(len, p) int number(p, len) - register char *p; + char *p; int len; { - register int val, rval; + int val, rval; rval = 0; switch (len) { @@ -1,4 +1,4 @@ -.\" $NetBSD: pig.6,v 1.3 1997/05/29 01:48:08 cgd Exp $ +.\" $NetBSD: pig.6,v 1.4 1997/10/10 16:43:33 lukem Exp $ .\" .\" Copyright (c) 1992 The Regents of the University of California. .\" All rights reserved. @@ -40,10 +40,10 @@ .Nm pig .Nd eformatray inputway asway Igpay Atinlay .Sh SYNOPSIS -.Nm pig +.Nm .Sh DESCRIPTION Ethay -.Nm igpay +.Nm utilityway eadsray ethay andardstay inputway andway iteswray itway outway otay andardstay outputway inway Igpay Atinlay. .Pp @@ -1,4 +1,4 @@ -/* $NetBSD: pig.c,v 1.4 1997/01/07 11:16:12 tls Exp $ */ +/* $NetBSD: pig.c,v 1.5 1997/10/10 16:43:37 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -33,17 +33,17 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1992, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)pig.c 8.2 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$NetBSD: pig.c,v 1.4 1997/01/07 11:16:12 tls Exp $"; +__RCSID("$NetBSD: pig.c,v 1.5 1997/10/10 16:43:37 lukem Exp $"); #endif #endif /* not lint */ @@ -55,6 +55,7 @@ static char rcsid[] = "$NetBSD: pig.c,v 1.4 1997/01/07 11:16:12 tls Exp $"; #include <string.h> #include <unistd.h> +int main __P((int, char *[])); void pigout __P((char *, int)); void usage __P((void)); @@ -63,11 +64,11 @@ main(argc, argv) int argc; char *argv[]; { - register int len; + int len; int ch; char buf[1024]; - while ((ch = getopt(argc, argv, "")) != EOF) + while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { case '?': default: @@ -99,7 +100,7 @@ pigout(buf, len) char *buf; int len; { - register int ch, start, i; + int ch, start, i; int olen, allupper, firstupper; /* See if the word is all upper case */ @@ -1,4 +1,4 @@ -.\" $NetBSD: pom.6,v 1.4 1995/03/23 08:35:35 cgd Exp $ +.\" $NetBSD: pom.6,v 1.5 1997/10/10 16:46:56 lukem Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,10 +40,10 @@ .Nm pom .Nd display the phase of the moon .Sh SYNOPSIS -.Nm pom +.Nm .Sh DESCRIPTION The -.Nm pom +.Nm utility displays the current phase of the moon. Useful for selecting software completion target dates and predicting managerial behavior. @@ -1,4 +1,4 @@ -/* $NetBSD: pom.c,v 1.6 1996/02/06 22:47:29 jtc Exp $ */ +/* $NetBSD: pom.c,v 1.7 1997/10/10 16:47:05 lukem Exp $ */ /* * Copyright (c) 1989, 1993 @@ -35,17 +35,17 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1989, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pom.c,v 1.6 1996/02/06 22:47:29 jtc Exp $"; +__RCSID("$NetBSD: pom.c,v 1.7 1997/10/10 16:47:05 lukem Exp $"); #endif #endif /* not lint */ @@ -60,11 +60,11 @@ static char rcsid[] = "$NetBSD: pom.c,v 1.6 1996/02/06 22:47:29 jtc Exp $"; */ #include <sys/time.h> +#include <errno.h> +#include <math.h> #include <stdio.h> #include <string.h> #include <tzfile.h> -#include <math.h> -#include <errno.h> #define PI 3.141592654 #define EPOCH 85 @@ -75,13 +75,19 @@ static char rcsid[] = "$NetBSD: pom.c,v 1.6 1996/02/06 22:47:29 jtc Exp $"; #define Pzero 192.917585 /* lunar mean long of perigee at EPOCH */ #define Nzero 55.204723 /* lunar mean long of node at EPOCH */ -double dtor(), potm(), adj360(); +void adj360 __P((double *)); +double dtor __P((double)); +int main __P((int, char *[])); +double potm __P((double)); -main() +int +main(argc, argv) + int argc; + char *argv[]; { struct timeval tp; struct timezone tzp; - struct tm *GMT, *gmtime(); + struct tm *GMT; time_t tmpt; double days, today, tomorrow; int cnt; @@ -173,7 +179,7 @@ dtor(deg) * adj360 -- * adjust value so 0 <= deg <= 360 */ -double +void adj360(deg) double *deg; { @@ -1,4 +1,4 @@ -/* $NetBSD: ppt.c,v 1.4 1995/03/23 08:35:40 cgd Exp $ */ +/* $NetBSD: ppt.c,v 1.5 1997/10/10 16:48:39 lukem Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,34 +33,36 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1988, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)ppt.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: ppt.c,v 1.4 1995/03/23 08:35:40 cgd Exp $"; +__RCSID("$NetBSD: ppt.c,v 1.5 1997/10/10 16:48:39 lukem Exp $"); #endif #endif /* not lint */ #include <stdio.h> -static void putppt(); + int main __P((int, char *[])); +static void putppt __P((int)); +int main(argc, argv) int argc; char **argv; { - register int c; - register char *p; + int c; + char *p; (void) puts("___________"); if (argc > 1) - while (p = *++argv) + while ((p = *++argv) != NULL) for (; *p; ++p) putppt((int)*p); else while ((c = getchar()) != EOF) @@ -71,9 +73,9 @@ main(argc, argv) static void putppt(c) - register int c; + int c; { - register int i; + int i; (void) putchar('|'); for (i = 7; i >= 0; i--) { |