* src/cksum.c (output_crc): Use '%ju' instead of umaxtostr.
* src/shred.c (dopass): Likewise.
* src/csplit.c (handle_line_error, regexp_error, close_output_file)
(parse_patterns): Use '%jd' instead of offtostr.
* src/tail.c (xlseek): Likewise.
* src/head.c (elseek): Likewise.
* src/group-list.c (gidtostr_ptr): Remove function.
(gidtostr): Remove macro.
(print_group): Use '%ju' instead of umaxtostr.
* src/id.c (gidtostr_ptr, uidtostr_ptr): Remove functions.
(gidtostr, uidtostr): Remove macros.
(print_user, print_full_info): Use '%ju' instead of umaxtostr.
* src/sort.c (specify_nmerge): Use '%u' instead of uinttostr.
return;
}
- char length_buf[INT_BUFSIZE_BOUND (uintmax_t)];
- printf ("%u %s", *(unsigned int *)digest, umaxtostr (length, length_buf));
+ printf ("%u %ju", *(unsigned int *)digest, length);
if (args)
printf (" %s", file);
putchar (delim);
fprintf (stderr, _("%s: %s: line number out of range"),
program_name, quote (imaxtostr (p->lines_required, buf)));
if (repetition)
- fprintf (stderr, _(" on repetition %s\n"), imaxtostr (repetition, buf));
+ fprintf (stderr, _(" on repetition %jd\n"), repetition);
else
fprintf (stderr, "\n");
program_name, quote (global_argv[p->argnum]));
if (repetition)
- {
- char buf[INT_BUFSIZE_BOUND (intmax_t)];
- fprintf (stderr, _(" on repetition %s\n"), imaxtostr (repetition, buf));
- }
+ fprintf (stderr, _(" on repetition %jd\n"), repetition);
else
fprintf (stderr, "\n");
else
{
if (!suppress_count)
- {
- char buf[INT_BUFSIZE_BOUND (intmax_t)];
- fprintf (stdout, "%s\n", imaxtostr (bytes_written, buf));
- }
+ fprintf (stdout, "%jd\n", bytes_written);
}
output_stream = nullptr;
}
error (EXIT_FAILURE, 0,
_("%s: line number must be greater than zero"), argv[i]);
if (val < last_val)
- {
- char buf[INT_BUFSIZE_BOUND (intmax_t)];
- error (EXIT_FAILURE, 0,
- _("line number %s is smaller than preceding line number,"
- " %s"),
- quote (argv[i]), imaxtostr (last_val, buf));
- }
+ error (EXIT_FAILURE, 0,
+ _("line number %s is smaller than preceding line number,"
+ " %jd"), quote (argv[i]), last_val);
if (val == last_val)
error (0, 0,
return ok;
}
-/* Convert a gid_t to string. Do not use this function directly.
- Instead, use it via the gidtostr macro.
- Beware that it returns a pointer to static storage. */
-static char *
-gidtostr_ptr (gid_t const *gid)
-{
- static char buf[INT_BUFSIZE_BOUND (uintmax_t)];
- return umaxtostr (*gid, buf);
-}
-#define gidtostr(g) gidtostr_ptr (&(g))
-
/* Print the name or value of group ID GID. */
extern bool
print_group (gid_t gid, bool use_name)
}
}
- char *s = grp ? grp->gr_name : gidtostr (gid);
- fputs (s, stdout);
+ if (grp)
+ printf ("%s", grp->gr_name);
+ else
+ printf ("%ju", (uintmax_t) gid);
return ok;
}
elseek (int fd, off_t offset, int whence, char const *filename)
{
off_t new_offset = lseek (fd, offset, whence);
- char buf[INT_BUFSIZE_BOUND (offset)];
if (new_offset < 0)
error (0, errno,
_(whence == SEEK_SET
- ? N_("%s: cannot seek to offset %s")
- : N_("%s: cannot seek to relative offset %s")),
+ ? N_("%s: cannot seek to offset %jd")
+ : N_("%s: cannot seek to relative offset %jd")),
quotef (filename),
- offtostr (offset, buf));
+ (intmax_t) offset);
return new_offset;
}
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
-/* Convert a gid_t to string. Do not use this function directly.
- Instead, use it via the gidtostr macro.
- Beware that it returns a pointer to static storage. */
-static char *
-gidtostr_ptr (gid_t const *gid)
-{
- static char buf[INT_BUFSIZE_BOUND (uintmax_t)];
- return umaxtostr (*gid, buf);
-}
-#define gidtostr(g) gidtostr_ptr (&(g))
-
-/* Convert a uid_t to string. Do not use this function directly.
- Instead, use it via the uidtostr macro.
- Beware that it returns a pointer to static storage. */
-static char *
-uidtostr_ptr (uid_t const *uid)
-{
- static char buf[INT_BUFSIZE_BOUND (uintmax_t)];
- return umaxtostr (*uid, buf);
-}
-#define uidtostr(u) uidtostr_ptr (&(u))
-
/* Print the name or value of user ID UID. */
static void
pwd = getpwuid (uid);
if (pwd == nullptr)
{
- error (0, 0, _("cannot find name for user ID %s"),
- uidtostr (uid));
+ error (0, 0, _("cannot find name for user ID %ju"), (uintmax_t) uid);
ok &= false;
}
}
- char *s = pwd ? pwd->pw_name : uidtostr (uid);
- fputs (s, stdout);
+ if (pwd)
+ printf ("%s", pwd->pw_name);
+ else
+ printf ("%ju", (uintmax_t) uid);
}
/* Print all of the info about the user's user and group IDs. */
struct passwd *pwd;
struct group *grp;
- printf (_("uid=%s"), uidtostr (ruid));
+ printf (_("uid=%ju"), (uintmax_t) ruid);
pwd = getpwuid (ruid);
if (pwd)
printf ("(%s)", pwd->pw_name);
- printf (_(" gid=%s"), gidtostr (rgid));
+ printf (_(" gid=%ju"), (uintmax_t) rgid);
grp = getgrgid (rgid);
if (grp)
printf ("(%s)", grp->gr_name);
if (euid != ruid)
{
- printf (_(" euid=%s"), uidtostr (euid));
+ printf (_(" euid=%ju"), (uintmax_t) euid);
pwd = getpwuid (euid);
if (pwd)
printf ("(%s)", pwd->pw_name);
if (egid != rgid)
{
- printf (_(" egid=%s"), gidtostr (egid));
+ printf (_(" egid=%ju"), (uintmax_t) egid);
grp = getgrgid (egid);
if (grp)
printf ("(%s)", grp->gr_name);
{
if (i > 0)
putchar (',');
- fputs (gidtostr (groups[i]), stdout);
+ printf ("%ju", (uintmax_t) groups[i]);
grp = getgrgid (groups[i]);
if (grp)
printf ("(%s)", grp->gr_name);
else
{
int errnum = errno;
- char buf[INT_BUFSIZE_BOUND (uintmax_t)];
/* Retry without direct I/O since this may not be supported
at all on some (file) systems, or with the current size.
try_without_directio = true;
continue;
}
- error (0, errnum, _("%s: error writing at offset %s"),
- qname, umaxtostr (offset + soff, buf));
+ uintmax_t error_offset = offset + soff;
+ error (0, errnum, _("%s: error writing at offset %ju"),
+ qname, error_offset);
/* 'shred' is often used on bad media, before throwing it
out. Thus, it shouldn't give up on bad blocks. This
if (e == LONGINT_OVERFLOW)
{
- char max_nmerge_buf[INT_BUFSIZE_BOUND (max_nmerge)];
error (0, 0, _("--%s argument %s too large"),
long_options[oi].name, quote (s));
error (SORT_FAILURE, 0,
- _("maximum --%s argument with current rlimit is %s"),
- long_options[oi].name,
- uinttostr (max_nmerge, max_nmerge_buf));
+ _("maximum --%s argument with current rlimit is %u"),
+ long_options[oi].name, max_nmerge);
}
else
xstrtol_fatal (e, oi, c, long_options, s);
xlseek (int fd, off_t offset, int whence, char const *filename)
{
off_t new_offset = lseek (fd, offset, whence);
- char buf[INT_BUFSIZE_BOUND (offset)];
- char *s;
if (0 <= new_offset)
return new_offset;
- s = offtostr (offset, buf);
switch (whence)
{
case SEEK_SET:
- error (EXIT_FAILURE, errno, _("%s: cannot seek to offset %s"),
- quotef (filename), s);
+ error (EXIT_FAILURE, errno, _("%s: cannot seek to offset %jd"),
+ quotef (filename), (intmax_t) offset);
break;
case SEEK_CUR:
- error (EXIT_FAILURE, errno, _("%s: cannot seek to relative offset %s"),
- quotef (filename), s);
+ error (EXIT_FAILURE, errno, _("%s: cannot seek to relative offset %jd"),
+ quotef (filename), (intmax_t) offset);
break;
case SEEK_END:
error (EXIT_FAILURE, errno,
- _("%s: cannot seek to end-relative offset %s"),
- quotef (filename), s);
+ _("%s: cannot seek to end-relative offset %jd"),
+ quotef (filename), (intmax_t) offset);
break;
default:
unreachable ();