struct group *grp;
if (*name == '\0')
- error (1, 0, _("cannot change to null group"));
+ error (EXIT_FAILURE, 0, _("cannot change to null group"));
grp = getgrnam (name);
if (grp == NULL)
unsigned long int tmp_long;
if (!ISDIGIT (*name))
- error (1, 0, _("invalid group name %s"), quote (name));
+ error (EXIT_FAILURE, 0, _("invalid group name %s"), quote (name));
s_err = xstrtoul (name, NULL, 0, &tmp_long, NULL);
if (s_err != LONGINT_OK)
STRTOL_FATAL_ERROR (name, _("group number"), s_err);
if (tmp_long > MAXGID)
- error (1, 0, _("invalid group number %s"), quote (name));
+ error (EXIT_FAILURE, 0, _("invalid group number %s"), quote (name));
*g = tmp_long;
}
{
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
- error (1, errno, _("failed to get attributes of %s"),
+ error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quote (reference_file));
chopt.group_name = gid_to_name (ref_stats.st_gid);
/* chmod -- change permission modes of files
- Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation, Inc.
+ Copyright (C) 89, 90, 91, 1995-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
static char char_string[2] = {0, 0};
char_string[0] = c;
- error (1, 0, _("invalid character %s in mode string %s"),
+ error (EXIT_FAILURE, 0, _("invalid character %s in mode string %s"),
quote_n (0, char_string), quote_n (1, argv[thisind]));
}
modeind = thisind;
: mode_compile (argv[modeind], MODE_MASK_ALL));
if (changes == MODE_INVALID)
- error (1, 0, _("invalid mode string: %s"), quote (argv[modeind]));
+ error (EXIT_FAILURE, 0,
+ _("invalid mode string: %s"), quote (argv[modeind]));
else if (changes == MODE_MEMORY_EXHAUSTED)
xalloc_die ();
else if (changes == MODE_BAD_REFERENCE)
- error (1, errno, _("failed to get attributes of %s"),
+ error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quote (reference_file));
for (; optind < argc; ++optind)
&old_uid, &old_gid,
&u_dummy, &g_dummy);
if (e)
- error (1, 0, "%s: %s", quote (optarg), e);
+ error (EXIT_FAILURE, 0, "%s: %s", quote (optarg), e);
break;
}
case 'R':
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
- error (1, errno, _("failed to get attributes of %s"),
+ error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quote (reference_file));
uid = ref_stats.st_uid;
const char *e = parse_user_spec (argv[optind], &uid, &gid,
&chopt.user_name, &chopt.group_name);
if (e)
- error (1, 0, "%s: %s", quote (argv[optind]), e);
+ error (EXIT_FAILURE, 0, "%s: %s", quote (argv[optind]), e);
/* FIXME: set it to the empty string? */
if (chopt.user_name == NULL)
/* chroot -- run command or shell with special root directory
- Copyright (C) 95, 96, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 95, 96, 1997, 1999-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
if (chroot (argv[1]))
- error (1, errno, _("cannot change root directory to %s"), argv[1]);
+ error (EXIT_FAILURE, errno,
+ _("cannot change root directory to %s"), argv[1]);
if (chdir ("/"))
- error (1, errno, _("cannot chdir to root directory"));
+ error (EXIT_FAILURE, errno, _("cannot chdir to root directory"));
if (argc == 2)
{
#ifdef S_ISLNK
x.symbolic_link = 1;
#else
- error (1, 0, _("symbolic links are not supported on this system"));
+ error (EXIT_FAILURE, 0,
+ _("symbolic links are not supported on this system"));
#endif
break;
in_stream = fopen (input_filename, "r");
if (in_stream == NULL)
{
- error (1, errno, "`%s'", input_filename);
+ error (EXIT_FAILURE, errno, "`%s'", input_filename);
}
}
if (reference != NULL)
{
if (stat (reference, &refstats))
- error (1, errno, "%s", reference);
+ error (EXIT_FAILURE, errno, "%s", reference);
when.tv_sec = refstats.st_mtime;
when.tv_nsec = TIMESPEC_NS (refstats.st_mtim);
}
}
if (! valid_date)
- error (1, 0, _("invalid date `%s'"), datestr);
+ error (EXIT_FAILURE, 0, _("invalid date `%s'"), datestr);
if (set_date)
{
{
print_stats ();
if (close (STDIN_FILENO) < 0)
- error (1, errno, _("closing input file %s"), quote (input_file));
+ error (EXIT_FAILURE, errno,
+ _("closing input file %s"), quote (input_file));
if (close (STDOUT_FILENO) < 0)
- error (1, errno, _("closing output file %s"), quote (output_file));
+ error (EXIT_FAILURE, errno,
+ _("closing output file %s"), quote (output_file));
}
static inline void
}
if (invalid)
- error (1, 0, _("invalid number %s"), quote (val));
+ error (EXIT_FAILURE, 0, _("invalid number %s"), quote (val));
}
}
|| (MX (C_LCASE | C_UCASE) > 1)
|| (MX (C_UNBLOCK | C_SYNC) > 1))
{
- error (1, 0, _("\
+ error (EXIT_FAILURE, 0, _("\
only one conv in {ascii,ebcdic,ibm}, {lcase,ucase}, {block,unblock}, {unblock,sync}"));
}
#undef MX
if (input_file != NULL)
{
if (open_fd (STDIN_FILENO, input_file, O_RDONLY, 0) < 0)
- error (1, errno, _("opening %s"), quote (input_file));
+ error (EXIT_FAILURE, errno, _("opening %s"), quote (input_file));
}
else
input_file = _("standard input");
if ((! seek_records
|| open_fd (STDOUT_FILENO, output_file, O_RDWR | opts, perms) < 0)
&& open_fd (STDOUT_FILENO, output_file, O_WRONLY | opts, perms) < 0)
- error (1, errno, _("opening %s"), quote (output_file));
+ error (EXIT_FAILURE, errno, _("opening %s"), quote (output_file));
#if HAVE_FTRUNCATE
if (seek_records != 0 && !(conversions_mask & C_NOTRUNC))
struct stat stdout_stat;
off_t o = seek_records * output_blocksize;
if (o / output_blocksize != seek_records)
- error (1, 0, _("file offset out of range"));
+ error (EXIT_FAILURE, 0, _("file offset out of range"));
if (fstat (STDOUT_FILENO, &stdout_stat) != 0)
- error (1, errno, _("cannot fstat %s"), quote (output_file));
+ error (EXIT_FAILURE, errno, _("cannot fstat %s"), quote (output_file));
/* Complain only when ftruncate fails on a regular file, a
directory, or a shared memory object, as the 2000-08
|| S_TYPEISSHM (&stdout_stat)))
{
char buf[LONGEST_HUMAN_READABLE + 1];
- error (1, errno, _("advancing past %s bytes in output file %s"),
+ error (EXIT_FAILURE, errno,
+ _("advancing past %s bytes in output file %s"),
human_readable (o, buf, 1, 1),
quote (output_file));
}
}
else if (chdir ("..") < 0)
{
- error (1, errno, _("cannot change to `..' from directory %s"),
+ error (EXIT_FAILURE, errno, _("cannot change to `..' from directory %s"),
quote (curr_dir_name));
}
}
case MAX_DEPTH_OPTION: /* --max-depth=N */
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid maximum depth %s"), quote (optarg));
+ error (EXIT_FAILURE, 0, _("invalid maximum depth %s"), quote (optarg));
max_depth_specified = 1;
max_depth = (int) tmp_long;
case 'X':
if (add_exclude_file (add_exclude, exclude, optarg,
EXCLUDE_WILDCARDS, '\n'))
- error (1, errno, "%s", quote (optarg));
+ error (EXIT_FAILURE, errno, "%s", quote (optarg));
break;
case EXCLUDE_OPTION:
/* Set hostname to argv[1]. */
err = sethostname (argv[1], strlen (argv[1]));
if (err != 0)
- error (1, errno, _("cannot set hostname to `%s'"), argv[1]);
+ error (EXIT_FAILURE, errno, _("cannot set hostname to `%s'"), argv[1]);
exit (0);
}
#else
if (argc == 2)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("cannot set hostname; this system lacks the functionality"));
#endif
{
hostname = xgethostname ();
if (hostname == NULL)
- error (1, errno, _("cannot determine hostname"));
+ error (EXIT_FAILURE, errno, _("cannot determine hostname"));
printf ("%s\n", hostname);
}
else
/* id -- print real and effective UIDs and GIDs
- Copyright (C) 1989-2001 Free Software Foundation, Inc.
+ Copyright (C) 1989-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
if (just_user + just_group + just_group_list > 1)
- error (1, 0, _("cannot print only user and only group"));
+ error (EXIT_FAILURE, 0, _("cannot print only user and only group"));
if (just_user + just_group + just_group_list == 0 && (use_real || use_name))
- error (1, 0, _("cannot print only names or real IDs in default format"));
+ error (EXIT_FAILURE, 0,
+ _("cannot print only names or real IDs in default format"));
if (argc - optind > 1)
usage (1);
{
struct passwd *pwd = getpwnam (argv[optind]);
if (pwd == NULL)
- error (1, 0, _("%s: No such user"), argv[optind]);
+ error (EXIT_FAILURE, 0, _("%s: No such user"), argv[optind]);
ruid = euid = pwd->pw_uid;
rgid = egid = pwd->pw_gid;
}
/* Check for invalid combinations of arguments. */
if (dir_arg && strip_files)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("the strip option may not be used when installing a directory"));
if (backup_suffix_string)
{
struct mode_change *change = mode_compile (specified_mode, 0);
if (change == MODE_INVALID)
- error (1, 0, _("invalid mode %s"), quote (specified_mode));
+ error (EXIT_FAILURE, 0, _("invalid mode %s"), quote (specified_mode));
else if (change == MODE_MEMORY_EXHAUSTED)
xalloc_die ();
mode = mode_adjust (0, change);
switch (pid)
{
case -1:
- error (1, errno, _("fork system call failed"));
+ error (EXIT_FAILURE, errno, _("fork system call failed"));
break;
case 0: /* Child. */
execlp ("strip", "strip", path, NULL);
- error (1, errno, _("cannot run strip"));
+ error (EXIT_FAILURE, errno, _("cannot run strip"));
break;
default: /* Parent. */
/* Parent process. */
while (pid != wait (&status)) /* Wait for kid to finish. */
/* Do nothing. */ ;
if (status)
- error (1, 0, _("strip failed"));
+ error (EXIT_FAILURE, 0, _("strip failed"));
break;
}
}
long int tmp_long;
if (xstrtol (owner_name, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > UID_T_MAX)
- error (1, 0, _("invalid user %s"), quote (owner_name));
+ error (EXIT_FAILURE, 0, _("invalid user %s"), quote (owner_name));
owner_id = (uid_t) tmp_long;
}
else
long int tmp_long;
if (xstrtol (group_name, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > GID_T_MAX)
- error (1, 0, _("invalid group %s"), quote (group_name));
+ error (EXIT_FAILURE, 0, _("invalid group %s"), quote (group_name));
group_id = (gid_t) tmp_long;
}
else
#ifdef S_ISLNK
symbolic_link = 1;
#else
- error (1, 0, _("symbolic links are not supported on this system"));
+ error (EXIT_FAILURE, 0,
+ _("symbolic links are not supported on this system"));
#endif
break;
case TARGET_DIRECTORY_OPTION:
: n_files - 2);
if (!target_directory_specified && !dest_is_dir)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("when making multiple links, last argument must be a directory"));
for (i = 0; i <= last_file_idx; ++i)
errors += do_link (file[i], target_directory);
struct mode_change *change = mode_compile (specified_mode, 0);
newmode &= ~ umask (0);
if (change == MODE_INVALID)
- error (1, 0, _("invalid mode %s"), quote (specified_mode));
+ error (EXIT_FAILURE, 0, _("invalid mode %s"), quote (specified_mode));
else if (change == MODE_MEMORY_EXHAUSTED)
xalloc_die ();
newmode = mode_adjust (newmode, change);
newmode &= ~ umask (0);
change = mode_compile (specified_mode, 0);
if (change == MODE_INVALID)
- error (1, 0, _("invalid mode"));
+ error (EXIT_FAILURE, 0, _("invalid mode"));
else if (change == MODE_MEMORY_EXHAUSTED)
xalloc_die ();
newmode = mode_adjust (newmode, change);
/* mknod -- make special files
- Copyright (C) 90, 91, 1995-2001 Free Software Foundation, Inc.
+ Copyright (C) 90, 91, 1995-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
newmode &= ~ umask (0);
change = mode_compile (specified_mode, 0);
if (change == MODE_INVALID)
- error (1, 0, _("invalid mode"));
+ error (EXIT_FAILURE, 0, _("invalid mode"));
else if (change == MODE_MEMORY_EXHAUSTED)
xalloc_die ();
newmode = mode_adjust (newmode, change);
if (xstrtoumax (s_major, NULL, 0, &i_major, NULL) != LONGINT_OK
|| i_major != (major_t) i_major)
- error (1, 0, _("invalid major device number %s"), quote (s_major));
+ error (EXIT_FAILURE, 0,
+ _("invalid major device number %s"), quote (s_major));
if (xstrtoumax (s_minor, NULL, 0, &i_minor, NULL) != LONGINT_OK
|| i_minor != (minor_t) i_minor)
- error (1, 0, _("invalid minor device number %s"), quote (s_minor));
+ error (EXIT_FAILURE, 0,
+ _("invalid minor device number %s"), quote (s_minor));
device = makedev (i_major, i_minor);
#ifdef NODEV
if (device == NODEV)
- error (1, 0, _("invalid device %s %s"), s_major, s_minor);
+ error (EXIT_FAILURE, 0, _("invalid device %s %s"), s_major, s_minor);
#endif
if (mknod (argv[optind], newmode | node_type, device) != 0)
- error (1, errno, "%s", quote (argv[optind]));
+ error (EXIT_FAILURE, errno, "%s", quote (argv[optind]));
}
break;
usage (1);
}
if (mkfifo (argv[optind], newmode))
- error (1, errno, "%s", quote (argv[optind]));
+ error (EXIT_FAILURE, errno, "%s", quote (argv[optind]));
#endif
break;
&& posix2_version () < 200112)
{
if (xstrtol (&s[2], NULL, 10, &adjustment, "") != LONGINT_OK)
- error (1, 0, _("invalid option `%s'"), s);
+ error (EXIT_FAILURE, 0, _("invalid option `%s'"), s);
minusflag = 1;
adjustment_given = 1;
if (s[1] == '+')
++s;
if (xstrtol (&s[1], NULL, 10, &adjustment, "") != LONGINT_OK)
- error (1, 0, _("invalid option `%s'"), s);
+ error (EXIT_FAILURE, 0, _("invalid option `%s'"), s);
minusflag = 0;
adjustment_given = 1;
case 'n':
if (xstrtol (optarg, NULL, 10, &adjustment, "")
!= LONGINT_OK)
- error (1, 0, _("invalid priority `%s'"), optarg);
+ error (EXIT_FAILURE, 0, _("invalid priority `%s'"), optarg);
minusflag = 0;
adjustment_given = 1;
errno = 0;
current_priority = GET_PRIORITY ();
if (current_priority == -1 && errno != 0)
- error (1, errno, _("cannot get priority"));
+ error (EXIT_FAILURE, errno, _("cannot get priority"));
printf ("%d\n", current_priority);
exit (0);
}
errno = 0;
current_priority = GET_PRIORITY ();
if (current_priority == -1 && errno != 0)
- error (1, errno, _("cannot get priority"));
+ error (EXIT_FAILURE, errno, _("cannot get priority"));
if (setpriority (PRIO_PROCESS, 0, current_priority + adjustment))
#else
if (nice (adjustment) == -1)
#endif
- error (1, errno, _("cannot set priority"));
+ error (EXIT_FAILURE, errno, _("cannot set priority"));
execvp (argv[i], &argv[i]);
int fail = read_utmp (filename, &n_users, &utmp_buf);
if (fail)
- error (1, errno, "%s", filename);
+ error (EXIT_FAILURE, errno, "%s", filename);
scan_entries (n_users, utmp_buf, argc_names, argv_names);
}
++esc_length, ++p)
esc_value = esc_value * 16 + hextobin (*p);
if (esc_length == 0)
- error (1, 0, _("missing hexadecimal number in escape"));
+ error (EXIT_FAILURE, 0, _("missing hexadecimal number in escape"));
putchar (esc_value);
}
else if (*p == '0')
--esc_length, ++p)
{
if (!ISXDIGIT (*p))
- error (1, 0, _("missing hexadecimal number in escape"));
+ error (EXIT_FAILURE, 0, _("missing hexadecimal number in escape"));
uni_value = uni_value * 16 + hextobin (*p);
}
if ((uni_value >= 0x00 && uni_value <= 0x9f
&& uni_value != 0x24 && uni_value != 0x40 && uni_value != 0x60)
|| (uni_value >= 0xd800 && uni_value <= 0xdfff))
- error (1, 0, _("invalid universal character name \\%c%0*x"),
+ error (EXIT_FAILURE, 0, _("invalid universal character name \\%c%0*x"),
esc_char, (esc_char == 'u' ? 4 : 8), uni_value);
print_unicode_char (stdout, uni_value, 0);
}
else
- error (1, 0, _("\\%c: invalid escape"), *p);
+ error (EXIT_FAILURE, 0, _("\\%c: invalid escape"), *p);
return p - escstart - 1;
}
++direc_length;
}
if (!strchr ("diouxXfeEgGcs", *f))
- error (1, 0, _("%%%c: invalid directive"), *f);
+ error (EXIT_FAILURE, 0, _("%%%c: invalid directive"), *f);
++direc_length;
if (argc > 0)
{
wd = xgetcwd ();
if (wd == NULL)
- error (1, errno, _("cannot get current directory"));
+ error (EXIT_FAILURE, errno, _("cannot get current directory"));
printf ("%s\n", wd);
exit (0);
|| (word32) tmp != tmp
|| ((size_t) (tmp * sizeof (int)) / sizeof (int) != tmp))
{
- error (1, 0, _("%s: invalid number of passes"),
+ error (EXIT_FAILURE, 0, _("%s: invalid number of passes"),
quotearg_colon (optarg));
}
flags.n_iterations = (size_t) tmp;
if (xstrtoumax (optarg, NULL, 0, &tmp, "cbBkKMGTPEZY0")
!= LONGINT_OK)
{
- error (1, 0, _("%s: invalid file size"),
+ error (EXIT_FAILURE, 0, _("%s: invalid file size"),
quotearg_colon (optarg));
}
flags.size = tmp;
#endif
if (fail)
- error (1, errno, _("cannot read realtime clock"));
+ error (EXIT_FAILURE, errno, _("cannot read realtime clock"));
return ts;
}
/* stty -- change and print terminal line settings
- Copyright (C) 1990-2001 Free Software Foundation, Inc.
+ Copyright (C) 1990-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
device_name = file_name;
fd = open (device_name, O_RDONLY | O_NONBLOCK);
if (fd < 0)
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
if ((fdflags = fcntl (fd, F_GETFL)) == -1
|| fcntl (fd, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
- error (1, errno, _("%s: couldn't reset non-blocking mode"),
+ error (EXIT_FAILURE, errno, _("%s: couldn't reset non-blocking mode"),
device_name);
}
else
spurious difference in an uninitialized portion of the structure. */
memset (&mode, 0, sizeof (mode));
if (tcgetattr (fd, &mode))
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
if (verbose_output || recoverable_output || noargs)
{
struct termios new_mode;
if (tcsetattr (fd, TCSADRAIN, &mode))
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
/* POSIX (according to Zlotnick's book) tcsetattr returns zero if
it performs *any* of the requested operations. This means it
spurious difference in an uninitialized portion of the structure. */
memset (&new_mode, 0, sizeof (new_mode));
if (tcgetattr (fd, &new_mode))
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
/* Normally, one shouldn't use memcmp to compare structures that
may have `holes' containing uninitialized data, but we have been
if (speed_was_set || memcmp (&mode, &new_mode, sizeof (mode)) != 0)
#endif
{
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("%s: unable to perform all requested operations"),
device_name);
#ifdef TESTING
if (get_win_size (fd, &win))
{
if (errno != EINVAL)
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
memset (&win, 0, sizeof (win));
}
win.ws_col = 1;
if (ioctl (fd, TIOCSWINSZ, (char *) &win))
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
if (ioctl (fd, TIOCSSIZE, (char *) &ttysz))
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
return;
}
# endif
if (ioctl (fd, TIOCSWINSZ, (char *) &win))
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
}
static void
if (get_win_size (fd, &win))
{
if (errno != EINVAL)
- error (1, errno, "%s", device_name);
+ error (EXIT_FAILURE, errno, "%s", device_name);
if (!fancy)
- error (1, 0, _("%s: no size information for this device"), device_name);
+ error (EXIT_FAILURE, 0,
+ _("%s: no size information for this device"), device_name);
}
else
{
#ifdef HAVE_INITGROUPS
errno = 0;
if (initgroups (pw->pw_name, pw->pw_gid) == -1)
- error (1, errno, _("cannot set groups"));
+ error (EXIT_FAILURE, errno, _("cannot set groups"));
endgrent ();
#endif
if (setgid (pw->pw_gid))
- error (1, errno, _("cannot set group id"));
+ error (EXIT_FAILURE, errno, _("cannot set group id"));
if (setuid (pw->pw_uid))
- error (1, errno, _("cannot set user id"));
+ error (EXIT_FAILURE, errno, _("cannot set user id"));
}
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
pw = getpwnam (new_user);
if (pw == 0)
- error (1, 0, _("user %s does not exist"), new_user);
+ error (EXIT_FAILURE, 0, _("user %s does not exist"), new_user);
endpwent ();
/* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER
#ifdef SYSLOG_FAILURE
log_su (pw, 0);
#endif
- error (1, 0, _("incorrect password"));
+ error (EXIT_FAILURE, 0, _("incorrect password"));
}
#ifdef SYSLOG_SUCCESS
else
}
bytes_read = full_read (STDIN_FILENO, buf, BUFFER_SIZE);
if (bytes_read < 0)
- error (1, errno, _("read error"));
+ error (EXIT_FAILURE, errno, _("read error"));
{
struct B_pair bp;
switch (whence)
{
case SEEK_SET:
- error (1, errno, _("%s: cannot seek to offset %s%s"),
+ error (EXIT_FAILURE, errno, _("%s: cannot seek to offset %s%s"),
filename, sign, s);
break;
case SEEK_CUR:
- error (1, errno, _("%s: cannot seek to relative offset %s%s"),
+ error (EXIT_FAILURE, errno, _("%s: cannot seek to relative offset %s%s"),
filename, sign, s);
break;
case SEEK_END:
- error (1, errno, _("%s: cannot seek to end-relative offset %s%s"),
+ error (EXIT_FAILURE, errno,
+ _("%s: cannot seek to end-relative offset %s%s"),
filename, sign, s);
break;
default:
errs = tee (argc - optind, (const char **) &argv[optind]);
if (close (STDIN_FILENO) != 0)
- error (1, errno, _("standard input"));
+ error (EXIT_FAILURE, errno, _("standard input"));
exit (errs);
}
flexible_date++;
newtime = get_date (optarg, NULL);
if (newtime == (time_t) -1)
- error (1, 0, _("invalid date format %s"), quote (optarg));
+ error (EXIT_FAILURE, 0, _("invalid date format %s"), quote (optarg));
date_set++;
break;
posix_date++;
if (! posixtime (&newtime, optarg,
PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS))
- error (1, 0, _("invalid date format %s"), quote (optarg));
+ error (EXIT_FAILURE, 0, _("invalid date format %s"), quote (optarg));
date_set++;
break;
if (use_ref)
{
if (stat (ref_file, &ref_stats))
- error (1, errno, _("failed to get attributes of %s"), quote (ref_file));
+ error (EXIT_FAILURE, errno,
+ _("failed to get attributes of %s"), quote (ref_file));
date_set++;
}
struct utsname name;
if (uname (&name) == -1)
- error (1, errno, _("cannot get system name"));
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
if (toprint & PRINT_KERNEL_NAME)
print_element (name.sysname);
#endif
{
if (boot_time == 0)
- error (1, errno, _("couldn't get boot time"));
+ error (EXIT_FAILURE, errno, _("couldn't get boot time"));
uptime = time_now - boot_time;
}
updays = uptime / 86400;
int fail = read_utmp (filename, &n_users, &utmp_buf);
if (fail)
- error (1, errno, "%s", filename);
+ error (EXIT_FAILURE, errno, "%s", filename);
print_uptime (n_users, utmp_buf);
}
int fail = read_utmp (filename, &n_users, &utmp_buf);
if (fail)
- error (1, errno, "%s", filename);
+ error (EXIT_FAILURE, errno, "%s", filename);
list_entries_users (n_users, utmp_buf);
}
int fail = read_utmp (filename, &n_users, &utmp_buf);
if (fail)
- error (1, errno, "%s", filename);
+ error (EXIT_FAILURE, errno, "%s", filename);
if (short_list)
list_entries_who (n_users, utmp_buf);