summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorMatt Kraai2000-09-27 02:29:39 +0000
committerMatt Kraai2000-09-27 02:29:39 +0000
commite0bcce09baff576b1b16b3ffe780b6d91c7710c2 (patch)
tree69c78c69eaf5ad8e69f54f7c374f5ac3b2c5a950 /utility.c
parent8ce85ce4e3595ac15d4746adc3b5c920fe4db1e8 (diff)
downloadbusybox-e0bcce09baff576b1b16b3ffe780b6d91c7710c2.zip
busybox-e0bcce09baff576b1b16b3ffe780b6d91c7710c2.tar.gz
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 f7dda79..d376a04 100644
--- a/utility.c
+++ b/utility.c
@@ -81,7 +81,7 @@ extern void usage(const char *usage)
{
fprintf(stderr, "%s\n\n", full_version);
fprintf(stderr, "Usage: %s\n", usage);
- exit FALSE;
+ exit(EXIT_FAILURE);
}
extern void errorMsg(const char *s, ...)
@@ -106,7 +106,7 @@ extern void fatalError(const char *s, ...)
vfprintf(stderr, s, p);
va_end(p);
fflush(stderr);
- exit( FALSE);
+ exit(EXIT_FAILURE);
}
#if defined BB_INIT
@@ -401,17 +401,17 @@ copyFile(const char *srcName, const char *destName,
/* This is fine, since symlinks never get here */
if (chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid) < 0) {
perror(destName);
- exit FALSE;
+ exit(EXIT_FAILURE);
}
if (chmod(destName, srcStatBuf.st_mode) < 0) {
perror(destName);
- exit FALSE;
+ exit(EXIT_FAILURE);
}
times.actime = srcStatBuf.st_atime;
times.modtime = srcStatBuf.st_mtime;
if (utime(destName, &times) < 0) {
perror(destName);
- exit FALSE;
+ exit(EXIT_FAILURE);
}
}
@@ -1713,11 +1713,21 @@ void xregcomp(regex_t *preg, const char *regex, int cflags)
int errmsgsz = regerror(ret, preg, NULL, 0);
char *errmsg = xmalloc(errmsgsz);
regerror(ret, preg, errmsg, errmsgsz);
- fatalError("bb_regcomp: %s\n", errmsg);
+ fatalError("xregcomp: %s\n", errmsg);
}
}
#endif
+#if defined BB_UNIQ
+FILE *xfopen(const char *path, const char *mode)
+{
+ FILE *fp;
+ if ((fp = fopen(path, mode)) == NULL)
+ fatalError("%s: %s\n", path, strerror(errno));
+ return fp;
+}
+#endif
+
/* END CODE */
/*
Local Variables: