Lines 1-73
Link Here
|
1 |
diff -c pload.c.orig pload.c |
1 |
--- pload.c.orig 2000-02-01 07:11:24 UTC |
2 |
*** pload.c.orig Tue Feb 1 02:11:24 2000 |
2 |
+++ pload.c |
3 |
--- pload.c Wed Sep 22 13:13:46 2004 |
3 |
@@ -285,6 +285,13 @@ static XtResource pload_resources[] = { |
4 |
*************** |
4 |
/************* Main () ******************/ |
5 |
*** 596,608 **** |
5 |
int main (int argc, char *argv[]) |
6 |
void do_total(char *b, double total) |
6 |
{ |
7 |
{ |
7 |
+ char *orig_argv[64]; |
8 |
if (total < 1024.0) |
8 |
+ int i; |
9 |
! sprintf(b, "%s%0.0f b", b, total); |
9 |
+ |
10 |
else if (total < (1024.0*1024.0)) |
10 |
+ /* save original argv pointers */ |
11 |
! sprintf(b, "%s%0.2f k", b, total/1024.0); |
11 |
+ for(i = 0; argv[i]; i++) |
12 |
else if (total < (1024.0*1024.0*1024.0)) |
12 |
+ orig_argv[i] = argv[i]; |
13 |
! sprintf(b, "%s%0.2f M", b, total/1024.0/1024.0); |
13 |
+ |
14 |
else |
14 |
Progname = argv[0]; |
15 |
! sprintf(b, "%s%0.2f G", b, total/1024.0/1024.0/1024.0); |
15 |
|
16 |
|
16 |
toplevel = XtAppInitialize ( |
17 |
return; |
17 |
@@ -301,6 +308,11 @@ int main (int argc, char *argv[]) |
18 |
} |
18 |
and exit */ |
19 |
--- 596,608 ---- |
19 |
if (argc != 1) Usage(); |
20 |
void do_total(char *b, double total) |
20 |
|
21 |
{ |
21 |
+ /* XtAppInitialize() eats the arguments, so restore original |
22 |
if (total < 1024.0) |
22 |
+ argv so that ps(1) shows the command line */ |
23 |
! sprintf(b, "%s%0.0f B", b, total); |
23 |
+ for(i = 0; orig_argv[i]; i++) |
24 |
else if (total < (1024.0*1024.0)) |
24 |
+ argv[i] = orig_argv[i]; |
25 |
! sprintf(b, "%s%0.2f kB", b, total/1024.0); |
25 |
+ |
26 |
else if (total < (1024.0*1024.0*1024.0)) |
26 |
XtGetApplicationResources( |
27 |
! sprintf(b, "%s%0.2f MB", b, total/1024.0/1024.0); |
27 |
toplevel, /* widget */ |
28 |
else |
28 |
(XtPointer) &resources, /* where to put */ |
29 |
! sprintf(b, "%s%0.2f GB", b, total/1024.0/1024.0/1024.0); |
29 |
@@ -596,27 +608,26 @@ void CheckForWMExit( Widget w, |
30 |
|
30 |
void do_total(char *b, double total) |
31 |
return; |
31 |
{ |
32 |
} |
32 |
if (total < 1024.0) |
33 |
*************** |
33 |
- sprintf(b, "%s%0.0f b", b, total); |
34 |
*** 610,622 **** |
34 |
+ sprintf(b, "%s%0.0f B", b, total); |
35 |
void do_rate(char *b, double rate) |
35 |
else if (total < (1024.0*1024.0)) |
36 |
{ |
36 |
- sprintf(b, "%s%0.2f k", b, total/1024.0); |
37 |
if (rate < 1024.0) |
37 |
+ sprintf(b, "%s%0.2f kiB", b, total/1024.0); |
38 |
! sprintf(b, "%s%0.0f b/s",b, rate); |
38 |
else if (total < (1024.0*1024.0*1024.0)) |
39 |
else if (rate < (1024.0*1024.0)) |
39 |
- sprintf(b, "%s%0.2f M", b, total/1024.0/1024.0); |
40 |
! sprintf(b, "%s%0.2f k/s",b, rate/1024.0); |
40 |
+ sprintf(b, "%s%0.2f MiB", b, total/1024.0/1024.0); |
41 |
else if (rate < (1024.0*1024.0*1024.0)) |
41 |
else |
42 |
! sprintf(b, "%s%0.2f M/s",b, rate/1024.0/1024.0); |
42 |
- sprintf(b, "%s%0.2f G", b, total/1024.0/1024.0/1024.0); |
43 |
else |
43 |
- |
44 |
! sprintf(b, "%s%0.2f G/s", b, rate/1024.0/1024.0/1024.0); |
44 |
+ sprintf(b, "%s%0.2f GiB", b, total/1024.0/1024.0/1024.0); |
45 |
return; |
45 |
return; |
46 |
} |
46 |
} |
47 |
|
47 |
|
48 |
--- 610,622 ---- |
48 |
void do_rate(char *b, double rate) |
49 |
void do_rate(char *b, double rate) |
49 |
{ |
50 |
{ |
50 |
if (rate < 1024.0) |
51 |
if (rate < 1024.0) |
51 |
- sprintf(b, "%s%0.0f b/s",b, rate); |
52 |
! sprintf(b, "%s%0.0f B/s",b, rate); |
52 |
+ sprintf(b, "%s%0.0f B/s",b, rate); |
53 |
else if (rate < (1024.0*1024.0)) |
53 |
else if (rate < (1024.0*1024.0)) |
54 |
! sprintf(b, "%s%0.2f kB/s",b, rate/1024.0); |
54 |
- sprintf(b, "%s%0.2f k/s",b, rate/1024.0); |
55 |
else if (rate < (1024.0*1024.0*1024.0)) |
55 |
+ sprintf(b, "%s%0.2f kiB/s",b, rate/1024.0); |
56 |
! sprintf(b, "%s%0.2f MB/s",b, rate/1024.0/1024.0); |
56 |
else if (rate < (1024.0*1024.0*1024.0)) |
57 |
else |
57 |
- sprintf(b, "%s%0.2f M/s",b, rate/1024.0/1024.0); |
58 |
! sprintf(b, "%s%0.2f GB/s", b, rate/1024.0/1024.0/1024.0); |
58 |
+ sprintf(b, "%s%0.2f MiB/s",b, rate/1024.0/1024.0); |
59 |
return; |
59 |
else |
60 |
} |
60 |
- sprintf(b, "%s%0.2f G/s", b, rate/1024.0/1024.0/1024.0); |
61 |
|
61 |
+ sprintf(b, "%s%0.2f GiB/s", b, rate/1024.0/1024.0/1024.0); |
62 |
*************** |
62 |
return; |
63 |
*** 643,648 **** |
63 |
} |
64 |
--- 643,651 ---- |
64 |
|
65 |
break; |
65 |
@@ -643,6 +654,9 @@ void make_label(char *fmt, unsigned long total, double |
66 |
case 'M': |
66 |
break; |
67 |
do_rate(buff, max); |
67 |
case 'M': |
68 |
+ break; |
68 |
do_rate(buff, max); |
69 |
+ case 'd': |
69 |
+ break; |
70 |
+ sprintf(buff, "%s", resources.device); |
70 |
+ case 'd': |
71 |
break; |
71 |
+ strcat(buff, resources.device); |
72 |
case '%': /* literal % */ |
72 |
break; |
73 |
i = strlen(buff); |
73 |
case '%': /* literal % */ |
|
|
74 |
i = strlen(buff); |