WARNS=2 fixes, use __FBSDID().
This commit is contained in:
parent
e581388480
commit
814e3a92a9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87712
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#define WR(p, size) do { \
|
||||
if (write(STDOUT_FILENO, p, size) != size) \
|
||||
if (write(STDOUT_FILENO, p, size) != (ssize_t)size) \
|
||||
oerr(); \
|
||||
} while(0)
|
||||
|
||||
@ -64,4 +64,4 @@ int mapprint __P((struct mapinfo *, off_t, off_t));
|
||||
int maparound __P((struct mapinfo *, off_t));
|
||||
|
||||
extern int Fflag, fflag, rflag, rval;
|
||||
extern char *fname;
|
||||
extern const char *fname;
|
||||
|
@ -34,13 +34,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -48,14 +48,15 @@ static const char rcsid[] =
|
||||
#include <sys/mman.h>
|
||||
#include <sys/event.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
static void rlines __P((FILE *, off_t, struct stat *));
|
||||
@ -171,6 +172,7 @@ forward(fp, style, off, sbp)
|
||||
if (lines(fp, off))
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if (fflag) {
|
||||
|
@ -34,23 +34,25 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
void
|
||||
|
@ -34,23 +34,25 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
/*
|
||||
@ -115,7 +117,8 @@ bytes(fp, off)
|
||||
} else {
|
||||
if (wrap && (len = ep - p))
|
||||
WR(p, len);
|
||||
if (len = p - sp)
|
||||
len = p - sp;
|
||||
if (len)
|
||||
WR(sp, len);
|
||||
}
|
||||
return 0;
|
||||
@ -140,15 +143,15 @@ lines(fp, off)
|
||||
u_int blen;
|
||||
u_int len;
|
||||
char *l;
|
||||
} *lines;
|
||||
} *llines;
|
||||
int ch;
|
||||
char *p;
|
||||
int blen, cnt, recno, wrap;
|
||||
char *sp;
|
||||
char *p, *sp;
|
||||
int recno, wrap;
|
||||
u_int cnt, blen;
|
||||
|
||||
if ((lines = malloc(off * sizeof(*lines))) == NULL)
|
||||
if ((llines = malloc(off * sizeof(*llines))) == NULL)
|
||||
err(1, "malloc");
|
||||
bzero(lines, off * sizeof(*lines));
|
||||
bzero(llines, off * sizeof(*llines));
|
||||
sp = NULL;
|
||||
blen = cnt = recno = wrap = 0;
|
||||
|
||||
@ -160,13 +163,13 @@ lines(fp, off)
|
||||
}
|
||||
*p++ = ch;
|
||||
if (ch == '\n') {
|
||||
if (lines[recno].blen < cnt) {
|
||||
lines[recno].blen = cnt + 256;
|
||||
if ((lines[recno].l = realloc(lines[recno].l,
|
||||
lines[recno].blen)) == NULL)
|
||||
if (llines[recno].blen < cnt) {
|
||||
llines[recno].blen = cnt + 256;
|
||||
if ((llines[recno].l = realloc(llines[recno].l,
|
||||
llines[recno].blen)) == NULL)
|
||||
err(1, "realloc");
|
||||
}
|
||||
bcopy(sp, lines[recno].l, lines[recno].len = cnt);
|
||||
bcopy(sp, llines[recno].l, llines[recno].len = cnt);
|
||||
cnt = 0;
|
||||
p = sp;
|
||||
if (++recno == off) {
|
||||
@ -180,8 +183,8 @@ lines(fp, off)
|
||||
return 1;
|
||||
}
|
||||
if (cnt) {
|
||||
lines[recno].l = sp;
|
||||
lines[recno].len = cnt;
|
||||
llines[recno].l = sp;
|
||||
llines[recno].len = cnt;
|
||||
if (++recno == off) {
|
||||
wrap = 1;
|
||||
recno = 0;
|
||||
@ -189,17 +192,17 @@ lines(fp, off)
|
||||
}
|
||||
|
||||
if (rflag) {
|
||||
for (cnt = recno - 1; cnt >= 0; --cnt)
|
||||
WR(lines[cnt].l, lines[cnt].len);
|
||||
for (cnt = recno - 1; cnt != 0; --cnt)
|
||||
WR(llines[cnt].l, llines[cnt].len);
|
||||
if (wrap)
|
||||
for (cnt = off - 1; cnt >= recno; --cnt)
|
||||
WR(lines[cnt].l, lines[cnt].len);
|
||||
for (cnt = off - 1; cnt >= (u_int)recno; --cnt)
|
||||
WR(llines[cnt].l, llines[cnt].len);
|
||||
} else {
|
||||
if (wrap)
|
||||
for (cnt = recno; cnt < off; ++cnt)
|
||||
WR(lines[cnt].l, lines[cnt].len);
|
||||
for (cnt = 0; cnt < recno; ++cnt)
|
||||
WR(lines[cnt].l, lines[cnt].len);
|
||||
for (cnt = recno; cnt < (u_int)off; ++cnt)
|
||||
WR(llines[cnt].l, llines[cnt].len);
|
||||
for (cnt = 0; cnt < (u_int)recno; ++cnt)
|
||||
WR(llines[cnt].l, llines[cnt].len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,25 +34,26 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
static void r_buf __P((FILE *));
|
||||
@ -101,6 +102,7 @@ reverse(fp, style, off, sbp)
|
||||
case REVERSE:
|
||||
r_buf(fp);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,32 +34,34 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef lint
|
||||
static const char copyright[] =
|
||||
"@(#) Copyright (c) 1991, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
int Fflag, fflag, rflag, rval;
|
||||
char *fname;
|
||||
const char *fname;
|
||||
|
||||
static void obsolete __P((char **));
|
||||
static void usage __P((void));
|
||||
@ -169,7 +171,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
if (*argv)
|
||||
for (first = 1; fname = *argv++;) {
|
||||
for (first = 1; (fname = *argv++);) {
|
||||
if ((fp = fopen(fname, "r")) == NULL ||
|
||||
fstat(fileno(fp), &sb)) {
|
||||
ierr();
|
||||
@ -227,7 +229,7 @@ obsolete(argv)
|
||||
size_t len;
|
||||
char *start;
|
||||
|
||||
while (ap = *++argv) {
|
||||
while ((ap = *++argv)) {
|
||||
/* Return if "--" or not an option of any form. */
|
||||
if (ap[0] != '-') {
|
||||
if (ap[0] != '+')
|
||||
|
Loading…
Reference in New Issue
Block a user