version 1.4, 1997/07/25 21:05:45 |
version 1.5, 1997/07/25 21:14:04 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <err.h> |
|
|
#include "extern.h" |
#include "extern.h" |
|
|
|
|
*p++ = OOBCH; |
*p++ = OOBCH; |
|
|
if (!next(&s2)) |
if (!next(&s2)) |
err("empty string2"); |
errx(1, "empty string2"); |
|
|
/* If string2 runs out of characters, use the last one specified. */ |
/* If string2 runs out of characters, use the last one specified. */ |
if (sflag) |
if (sflag) |
|
|
(void)fprintf(stderr, " tr [-c] -s string1\n"); |
(void)fprintf(stderr, " tr [-c] -s string1\n"); |
(void)fprintf(stderr, " tr [-c] -ds string1 string2\n"); |
(void)fprintf(stderr, " tr [-c] -ds string1 string2\n"); |
exit(1); |
exit(1); |
} |
|
|
|
#ifdef __STDC__ |
|
#include <stdarg.h> |
|
#else |
|
#include <varargs.h> |
|
#endif |
|
|
|
void |
|
#ifdef __STDC__ |
|
err(const char *fmt, ...) |
|
#else |
|
err(fmt, va_alist) |
|
char *fmt; |
|
va_dcl |
|
#endif |
|
{ |
|
va_list ap; |
|
#ifdef __STDC__ |
|
va_start(ap, fmt); |
|
#else |
|
va_start(ap); |
|
#endif |
|
(void)fprintf(stderr, "tr: "); |
|
(void)vfprintf(stderr, fmt, ap); |
|
va_end(ap); |
|
(void)fprintf(stderr, "\n"); |
|
exit(1); |
|
/* NOTREACHED */ |
|
} |
} |