--- src/uptime.c 2004-08-20 10:17:21.931004000 +0200 +++ src/uptime.c.DIST 2002-08-31 09:25:51.000000000 +0200 @@ -45,15 +45,9 @@ static struct option const longopts[] = { - {"parseable", no_argument, NULL, 'p'}, - {GETOPT_HELP_OPTION_DECL}, - {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} }; -/* parseable output (default=no) */ -int parseable = 0; - static void print_uptime (int n, const STRUCT_UTMP *this) { @@ -135,29 +129,19 @@ error (EXIT_FAILURE, errno, _("couldn't get boot time")); uptime = time_now - boot_time; } - - /* parseable output */ - if (parseable) - { - printf("%10d%6d", uptime, entries); - } - /* traditional */ - else - { - updays = uptime / 86400; - uphours = (uptime - (updays * 86400)) / 3600; - upmins = (uptime - (updays * 86400) - (uphours * 3600)) / 60; - tmn = localtime (&time_now); - printf (_(" %2d:%02d%s up "), ((tmn->tm_hour % 12) == 0 - ? 12 : tmn->tm_hour % 12), - /* FIXME: use strftime, not am, pm. Uli reports that - the german translation is meaningless. */ - tmn->tm_min, (tmn->tm_hour < 12 ? _("am") : _("pm"))); - if (updays > 0) - printf (ngettext("%d day", "%d days", updays), updays); - printf (" %2d:%02d, ", uphours, upmins); - printf (ngettext ("%d user", "%d users", entries), entries); - } + updays = uptime / 86400; + uphours = (uptime - (updays * 86400)) / 3600; + upmins = (uptime - (updays * 86400) - (uphours * 3600)) / 60; + tmn = localtime (&time_now); + printf (_(" %2d:%02d%s up "), ((tmn->tm_hour % 12) == 0 + ? 12 : tmn->tm_hour % 12), + /* FIXME: use strftime, not am, pm. Uli reports that + the german translation is meaningless. */ + tmn->tm_min, (tmn->tm_hour < 12 ? _("am") : _("pm"))); + if (updays > 0) + printf (ngettext("%d day", "%d days", updays), updays); + printf (" %2d:%02d, ", uphours, upmins); + printf (ngettext ("%d user", "%d users", entries), entries); #if defined (HAVE_GETLOADAVG) || defined (C_GETLOADAVG) loads = getloadavg (avg, 3); @@ -169,24 +153,14 @@ putchar ('\n'); else { - if (parseable) - { - if (loads > 0) printf("%8.2f", avg[0]); - if (loads > 1) printf("%8.2f", avg[1]); - if (loads > 2) printf("%8.2f", avg[2]); - if (loads > 0) putchar('\n'); - } - else - { - if (loads > 0) - printf (_(", load average: %.2f"), avg[0]); - if (loads > 1) - printf (", %.2f", avg[1]); - if (loads > 2) - printf (", %.2f", avg[2]); - if (loads > 0) - putchar ('\n'); - } + if (loads > 0) + printf (_(", load average: %.2f"), avg[0]); + if (loads > 1) + printf (", %.2f", avg[1]); + if (loads > 2) + printf (", %.2f", avg[2]); + if (loads > 0) + putchar ('\n'); } } @@ -223,7 +197,6 @@ \n\ "), UTMP_FILE, WTMP_FILE); - fputs(_(" -p, --parseable print parseable output (uptime in seconds)\n"), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT); @@ -245,17 +218,13 @@ parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION, AUTHORS, usage); - while ((optc = getopt_long (argc, argv, "p", longopts, &longind)) != -1) + while ((optc = getopt_long (argc, argv, "", longopts, &longind)) != -1) { switch (optc) { case 0: break; - case 'p': - parseable = 1; - break; - default: usage (EXIT_FAILURE); }