Changed names of functions in utility.c and all affected files, to make
compliant with the style guide. Everybody rebuild your tags file!
This commit is contained in:
@@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv)
|
||||
argv++;
|
||||
|
||||
if (chroot(*argv) || (chdir("/"))) {
|
||||
fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
|
||||
error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno));
|
||||
}
|
||||
|
||||
argc--;
|
||||
@@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv)
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
fatalError("cannot execute %s: %s\n", prog, strerror(errno));
|
||||
error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -54,12 +54,12 @@ static void decompose_list(const char *list)
|
||||
/* the list must contain only digits and no more than one minus sign */
|
||||
for (ptr = (char *)list; *ptr; ptr++) {
|
||||
if (!isdigit(*ptr) && *ptr != '-') {
|
||||
fatalError("invalid byte or field list\n");
|
||||
error_msg_and_die("invalid byte or field list\n");
|
||||
}
|
||||
if (*ptr == '-') {
|
||||
nminus++;
|
||||
if (nminus > 1) {
|
||||
fatalError("invalid byte or field list\n");
|
||||
error_msg_and_die("invalid byte or field list\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ static void decompose_list(const char *list)
|
||||
if (nminus == 0) {
|
||||
startpos = strtol(list, &ptr, 10);
|
||||
if (startpos == 0) {
|
||||
fatalError("missing list of fields\n");
|
||||
error_msg_and_die("missing list of fields\n");
|
||||
}
|
||||
endpos = startpos;
|
||||
}
|
||||
@@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv)
|
||||
case 'f':
|
||||
/* make sure they didn't ask for two types of lists */
|
||||
if (part != 0) {
|
||||
fatalError("only one type of list may be specified");
|
||||
error_msg_and_die("only one type of list may be specified");
|
||||
}
|
||||
part = (char)opt;
|
||||
decompose_list(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
if (strlen(optarg) > 1) {
|
||||
fatalError("the delimiter must be a single character\n");
|
||||
error_msg_and_die("the delimiter must be a single character\n");
|
||||
}
|
||||
delim = optarg[0];
|
||||
break;
|
||||
@@ -209,16 +209,16 @@ extern int cut_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (part == 0) {
|
||||
fatalError("you must specify a list of bytes, characters, or fields\n");
|
||||
error_msg_and_die("you must specify a list of bytes, characters, or fields\n");
|
||||
}
|
||||
|
||||
if (supress_non_delimited_lines && part != 'f') {
|
||||
fatalError("suppressing non-delimited lines makes sense
|
||||
error_msg_and_die("suppressing non-delimited lines makes sense
|
||||
only when operating on fields\n");
|
||||
}
|
||||
|
||||
if (delim != '\t' && part != 'f') {
|
||||
fatalError("a delimiter may be specified only when operating on fields\n");
|
||||
error_msg_and_die("a delimiter may be specified only when operating on fields\n");
|
||||
}
|
||||
|
||||
/* argv[(optind)..(argc-1)] should be names of file to process. If no
|
||||
@@ -233,7 +233,7 @@ extern int cut_main(int argc, char **argv)
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
errorMsg("%s: %s\n", argv[i], strerror(errno));
|
||||
error_msg("%s: %s\n", argv[i], strerror(errno));
|
||||
} else {
|
||||
cut_file(file);
|
||||
fclose(file);
|
||||
|
||||
@@ -56,7 +56,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
||||
&(tm_time->tm_min), &(tm_time->tm_year));
|
||||
|
||||
if (nr < 4 || nr > 5) {
|
||||
fatalError(invalid_date, t_string);
|
||||
error_msg_and_die(invalid_date, t_string);
|
||||
}
|
||||
|
||||
/* correct for century - minor Y2K problem here? */
|
||||
@@ -121,7 +121,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
||||
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
|
||||
} else {
|
||||
fatalError(invalid_date, t_string);
|
||||
error_msg_and_die(invalid_date, t_string);
|
||||
}
|
||||
*tm_time = t;
|
||||
return (tm_time);
|
||||
@@ -156,7 +156,7 @@ int date_main(int argc, char **argv)
|
||||
case 'u':
|
||||
utc = 1;
|
||||
if (putenv("TZ=UTC0") != 0)
|
||||
fatalError(memory_exhausted);
|
||||
error_msg_and_die(memory_exhausted);
|
||||
break;
|
||||
case 'd':
|
||||
use_arg = 1;
|
||||
@@ -176,7 +176,7 @@ int date_main(int argc, char **argv)
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
errorMsg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
|
||||
error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
|
||||
usage(date_usage);
|
||||
}
|
||||
#endif
|
||||
@@ -205,16 +205,16 @@ int date_main(int argc, char **argv)
|
||||
/* Correct any day of week and day of year etc fields */
|
||||
tm = mktime(&tm_time);
|
||||
if (tm < 0)
|
||||
fatalError(invalid_date, date_str);
|
||||
error_msg_and_die(invalid_date, date_str);
|
||||
if ( utc ) {
|
||||
if (putenv("TZ=UTC0") != 0)
|
||||
fatalError(memory_exhausted);
|
||||
error_msg_and_die(memory_exhausted);
|
||||
}
|
||||
|
||||
/* if setting time, set it */
|
||||
if (set_time) {
|
||||
if (stime(&tm) < 0) {
|
||||
perrorMsg("cannot set date");
|
||||
perror_msg("cannot set date");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,28 +71,28 @@ extern int dd_main(int argc, char **argv)
|
||||
else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0))
|
||||
outFile = ((strchr(*argv, '=')) + 1);
|
||||
else if (strncmp("count", *argv, 5) == 0) {
|
||||
count = getNum((strchr(*argv, '=')) + 1);
|
||||
count = atoi_w_units((strchr(*argv, '=')) + 1);
|
||||
if (count < 0) {
|
||||
errorMsg("Bad count value %s\n", *argv);
|
||||
error_msg("Bad count value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
} else if (strncmp(*argv, "bs", 2) == 0) {
|
||||
blockSize = getNum((strchr(*argv, '=')) + 1);
|
||||
blockSize = atoi_w_units((strchr(*argv, '=')) + 1);
|
||||
if (blockSize <= 0) {
|
||||
errorMsg("Bad block size value %s\n", *argv);
|
||||
error_msg("Bad block size value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
} else if (strncmp(*argv, "skip", 4) == 0) {
|
||||
skipBlocks = getNum((strchr(*argv, '=')) + 1);
|
||||
skipBlocks = atoi_w_units((strchr(*argv, '=')) + 1);
|
||||
if (skipBlocks <= 0) {
|
||||
errorMsg("Bad skip value %s\n", *argv);
|
||||
error_msg("Bad skip value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
|
||||
} else if (strncmp(*argv, "seek", 4) == 0) {
|
||||
seekBlocks = getNum((strchr(*argv, '=')) + 1);
|
||||
seekBlocks = atoi_w_units((strchr(*argv, '=')) + 1);
|
||||
if (seekBlocks <= 0) {
|
||||
errorMsg("Bad seek value %s\n", *argv);
|
||||
error_msg("Bad seek value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
} else if (strncmp(*argv, "conv", 4) == 0) {
|
||||
@@ -119,7 +119,7 @@ extern int dd_main(int argc, char **argv)
|
||||
* here anyways... */
|
||||
|
||||
/* free(buf); */
|
||||
fatalPerror("%s", inFile);
|
||||
perror_msg_and_die("%s", inFile);
|
||||
}
|
||||
|
||||
if (outFile == NULL)
|
||||
@@ -134,7 +134,7 @@ extern int dd_main(int argc, char **argv)
|
||||
|
||||
/* close(inFd);
|
||||
free(buf); */
|
||||
fatalPerror("%s", outFile);
|
||||
perror_msg_and_die("%s", outFile);
|
||||
}
|
||||
|
||||
lseek(inFd, (off_t) (skipBlocks * blockSize), SEEK_SET);
|
||||
@@ -146,13 +146,13 @@ extern int dd_main(int argc, char **argv)
|
||||
ibs=BUFSIZ;
|
||||
|
||||
while (totalSize > outTotal) {
|
||||
inCc = fullRead(inFd, buf, ibs);
|
||||
inCc = full_read(inFd, buf, ibs);
|
||||
inTotal += inCc;
|
||||
if ( (sync==TRUE) && (inCc>0) )
|
||||
while (inCc<ibs)
|
||||
buf[inCc++]='\0';
|
||||
|
||||
if ((outCc = fullWrite(outFd, buf, inCc)) < 1){
|
||||
if ((outCc = full_write(outFd, buf, inCc)) < 1){
|
||||
if (outCc < 0 ){
|
||||
perror("Error during write");
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ static int df(char *device, const char *mountPoint)
|
||||
long blocks_percent_used;
|
||||
|
||||
if (statfs(mountPoint, &s) != 0) {
|
||||
perrorMsg("%s", mountPoint);
|
||||
perror_msg("%s", mountPoint);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ extern int df_main(int argc, char **argv)
|
||||
usage(df_usage);
|
||||
}
|
||||
while (argc > 1) {
|
||||
if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
|
||||
errorMsg("%s: can't find mount point.\n", argv[1]);
|
||||
if ((mountEntry = find_mount_point(argv[1], mtab_file)) == 0) {
|
||||
error_msg("%s: can't find mount point.\n", argv[1]);
|
||||
status = EXIT_FAILURE;
|
||||
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
|
||||
status = EXIT_FAILURE;
|
||||
@@ -89,7 +89,7 @@ extern int df_main(int argc, char **argv)
|
||||
|
||||
mountTable = setmntent(mtab_file, "r");
|
||||
if (mountTable == 0) {
|
||||
perrorMsg("%s", mtab_file);
|
||||
perror_msg("%s", mtab_file);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ static long du(char *filename)
|
||||
}
|
||||
|
||||
if (len + strlen(name) + 1 > BUFSIZ) {
|
||||
errorMsg(name_too_long);
|
||||
error_msg(name_too_long);
|
||||
du_depth--;
|
||||
return 0;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ int du_main(int argc, char **argv)
|
||||
for (i=optind; i < argc; i++) {
|
||||
if ((sum = du(argv[i])) == 0)
|
||||
status = EXIT_FAILURE;
|
||||
if (sum && isDirectory(argv[i], FALSE, NULL)) {
|
||||
if (sum && is_directory(argv[i], FALSE, NULL)) {
|
||||
print_normal(sum, argv[i]);
|
||||
}
|
||||
reset_ino_dev_hashtable();
|
||||
@@ -166,7 +166,7 @@ int du_main(int argc, char **argv)
|
||||
return status;
|
||||
}
|
||||
|
||||
/* $Id: du.c,v 1.28 2000/12/06 15:56:31 kraai Exp $ */
|
||||
/* $Id: du.c,v 1.29 2000/12/07 19:56:48 markw Exp $ */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
|
||||
@@ -74,14 +74,14 @@ int expr_main (int argc, char **argv)
|
||||
VALUE *v;
|
||||
|
||||
if (argc == 1) {
|
||||
fatalError("too few arguments\n");
|
||||
error_msg_and_die("too few arguments\n");
|
||||
}
|
||||
|
||||
args = argv + 1;
|
||||
|
||||
v = eval ();
|
||||
if (*args)
|
||||
fatalError ("syntax error\n");
|
||||
error_msg_and_die ("syntax error\n");
|
||||
|
||||
if (v->type == integer)
|
||||
printf ("%d\n", v->u.i);
|
||||
@@ -216,7 +216,7 @@ static \
|
||||
int name (l, r) VALUE *l; VALUE *r; \
|
||||
{ \
|
||||
if (!toarith (l) || !toarith (r)) \
|
||||
fatalError ("non-numeric argument\n"); \
|
||||
error_msg_and_die ("non-numeric argument\n"); \
|
||||
return l->u.i op r->u.i; \
|
||||
}
|
||||
|
||||
@@ -224,9 +224,9 @@ int name (l, r) VALUE *l; VALUE *r; \
|
||||
int name (l, r) VALUE *l; VALUE *r; \
|
||||
{ \
|
||||
if (!toarith (l) || !toarith (r)) \
|
||||
fatalError ( "non-numeric argument\n"); \
|
||||
error_msg_and_die ( "non-numeric argument\n"); \
|
||||
if (r->u.i == 0) \
|
||||
fatalError ( "division by zero\n"); \
|
||||
error_msg_and_die ( "division by zero\n"); \
|
||||
return l->u.i op r->u.i; \
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ of a basic regular expression is not portable; it is being ignored",
|
||||
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
|
||||
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
|
||||
if (errmsg) {
|
||||
fatalError("%s\n", errmsg);
|
||||
error_msg_and_die("%s\n", errmsg);
|
||||
}
|
||||
|
||||
len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
|
||||
@@ -301,19 +301,19 @@ static VALUE *eval7 (void)
|
||||
VALUE *v;
|
||||
|
||||
if (!*args)
|
||||
fatalError ( "syntax error\n");
|
||||
error_msg_and_die ( "syntax error\n");
|
||||
|
||||
if (nextarg ("(")) {
|
||||
args++;
|
||||
v = eval ();
|
||||
if (!nextarg (")"))
|
||||
fatalError ( "syntax error\n");
|
||||
error_msg_and_die ( "syntax error\n");
|
||||
args++;
|
||||
return v;
|
||||
}
|
||||
|
||||
if (nextarg (")"))
|
||||
fatalError ( "syntax error\n");
|
||||
error_msg_and_die ( "syntax error\n");
|
||||
|
||||
return str_value (*args++);
|
||||
}
|
||||
@@ -327,7 +327,7 @@ static VALUE *eval6 (void)
|
||||
if (nextarg ("quote")) {
|
||||
args++;
|
||||
if (!*args)
|
||||
fatalError ( "syntax error\n");
|
||||
error_msg_and_die ( "syntax error\n");
|
||||
return str_value (*args++);
|
||||
}
|
||||
else if (nextarg ("length")) {
|
||||
|
||||
@@ -80,7 +80,7 @@ int head_main(int argc, char **argv)
|
||||
}
|
||||
head(len, fp);
|
||||
if (errno) {
|
||||
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
status = EXIT_FAILURE;
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ extern int id_main(int argc, char **argv)
|
||||
pwnam=my_getpwnam(user);
|
||||
grnam=my_getgrnam(group);
|
||||
if (gid == -1 || pwnam==-1 || grnam==-1) {
|
||||
fatalError("%s: No such user\n", user);
|
||||
error_msg_and_die("%s: No such user\n", user);
|
||||
}
|
||||
if (no_group)
|
||||
printf("%ld\n", pwnam);
|
||||
|
||||
@@ -55,9 +55,9 @@ static int fs_link(const char *link_DestName, const char *link_SrcName, const in
|
||||
strcpy(srcName, link_SrcName);
|
||||
|
||||
if (flag&LN_NODEREFERENCE)
|
||||
srcIsDir = isDirectory(srcName, TRUE, NULL);
|
||||
srcIsDir = is_directory(srcName, TRUE, NULL);
|
||||
else
|
||||
srcIsDir = isDirectory(srcName, FALSE, NULL);
|
||||
srcIsDir = is_directory(srcName, FALSE, NULL);
|
||||
|
||||
if ((srcIsDir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) {
|
||||
strcat(srcName, "/");
|
||||
|
||||
@@ -35,5 +35,5 @@ extern int logname_main(int argc, char **argv)
|
||||
puts(user);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
fatalError("no login name\n");
|
||||
error_msg_and_die("no login name\n");
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ static int my_stat(struct dnode *cur)
|
||||
#ifdef BB_FEATURE_LS_FOLLOWLINKS
|
||||
if (follow_links == TRUE) {
|
||||
if (stat(cur->fullname, &cur->dstat)) {
|
||||
errorMsg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
error_msg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
status = EXIT_FAILURE;
|
||||
free(cur->fullname);
|
||||
free(cur);
|
||||
@@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur)
|
||||
} else
|
||||
#endif
|
||||
if (lstat(cur->fullname, &cur->dstat)) {
|
||||
errorMsg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
error_msg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
status = EXIT_FAILURE;
|
||||
free(cur->fullname);
|
||||
free(cur);
|
||||
@@ -511,7 +511,7 @@ struct dnode **list_dir(char *path)
|
||||
nfiles= 0;
|
||||
dir = opendir(path);
|
||||
if (dir == NULL) {
|
||||
errorMsg("%s: %s\n", path, strerror(errno));
|
||||
error_msg("%s: %s\n", path, strerror(errno));
|
||||
status = EXIT_FAILURE;
|
||||
return(NULL); /* could not open the dir */
|
||||
}
|
||||
@@ -591,7 +591,7 @@ int list_single(struct dnode *dn)
|
||||
column += 5;
|
||||
break;
|
||||
case LIST_MODEBITS:
|
||||
fprintf(stdout, "%10s", (char *)modeString(dn->dstat.st_mode));
|
||||
fprintf(stdout, "%10s", (char *)mode_string(dn->dstat.st_mode));
|
||||
column += 10;
|
||||
break;
|
||||
case LIST_NLINKS:
|
||||
|
||||
@@ -651,13 +651,13 @@ static int md5_file(const char *filename,
|
||||
} else {
|
||||
fp = fopen(filename, OPENOPTS(binary));
|
||||
if (fp == NULL) {
|
||||
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (md5_stream(fp, md5_result)) {
|
||||
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
@@ -665,7 +665,7 @@ static int md5_file(const char *filename,
|
||||
}
|
||||
|
||||
if (fp != stdin && fclose(fp) == EOF) {
|
||||
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name)
|
||||
} else {
|
||||
checkfile_stream = fopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL) {
|
||||
errorMsg("%s: %s\n", checkfile_name, strerror(errno));
|
||||
error_msg("%s: %s\n", checkfile_name, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -722,7 +722,7 @@ static int md5_check(const char *checkfile_name)
|
||||
if (split_3(line, line_length, &md5num, &binary, &filename)
|
||||
|| !hex_digits(md5num)) {
|
||||
if (warn) {
|
||||
errorMsg("%s: %lu: improperly formatted MD5 checksum line\n",
|
||||
error_msg("%s: %lu: improperly formatted MD5 checksum line\n",
|
||||
checkfile_name, (unsigned long) line_number);
|
||||
}
|
||||
} else {
|
||||
@@ -770,18 +770,18 @@ static int md5_check(const char *checkfile_name)
|
||||
free(line);
|
||||
|
||||
if (ferror(checkfile_stream)) {
|
||||
errorMsg("%s: read error\n", checkfile_name); /* */
|
||||
error_msg("%s: read error\n", checkfile_name); /* */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) {
|
||||
errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
|
||||
error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (n_properly_formated_lines == 0) {
|
||||
/* Warn if no tests are found. */
|
||||
errorMsg("%s: no properly formatted MD5 checksum lines found\n",
|
||||
error_msg("%s: no properly formatted MD5 checksum lines found\n",
|
||||
checkfile_name);
|
||||
return FALSE;
|
||||
} else {
|
||||
@@ -790,13 +790,13 @@ static int md5_check(const char *checkfile_name)
|
||||
- n_open_or_read_failures);
|
||||
|
||||
if (n_open_or_read_failures > 0) {
|
||||
errorMsg("WARNING: %d of %d listed files could not be read\n",
|
||||
error_msg("WARNING: %d of %d listed files could not be read\n",
|
||||
n_open_or_read_failures, n_properly_formated_lines);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (n_mismatched_checksums > 0) {
|
||||
errorMsg("WARNING: %d of %d computed checksums did NOT match\n",
|
||||
error_msg("WARNING: %d of %d computed checksums did NOT match\n",
|
||||
n_mismatched_checksums, n_computed_checkums);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -861,22 +861,22 @@ int md5sum_main(int argc,
|
||||
}
|
||||
|
||||
if (file_type_specified && do_check) {
|
||||
errorMsg("the -b and -t options are meaningless when verifying checksums\n");
|
||||
error_msg("the -b and -t options are meaningless when verifying checksums\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (n_strings > 0 && do_check) {
|
||||
errorMsg("the -g and -c options are mutually exclusive\n");
|
||||
error_msg("the -g and -c options are mutually exclusive\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (status_only && !do_check) {
|
||||
errorMsg("the -s option is meaningful only when verifying checksums\n");
|
||||
error_msg("the -s option is meaningful only when verifying checksums\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (warn && !do_check) {
|
||||
errorMsg("the -w option is meaningful only when verifying checksums\n");
|
||||
error_msg("the -w option is meaningful only when verifying checksums\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ int md5sum_main(int argc,
|
||||
size_t i;
|
||||
|
||||
if (optind < argc) {
|
||||
errorMsg("no files may be specified when using -g\n");
|
||||
error_msg("no files may be specified when using -g\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
for (i = 0; i < n_strings; ++i) {
|
||||
@@ -898,7 +898,7 @@ int md5sum_main(int argc,
|
||||
}
|
||||
} else if (do_check) {
|
||||
if (optind + 1 < argc) {
|
||||
errorMsg("only one argument may be specified when using -c\n");
|
||||
error_msg("only one argument may be specified when using -c\n");
|
||||
}
|
||||
|
||||
err = md5_check ((optind == argc) ? "-" : argv[optind]);
|
||||
@@ -951,12 +951,12 @@ int md5sum_main(int argc,
|
||||
}
|
||||
|
||||
if (fclose (stdout) == EOF) {
|
||||
errorMsg("write error\n");
|
||||
error_msg("write error\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF) {
|
||||
errorMsg("standard input\n");
|
||||
error_msg("standard input\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ extern int mkdir_main(int argc, char **argv)
|
||||
/* Find the specified modes */
|
||||
mode = 0;
|
||||
if (parse_mode(*(++argv), &mode) == FALSE) {
|
||||
errorMsg("Unknown mode: %s\n", *argv);
|
||||
error_msg("Unknown mode: %s\n", *argv);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
/* Set the umask for this process so it doesn't
|
||||
@@ -79,18 +79,18 @@ extern int mkdir_main(int argc, char **argv)
|
||||
char buf[BUFSIZ + 1];
|
||||
|
||||
if (strlen(*argv) > BUFSIZ - 1) {
|
||||
errorMsg(name_too_long);
|
||||
error_msg(name_too_long);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
strcpy(buf, *argv);
|
||||
status = stat(buf, &statBuf);
|
||||
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
|
||||
errorMsg("%s: File exists\n", buf);
|
||||
error_msg("%s: File exists\n", buf);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (parentFlag == TRUE) {
|
||||
strcat(buf, "/");
|
||||
createPath(buf, mode);
|
||||
create_path(buf, mode);
|
||||
} else {
|
||||
if (mkdir(buf, mode) != 0 && parentFlag == FALSE) {
|
||||
perror(buf);
|
||||
|
||||
@@ -84,7 +84,7 @@ int mknod_main(int argc, char **argv)
|
||||
mode |= perm;
|
||||
|
||||
if (mknod(argv[0], mode, dev) != 0)
|
||||
fatalError("%s: %s\n", argv[0], strerror(errno));
|
||||
error_msg_and_die("%s: %s\n", argv[0], strerror(errno));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv)
|
||||
char buf[BUFSIZ + 1];
|
||||
|
||||
if (getcwd(buf, sizeof(buf)) == NULL)
|
||||
fatalError("%s\n", strerror(errno));
|
||||
error_msg_and_die("%s\n", strerror(errno));
|
||||
|
||||
printf("%s\n", buf);
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -37,7 +37,7 @@ static const char *srcName;
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
if (unlink(fileName) < 0) {
|
||||
perrorMsg("%s", fileName);
|
||||
perror_msg("%s", fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
@@ -47,11 +47,11 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
if (recursiveFlag == FALSE) {
|
||||
errno = EISDIR;
|
||||
perrorMsg("%s", fileName);
|
||||
perror_msg("%s", fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
if (rmdir(fileName) < 0) {
|
||||
perrorMsg("%s", fileName);
|
||||
perror_msg("%s", fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
@@ -101,7 +101,7 @@ extern int rm_main(int argc, char **argv)
|
||||
&& errno == ENOENT) {
|
||||
/* do not reports errors for non-existent files if -f, just skip them */
|
||||
} else {
|
||||
if (recursiveAction(srcName, recursiveFlag, FALSE,
|
||||
if (recursive_action(srcName, recursiveFlag, FALSE,
|
||||
TRUE, fileAction, dirAction, NULL) == FALSE) {
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ extern int rmdir_main(int argc, char **argv)
|
||||
|
||||
while (--argc > 0) {
|
||||
if (rmdir(*(++argv)) == -1) {
|
||||
perrorMsg("%s", *argv);
|
||||
perror_msg("%s", *argv);
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ int sort_main(int argc, char **argv)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
errorMsg("invalid option -- %c\n", opt);
|
||||
error_msg("invalid option -- %c\n", opt);
|
||||
usage(sort_usage);
|
||||
}
|
||||
} else {
|
||||
@@ -286,4 +286,4 @@ int sort_main(int argc, char **argv)
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* $Id: sort.c,v 1.23 2000/09/28 17:49:59 beppu Exp $ */
|
||||
/* $Id: sort.c,v 1.24 2000/12/07 19:56:48 markw Exp $ */
|
||||
|
||||
@@ -225,7 +225,7 @@ int tail_main(int argc, char **argv)
|
||||
usage(tail_usage);
|
||||
break;
|
||||
default:
|
||||
errorMsg("\nUnknown arg: %c.\n\n",optopt);
|
||||
error_msg("\nUnknown arg: %c.\n\n",optopt);
|
||||
usage(tail_usage);
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ int tail_main(int argc, char **argv)
|
||||
else
|
||||
fd[test] = open(files[test], O_RDONLY);
|
||||
if (fd[test] == -1)
|
||||
fatalError("Unable to open file %s.\n", files[test]);
|
||||
error_msg_and_die("Unable to open file %s.\n", files[test]);
|
||||
tail_stream(fd[test]);
|
||||
|
||||
bs=BUFSIZ;
|
||||
|
||||
@@ -47,7 +47,7 @@ tee_main(int argc, char **argv)
|
||||
while (optind < argc) {
|
||||
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
|
||||
nfiles--;
|
||||
errorMsg("%s: %s\n", argv[optind-1], strerror(errno));
|
||||
error_msg("%s: %s\n", argv[optind-1], strerror(errno));
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ test_main(int argc, char** argv)
|
||||
|
||||
if (strcmp(applet_name, "[") == 0) {
|
||||
if (strcmp(argv[--argc], "]"))
|
||||
fatalError("missing ]\n");
|
||||
error_msg_and_die("missing ]\n");
|
||||
argv[argc] = NULL;
|
||||
}
|
||||
/* Implement special cases from POSIX.2, section 4.62.4 */
|
||||
@@ -233,9 +233,9 @@ syntax(op, msg)
|
||||
char *msg;
|
||||
{
|
||||
if (op && *op)
|
||||
fatalError("%s: %s\n", op, msg);
|
||||
error_msg_and_die("%s: %s\n", op, msg);
|
||||
else
|
||||
fatalError("%s\n", msg);
|
||||
error_msg_and_die("%s\n", msg);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -470,13 +470,13 @@ getn(s)
|
||||
r = strtol(s, &p, 10);
|
||||
|
||||
if (errno != 0)
|
||||
fatalError("%s: out of range\n", s);
|
||||
error_msg_and_die("%s: out of range\n", s);
|
||||
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
|
||||
if (*p)
|
||||
fatalError("%s: bad number\n", s);
|
||||
error_msg_and_die("%s: bad number\n", s);
|
||||
|
||||
return (int) r;
|
||||
}
|
||||
|
||||
@@ -58,12 +58,12 @@ extern int touch_main(int argc, char **argv)
|
||||
if (create == FALSE && errno == ENOENT)
|
||||
return EXIT_SUCCESS;
|
||||
else {
|
||||
fatalError("%s", strerror(errno));
|
||||
error_msg_and_die("%s", strerror(errno));
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
if (utime(*argv, NULL)) {
|
||||
fatalError("%s", strerror(errno));
|
||||
error_msg_and_die("%s", strerror(errno));
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
@@ -173,7 +173,7 @@ extern int tr_main(int argc, char **argv)
|
||||
input_length = complement(input, input_length);
|
||||
if (argv[index] != NULL) {
|
||||
if (*argv[index] == '\0')
|
||||
fatalError("STRING2 cannot be empty\n");
|
||||
error_msg_and_die("STRING2 cannot be empty\n");
|
||||
output_length = expand(argv[index], output);
|
||||
map(input, input_length, output, output_length);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ static int read_stduu (const char *inname)
|
||||
char *p;
|
||||
|
||||
if (fgets (buf, sizeof(buf), stdin) == NULL) {
|
||||
errorMsg("%s: Short file\n", inname);
|
||||
error_msg("%s: Short file\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
p = buf;
|
||||
@@ -78,7 +78,7 @@ static int read_stduu (const char *inname)
|
||||
|
||||
if (fgets (buf, sizeof(buf), stdin) == NULL
|
||||
|| strcmp (buf, "end\n")) {
|
||||
errorMsg("%s: No `end' line\n", inname);
|
||||
error_msg("%s: No `end' line\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ static int read_base64 (const char *inname)
|
||||
unsigned char *p;
|
||||
|
||||
if (fgets (buf, sizeof(buf), stdin) == NULL) {
|
||||
errorMsg("%s: Short file\n", inname);
|
||||
error_msg("%s: Short file\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
p = buf;
|
||||
@@ -136,7 +136,7 @@ static int read_base64 (const char *inname)
|
||||
if (memcmp (buf, "====", 4) == 0)
|
||||
break;
|
||||
if (last_data != 0) {
|
||||
errorMsg("%s: data following `=' padding character\n", inname);
|
||||
error_msg("%s: data following `=' padding character\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -158,14 +158,14 @@ static int read_base64 (const char *inname)
|
||||
|
||||
while ((b64_tab[*p] & '\100') != 0)
|
||||
if (*p == '\n' || *p++ == '=') {
|
||||
errorMsg("%s: illegal line\n", inname);
|
||||
error_msg("%s: illegal line\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
c2 = b64_tab[*p++];
|
||||
|
||||
while (b64_tab[*p] == '\177')
|
||||
if (*p++ == '\n') {
|
||||
errorMsg("%s: illegal line\n", inname);
|
||||
error_msg("%s: illegal line\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
if (*p == '=') {
|
||||
@@ -177,7 +177,7 @@ static int read_base64 (const char *inname)
|
||||
|
||||
while (b64_tab[*p] == '\177')
|
||||
if (*p++ == '\n') {
|
||||
errorMsg("%s: illegal line\n", inname);
|
||||
error_msg("%s: illegal line\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
putchar (c1 << 2 | c2 >> 4);
|
||||
@@ -209,7 +209,7 @@ static int decode (const char *inname,
|
||||
|
||||
while (1) {
|
||||
if (fgets (buf, sizeof (buf), stdin) == NULL) {
|
||||
errorMsg("%s: No `begin' line\n", inname);
|
||||
error_msg("%s: No `begin' line\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -234,13 +234,13 @@ static int decode (const char *inname,
|
||||
while (*p != '/')
|
||||
++p;
|
||||
if (*p == '\0') {
|
||||
errorMsg("%s: Illegal ~user\n", inname);
|
||||
error_msg("%s: Illegal ~user\n", inname);
|
||||
return FALSE;
|
||||
}
|
||||
*p++ = '\0';
|
||||
pw = getpwnam (buf + 1);
|
||||
if (pw == NULL) {
|
||||
errorMsg("%s: No user `%s'\n", inname, buf + 1);
|
||||
error_msg("%s: No user `%s'\n", inname, buf + 1);
|
||||
return FALSE;
|
||||
}
|
||||
n = strlen (pw->pw_dir);
|
||||
@@ -257,7 +257,7 @@ static int decode (const char *inname,
|
||||
&& (freopen (outname, "w", stdout) == NULL
|
||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||
)) {
|
||||
errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||
error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ int uudecode_main (int argc,
|
||||
if (decode (argv[optind], outname) != 0)
|
||||
exit_status = FALSE;
|
||||
} else {
|
||||
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
exit_status = EXIT_FAILURE;
|
||||
}
|
||||
optind++;
|
||||
|
||||
@@ -142,7 +142,7 @@ static void encode()
|
||||
}
|
||||
|
||||
if (ferror (stdin))
|
||||
errorMsg("Read error\n");
|
||||
error_msg("Read error\n");
|
||||
|
||||
if (trans_ptr == uu_std) {
|
||||
putchar (ENC ('\0'));
|
||||
@@ -178,7 +178,7 @@ int uuencode_main (int argc,
|
||||
case 2:
|
||||
/* Optional first argument is input file. */
|
||||
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
||||
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
@@ -199,7 +199,7 @@ int uuencode_main (int argc,
|
||||
encode();
|
||||
printf(trans_ptr == uu_std ? "end\n" : "====\n");
|
||||
if (ferror (stdout)) {
|
||||
errorMsg("Write error\n");
|
||||
error_msg("Write error\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -37,5 +37,5 @@ extern int whoami_main(int argc, char **argv)
|
||||
puts(user);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
fatalError("cannot find username for UID %u\n", (unsigned) uid);
|
||||
error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user