NetBSD: 起動時間の修正
このコミットが含まれているのは:
コミット
656923fefb
2
main.c
2
main.c
|
@ -72,8 +72,10 @@ int main() {
|
|||
|
||||
printf("%s ", LOGO[4]);
|
||||
printf(COLOR"%s%s"RESET, "Uptime", ": ");
|
||||
#ifndef __NetBSD__
|
||||
display_days();
|
||||
printf(", ");
|
||||
#endif
|
||||
display_time();
|
||||
printf("\n");
|
||||
|
||||
|
|
|
@ -21,11 +21,18 @@ void run_uptime_command(const char *command) {
|
|||
pclose(p);
|
||||
}
|
||||
|
||||
#ifndef __NetBSD__
|
||||
void display_days() {
|
||||
run_uptime_command("uptime | awk '{print $3}' && echo \" days\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void display_time() {
|
||||
#if defined(__NetBSD__)
|
||||
run_uptime_command("uptime | awk '{print $3}' | sed 's/,//' | "
|
||||
"sed 's/:/ hours, /' && echo \" mins\"");
|
||||
#else
|
||||
run_uptime_command("uptime | awk '{print $5}' | sed 's/,//' | "
|
||||
"sed 's/:/ hours, /' && echo \" mins\"");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef UPTIME_H
|
||||
#define UPTIME_H
|
||||
|
||||
#ifndef __NetBSD__
|
||||
void display_days();
|
||||
#endif
|
||||
void display_time();
|
||||
|
||||
#endif
|
||||
|
|
読み込み中…
新しいイシューから参照