Date: Tue, 10 Feb 1998 20:59:56 -0800 (PST) From: jason_smethers@bigfoot.com To: freebsd-gnats-submit@FreeBSD.ORG Subject: bin/5711: bin/cat code cleanup Message-ID: <199802110459.UAA18202@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 5711 >Category: bin >Synopsis: bin/cat code cleanup >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Feb 10 21:10:04 PST 1998 >Last-Modified: >Originator: Jason Smethers >Organization: >Release: 3.0-Current >Environment: FreeBSD p90unix.vipersystems.com 3.0-CURRENT FreeBSD 3.0-CURRENT #1: Sun Feb 8 17:26:35 CST 1998 root@p90unix.vipersystems.com:/usr/src/sys/compile/P90UNIX i386 >Description: code cleanup of /usr/cat and man page >How-To-Repeat: >Fix: diff -c -r /usr/src/bin/cat/cat.1 /usr/local/src/bin/cat/cat.1 *** /usr/src/bin/cat/cat.1 Sat Feb 22 08:01:26 1997 --- /usr/local/src/bin/cat/cat.1 Mon Feb 2 18:18:34 1998 *************** *** 13,19 **** .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software ! .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors --- 13,19 ---- .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software ! .\" must display the following acknowledgment: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors *************** *** 118,125 **** .Sh HISTORY A .Nm ! command appeared in Version 1 AT&T UNIX. Dennis Ritchie designed and wrote the first man page. It appears to have been .Xr cat 1 . ! --- 118,134 ---- .Sh HISTORY A .Nm ! utility appeared in Version 1 AT&T UNIX. Dennis Ritchie designed and wrote the first man page. It appears to have been .Xr cat 1 . ! .Sh STANDARDS ! The ! .Nm cat ! utility is compliant with the ! .St -p1003.2-92 ! specification. ! .Pp ! The flags ! .Op Fl benstv ! are extensions to the specification. diff -c -r /usr/src/bin/cat/cat.c /usr/local/src/bin/cat/cat.c *** /usr/src/bin/cat/cat.c Fri Mar 28 09:24:04 1997 --- /usr/local/src/bin/cat/cat.c Tue Feb 3 17:33:24 1998 *************** *** 63,68 **** --- 63,69 ---- int rval; char *filename; + int main __P((int, char *[])); void cook_args __P((char *argv[])); void cook_buf __P((FILE *)); void raw_args __P((char *argv[])); *************** *** 76,82 **** extern int optind; int ch; ! setlocale(LC_CTYPE, ""); while ((ch = getopt(argc, argv, "benstuv")) != -1) switch (ch) { --- 77,83 ---- extern int optind; int ch; ! (void)setlocale(LC_ALL, ""); while ((ch = getopt(argc, argv, "benstuv")) != -1) switch (ch) { *************** *** 96,107 **** tflag = vflag = 1; /* -t implies -v */ break; case 'u': ! setbuf(stdout, (char *)NULL); break; case 'v': vflag = 1; break; default: (void)fprintf(stderr, "usage: cat [-benstuv] [-] [file ...]\n"); exit(1); --- 97,109 ---- tflag = vflag = 1; /* -t implies -v */ break; case 'u': ! setbuf(stdout, NULL); break; case 'v': vflag = 1; break; default: + case '?': (void)fprintf(stderr, "usage: cat [-benstuv] [-] [file ...]\n"); exit(1); *************** *** 248,258 **** err(1, "%s", filename); bsize = MAX(sbuf.st_blksize, 1024); if ((buf = malloc((u_int)bsize)) == NULL) ! err(1, NULL); } ! while ((nr = read(rfd, buf, bsize)) > 0) for (off = 0; nr; nr -= nw, off += nw) ! if ((nw = write(wfd, buf + off, nr)) < 0) err(1, "stdout"); if (nr < 0) { warn("%s", filename); --- 250,260 ---- err(1, "%s", filename); bsize = MAX(sbuf.st_blksize, 1024); if ((buf = malloc((u_int)bsize)) == NULL) ! err(1, "cannot allocate buffer"); } ! while ((nr = read(rfd, buf, (u_int)bsize)) > 0) for (off = 0; nr; nr -= nw, off += nw) ! if ((nw = write(wfd, buf + off, (u_int)nr)) < 0) err(1, "stdout"); if (nr < 0) { warn("%s", filename); >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802110459.UAA18202>