Add Android/Linux support
WHR
4 years ago
19 | 19 |
#include "../config.h"
|
20 | 20 |
#include "urec.h"
|
21 | 21 |
|
|
22 |
#ifdef __ANDROID__
|
|
23 |
Urec *u_current;
|
|
24 |
#endif
|
22 | 25 |
Urec *urec_list = NULL;
|
23 | 26 |
static Urec *urec_last = NULL;
|
24 | 27 |
|
53 | 53 |
|
54 | 54 |
#include "misc.h"
|
55 | 55 |
|
|
56 |
#ifdef __ANDROID__
|
|
57 |
#define FILE_BOOTID "/data/uptimed/bootid"
|
|
58 |
#define FILE_RECORDS "/data/uptimed/records"
|
|
59 |
#else
|
56 | 60 |
#define FILE_BOOTID "/var/spool/uptimed/bootid"
|
57 | 61 |
#define FILE_RECORDS "/var/spool/uptimed/records"
|
|
62 |
#endif
|
58 | 63 |
|
59 | 64 |
typedef struct urec {
|
60 | 65 |
time_t utime; /* uptime */
|
24 | 24 |
#define SYSWIDTH 24
|
25 | 25 |
#define DOWNWIDTH 20
|
26 | 26 |
|
|
27 |
#ifdef __ANDROID__
|
|
28 |
extern Urec *u_current;
|
|
29 |
#else
|
27 | 30 |
Urec *u_current;
|
|
31 |
#endif
|
28 | 32 |
time_t first, prev, tenth, second;
|
29 | 33 |
int runas_cgi=0, show_max=10, show_milestone=0, layout=PRE, show_downtime=0, run_loop=0, update_interval=5;
|
30 | 34 |
int sort_by=0, no_ansi=0, no_stats=0, no_current=0, wide_out=0;
|
|
489 | 493 |
switch(i)
|
490 | 494 |
{
|
491 | 495 |
case '?':
|
|
496 |
#ifdef __ANDROID__
|
|
497 |
fputc('\n', stderr);
|
|
498 |
#endif
|
492 | 499 |
print_help(argv);
|
493 | 500 |
break;
|
494 | 501 |
case 'a':
|
28 | 28 |
#include <getopt.h>
|
29 | 29 |
#endif
|
30 | 30 |
|
|
31 |
#ifdef __ANDROID__
|
|
32 |
extern Urec *u_current;
|
|
33 |
#else
|
31 | 34 |
Urec *u_current = NULL;
|
|
35 |
#endif
|
32 | 36 |
int our_pos=0;
|
33 | 37 |
int update_interval=60, create_bootid=0, send_email=0, foreground=0;
|
34 | 38 |
time_t log_min_uptime = 0, mail_min_uptime = 0;
|
|
341 | 345 |
switch(index)
|
342 | 346 |
{
|
343 | 347 |
case '?':
|
|
348 |
#ifdef __ANDROID__
|
|
349 |
fputc('\n', stderr);
|
|
350 |
#endif
|
344 | 351 |
print_help(argv);
|
345 | 352 |
break;
|
346 | 353 |
case 'v':
|