From: Craig Small Date: Wed, 11 Sep 2013 10:50:48 +0000 (+1000) Subject: Merge commit 'refs/merge-requests/2' of git://gitorious.org/procps/procps into merge... X-Git-Tag: v3.3.9~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e4d9d5a926c46e69e9ce03cf42de08a399ea5c6;p=procps-ng Merge commit 'refs/merge-requests/2' of git://gitorious.org/procps/procps into merge-requests/2 Conflicts: uptime.c --- 5e4d9d5a926c46e69e9ce03cf42de08a399ea5c6 diff --cc top/top.c index 9996fbf8,73aa2827..6f4f7288 --- a/top/top.c +++ b/top/top.c @@@ -4997,12 -3388,12 +4997,12 @@@ static void summary_show (void) // Display Uptime and Loadavg if (isROOM(View_LOADAV, 1)) { if (!Rc.mode_altscr) - show_special(0, fmtmk(LOADAV_line, Myname, sprint_uptime())); + show_special(0, fmtmk(LOADAV_line, Myname, sprint_uptime(0))); else show_special(0, fmtmk(CHKw(w, Show_TASKON)? LOADAV_line_alt : LOADAV_line - , w->grpname, sprint_uptime())); + , w->grpname, sprint_uptime(0))); Msg_row += 1; - } + } // end: View_LOADAV // Display Task and Cpu(s) States if (isROOM(View_STATES, 2)) { diff --cc uptime.c index 27421895,557b08ce..91275ca8 --- a/uptime.c +++ b/uptime.c @@@ -58,8 -13,8 +58,9 @@@ static void __attribute__ ((__noreturn_ fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options]\n"), program_invocation_short_name); fputs(USAGE_OPTIONS, out); + fputs(_(" -p, --pretty show uptime in pretty format\n"), out); fputs(USAGE_HELP, out); + fputs(_(" -s, --since system up since\n"), out); fputs(USAGE_VERSION, out); fprintf(out, USAGE_MAN_TAIL("uptime(1)")); @@@ -68,11 -23,11 +69,12 @@@ int main(int argc, char **argv) { - int c; + int c, p = 0; static const struct option longopts[] = { + {"pretty", no_argument, NULL, 'p'}, {"help", no_argument, NULL, 'h'}, + {"since", no_argument, NULL, 's'}, {"version", no_argument, NULL, 'V'}, {NULL, 0, NULL, 0} }; @@@ -83,15 -36,14 +85,18 @@@ setlocale (LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); - while ((c = getopt_long(argc, argv, "hsV", longopts, NULL)) != -1) - while ((c = getopt_long(argc, argv, "phV", longopts, NULL)) != -1) ++ while ((c = getopt_long(argc, argv, "phsV", longopts, NULL)) != -1) switch (c) { + case 'p': + p = 1; + break; case 'h': usage(stdout); + case 's': + print_uptime_since(); + return EXIT_SUCCESS; case 'V': printf(PROCPS_NG_VERSION); return EXIT_SUCCESS;