summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-09-27 02:29:39 +0000
committerMatt Kraai <kraai@debian.org>2000-09-27 02:29:39 +0000
commite0bcce09baff576b1b16b3ffe780b6d91c7710c2 (patch)
tree69c78c69eaf5ad8e69f54f7c374f5ac3b2c5a950 /utility.c
parent8ce85ce4e3595ac15d4746adc3b5c920fe4db1e8 (diff)
downloadbusybox-w32-e0bcce09baff576b1b16b3ffe780b6d91c7710c2.tar.gz
busybox-w32-e0bcce09baff576b1b16b3ffe780b6d91c7710c2.tar.bz2
busybox-w32-e0bcce09baff576b1b16b3ffe780b6d91c7710c2.zip
Rewrote uniq to be less than a third of the size, and fixed some other
minor problems.
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/utility.c b/utility.c
index f7dda7917..d376a04fb 100644
--- a/utility.c
+++ b/utility.c
@@ -81,7 +81,7 @@ extern void usage(const char *usage)
81{ 81{
82 fprintf(stderr, "%s\n\n", full_version); 82 fprintf(stderr, "%s\n\n", full_version);
83 fprintf(stderr, "Usage: %s\n", usage); 83 fprintf(stderr, "Usage: %s\n", usage);
84 exit FALSE; 84 exit(EXIT_FAILURE);
85} 85}
86 86
87extern void errorMsg(const char *s, ...) 87extern void errorMsg(const char *s, ...)
@@ -106,7 +106,7 @@ extern void fatalError(const char *s, ...)
106 vfprintf(stderr, s, p); 106 vfprintf(stderr, s, p);
107 va_end(p); 107 va_end(p);
108 fflush(stderr); 108 fflush(stderr);
109 exit( FALSE); 109 exit(EXIT_FAILURE);
110} 110}
111 111
112#if defined BB_INIT 112#if defined BB_INIT
@@ -401,17 +401,17 @@ copyFile(const char *srcName, const char *destName,
401 /* This is fine, since symlinks never get here */ 401 /* This is fine, since symlinks never get here */
402 if (chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid) < 0) { 402 if (chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid) < 0) {
403 perror(destName); 403 perror(destName);
404 exit FALSE; 404 exit(EXIT_FAILURE);
405 } 405 }
406 if (chmod(destName, srcStatBuf.st_mode) < 0) { 406 if (chmod(destName, srcStatBuf.st_mode) < 0) {
407 perror(destName); 407 perror(destName);
408 exit FALSE; 408 exit(EXIT_FAILURE);
409 } 409 }
410 times.actime = srcStatBuf.st_atime; 410 times.actime = srcStatBuf.st_atime;
411 times.modtime = srcStatBuf.st_mtime; 411 times.modtime = srcStatBuf.st_mtime;
412 if (utime(destName, &times) < 0) { 412 if (utime(destName, &times) < 0) {
413 perror(destName); 413 perror(destName);
414 exit FALSE; 414 exit(EXIT_FAILURE);
415 } 415 }
416 } 416 }
417 417
@@ -1713,11 +1713,21 @@ void xregcomp(regex_t *preg, const char *regex, int cflags)
1713 int errmsgsz = regerror(ret, preg, NULL, 0); 1713 int errmsgsz = regerror(ret, preg, NULL, 0);
1714 char *errmsg = xmalloc(errmsgsz); 1714 char *errmsg = xmalloc(errmsgsz);
1715 regerror(ret, preg, errmsg, errmsgsz); 1715 regerror(ret, preg, errmsg, errmsgsz);
1716 fatalError("bb_regcomp: %s\n", errmsg); 1716 fatalError("xregcomp: %s\n", errmsg);
1717 } 1717 }
1718} 1718}
1719#endif 1719#endif
1720 1720
1721#if defined BB_UNIQ
1722FILE *xfopen(const char *path, const char *mode)
1723{
1724 FILE *fp;
1725 if ((fp = fopen(path, mode)) == NULL)
1726 fatalError("%s: %s\n", path, strerror(errno));
1727 return fp;
1728}
1729#endif
1730
1721/* END CODE */ 1731/* END CODE */
1722/* 1732/*
1723Local Variables: 1733Local Variables: