// 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)) {
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)"));
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}
};
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;