/* we read time as int64_t from /proc, so cast... */
#define xctime(_x) ctime((time_t *) (_x))
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %1$s [resource-option...] [output-option]\n"
" %1$s -m|-q|-s -i <id>\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(_(" -i, --id <id> print details on resource identified by <id>\n"), out);
- fputs(USAGE_HELP, out);
- fputs(USAGE_VERSION, out);
+ printf(USAGE_HELP_OPTIONS(16));
fputs(USAGE_SEPARATOR, out);
fputs(_("Resource options:\n"), out);
fputs(_(" -u, --summary show status summary\n"), out);
fputs(_(" --human show sizes in human-readable format\n"), out);
fputs(_(" -b, --bytes show sizes in bytes\n"), out);
- fprintf(out, USAGE_MAN_TAIL("ipcs(1)"));
+ printf(USAGE_MAN_TAIL("ipcs(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main (int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((opt = getopt_long(argc, argv, options, longopts, NULL)) != -1) {
switch (opt) {
case 'b':
unit = IPC_UNIT_BYTES;
break;
+
case 'h':
- usage(stdout);
+ usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}