summaryrefslogtreecommitdiff
path: root/usr.bin/lam
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1997-10-19 03:42:18 +0000
committerlukem <lukem@NetBSD.org>1997-10-19 03:42:18 +0000
commit4803fea3e978520a694eff707eb551e7db5e11b9 (patch)
tree1c1381df67d2270053595cef1a2158296b23fff5 /usr.bin/lam
parentd6dfc8e2dbcf035050ddc4cac6cda79d37f91cfb (diff)
WARNSify, fix .Nm usage, deprecate register, use <err.h>
Diffstat (limited to 'usr.bin/lam')
-rw-r--r--usr.bin/lam/lam.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c
index f2024293d4c..e77a87272d9 100644
--- a/usr.bin/lam/lam.c
+++ b/usr.bin/lam/lam.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $ */
+/* $NetBSD: lam.c,v 1.3 1997/10/19 03:42:18 lukem Exp $ */
/*-
* Copyright (c) 1993
@@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1993\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1993\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)lam.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $";
+__RCSID("$NetBSD: lam.c,v 1.3 1997/10/19 03:42:18 lukem Exp $");
#endif /* not lint */
/*
@@ -51,6 +51,7 @@ static char rcsid[] = "$NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $";
* Author: John Kunze, UCB
*/
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -75,6 +76,7 @@ char *linep;
void error __P((char *, char *));
char *gatherline __P((struct openfile *));
void getargs __P((char *[]));
+int main __P((int, char **));
char *pad __P((struct openfile *));
int
@@ -82,7 +84,7 @@ main(argc, argv)
int argc;
char *argv[];
{
- register struct openfile *ip;
+ struct openfile *ip;
getargs(argv);
if (!morefiles)
@@ -104,9 +106,9 @@ void
getargs(av)
char *av[];
{
- register struct openfile *ip = input;
- register char *p;
- register char *c;
+ struct openfile *ip = input;
+ char *p;
+ char *c;
static char fmtbuf[BUFSIZ];
char *fmtp = fmtbuf;
int P, S, F, T;
@@ -117,10 +119,8 @@ getargs(av)
morefiles++;
if (*p == '-')
ip->fp = stdin;
- else if ((ip->fp = fopen(p, "r")) == NULL) {
- perror(p);
- exit(1);
- }
+ else if ((ip->fp = fopen(p, "r")) == NULL)
+ errx(1, "open %s", p);
ip->pad = P;
if (!ip->sepstring)
ip->sepstring = (S ? (ip-1)->sepstring : "");
@@ -176,8 +176,8 @@ char *
pad(ip)
struct openfile *ip;
{
- register char *p = ip->sepstring;
- register char *lp = linep;
+ char *p = ip->sepstring;
+ char *lp = linep;
while (*p)
*lp++ = *p++;
@@ -193,9 +193,9 @@ gatherline(ip)
struct openfile *ip;
{
char s[BUFSIZ];
- register int c;
- register char *p;
- register char *lp = linep;
+ int c;
+ char *p;
+ char *lp = linep;
char *end = s + BUFSIZ;
if (ip->eof)
@@ -223,8 +223,7 @@ void
error(msg, s)
char *msg, *s;
{
- fprintf(stderr, "lam: ");
- fprintf(stderr, msg, s);
+ warnx(msg, s);
fprintf(stderr,
"\nUsage: lam [ -[fp] min.max ] [ -s sepstring ] [ -t c ] file ...\n");
if (strncmp("lam - ", msg, 6) == 0)