=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/paste/paste.c,v retrieving revision 1.13 retrieving revision 1.14 diff -c -r1.13 -r1.14 *** src/usr.bin/paste/paste.c 2003/07/10 00:06:51 1.13 --- src/usr.bin/paste/paste.c 2004/10/10 03:29:29 1.14 *************** *** 1,4 **** ! /* $OpenBSD: paste.c,v 1.13 2003/07/10 00:06:51 david Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: paste.c,v 1.14 2004/10/10 03:29:29 mickey Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. *************** *** 40,46 **** #ifndef lint /*static char sccsid[] = "from: @(#)paste.c 5.7 (Berkeley) 10/30/90";*/ ! static char rcsid[] = "$OpenBSD: paste.c,v 1.13 2003/07/10 00:06:51 david Exp $"; #endif /* not lint */ #include --- 40,46 ---- #ifndef lint /*static char sccsid[] = "from: @(#)paste.c 5.7 (Berkeley) 10/30/90";*/ ! static char rcsid[] = "$OpenBSD: paste.c,v 1.14 2004/10/10 03:29:29 mickey Exp $"; #endif /* not lint */ #include *************** *** 114,130 **** size_t len; for (cnt = 0, head = NULL; (p = *argv); ++argv, ++cnt) { ! if (!(lp = (LIST *)malloc((u_int)sizeof(LIST)))) { ! (void)fprintf(stderr, "paste: %s.\n", strerror(ENOMEM)); ! exit(1); ! } if (p[0] == '-' && !p[1]) lp->fp = stdin; ! else if (!(lp->fp = fopen(p, "r"))) { ! (void)fprintf(stderr, "paste: %s: %s.\n", p, ! strerror(errno)); ! exit(1); ! } lp->next = NULL; lp->cnt = cnt; lp->name = p; --- 114,126 ---- size_t len; for (cnt = 0, head = NULL; (p = *argv); ++argv, ++cnt) { ! if (!(lp = (LIST *)malloc((u_int)sizeof(LIST)))) ! err(1, "malloc"); ! if (p[0] == '-' && !p[1]) lp->fp = stdin; ! else if (!(lp->fp = fopen(p, "r"))) ! err(1, "%s", p); lp->next = NULL; lp->cnt = cnt; lp->name = p; *************** *** 158,164 **** *(buf + len - 1) = '\0'; else { if ((lbuf = malloc(len + 1)) == NULL) ! err(1, NULL); memcpy(lbuf, buf, len); lbuf[len] = '\0'; buf = lbuf; --- 154,160 ---- *(buf + len - 1) = '\0'; else { if ((lbuf = malloc(len + 1)) == NULL) ! err(1, "malloc"); memcpy(lbuf, buf, len); lbuf[len] = '\0'; buf = lbuf; *************** *** 197,204 **** if (p[0] == '-' && !p[1]) fp = stdin; else if (!(fp = fopen(p, "r"))) { ! (void)fprintf(stderr, "paste: %s: %s.\n", p, ! strerror(errno)); continue; } if ((buf = fgetln(fp, &len))) { --- 193,199 ---- if (p[0] == '-' && !p[1]) fp = stdin; else if (!(fp = fopen(p, "r"))) { ! warn("%s", p); continue; } if ((buf = fgetln(fp, &len))) { *************** *** 207,213 **** *(buf + len - 1) = '\0'; else { if ((lbuf = malloc(len + 1)) == NULL) ! err(1, NULL); memcpy(lbuf, buf, len); lbuf[len] = '\0'; buf = lbuf; --- 202,208 ---- *(buf + len - 1) = '\0'; else { if ((lbuf = malloc(len + 1)) == NULL) ! err(1, "malloc"); memcpy(lbuf, buf, len); lbuf[len] = '\0'; buf = lbuf; *************** *** 255,270 **** } else *arg = ch; ! if (!cnt) { ! (void)fprintf(stderr, "paste: no delimiters specified.\n"); ! exit(1); ! } return(cnt); } void usage(void) { ! (void)fprintf(stderr, "paste: [-s] [-d delimiters] file ...\n"); exit(1); } --- 250,265 ---- } else *arg = ch; ! if (!cnt) ! errx(1, "no delimiters specified"); return(cnt); } void usage(void) { ! extern char *__progname; ! (void)fprintf(stderr, "usage: %s [-s] [-d delimiters] file ...\n", ! __progname); exit(1); }