diff options
-rw-r--r-- | miscutils/adjtimex.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 0830734ee..a39c4f5cf 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c | |||
@@ -90,13 +90,14 @@ int adjtimex_main(int argc UNUSED_PARAM, char **argv) | |||
90 | unsigned opt; | 90 | unsigned opt; |
91 | char *opt_o, *opt_f, *opt_p, *opt_t; | 91 | char *opt_o, *opt_f, *opt_p, *opt_t; |
92 | struct timex txc; | 92 | struct timex txc; |
93 | int i, ret; | 93 | int ret; |
94 | const char *descript; | 94 | const char *descript; |
95 | 95 | ||
96 | memset(&txc, 0, sizeof(txc)); | ||
97 | |||
96 | opt_complementary = "=0"; /* no valid non-option parameters */ | 98 | opt_complementary = "=0"; /* no valid non-option parameters */ |
97 | opt = getopt32(argv, "qo:f:p:t:", | 99 | opt = getopt32(argv, "qo:f:p:t:", |
98 | &opt_o, &opt_f, &opt_p, &opt_t); | 100 | &opt_o, &opt_f, &opt_p, &opt_t); |
99 | txc.modes = 0; | ||
100 | //if (opt & 0x1) // -q | 101 | //if (opt & 0x1) // -q |
101 | if (opt & 0x2) { // -o | 102 | if (opt & 0x2) { // -o |
102 | txc.offset = xatol(opt_o); | 103 | txc.offset = xatol(opt_o); |
@@ -116,14 +117,13 @@ int adjtimex_main(int argc UNUSED_PARAM, char **argv) | |||
116 | } | 117 | } |
117 | 118 | ||
118 | ret = adjtimex(&txc); | 119 | ret = adjtimex(&txc); |
119 | 120 | if (ret < 0) | |
120 | if (ret < 0) { | ||
121 | bb_perror_nomsg_and_die(); | 121 | bb_perror_nomsg_and_die(); |
122 | } | ||
123 | 122 | ||
124 | if (!(opt & OPT_quiet)) { | 123 | if (!(opt & OPT_quiet)) { |
125 | const char *sep; | 124 | const char *sep; |
126 | const char *name; | 125 | const char *name; |
126 | int i; | ||
127 | 127 | ||
128 | printf( | 128 | printf( |
129 | " mode: %d\n" | 129 | " mode: %d\n" |
@@ -132,8 +132,9 @@ int adjtimex_main(int argc UNUSED_PARAM, char **argv) | |||
132 | " maxerror: %ld\n" | 132 | " maxerror: %ld\n" |
133 | " esterror: %ld\n" | 133 | " esterror: %ld\n" |
134 | " status: %d (", | 134 | " status: %d (", |
135 | txc.modes, txc.offset, txc.freq, txc.maxerror, | 135 | txc.modes, txc.offset, txc.freq, txc.maxerror, |
136 | txc.esterror, txc.status); | 136 | txc.esterror, txc.status |
137 | ); | ||
137 | 138 | ||
138 | /* representative output of next code fragment: | 139 | /* representative output of next code fragment: |
139 | * "PLL | PPSTIME" | 140 | * "PLL | PPSTIME" |
@@ -159,9 +160,11 @@ int adjtimex_main(int argc UNUSED_PARAM, char **argv) | |||
159 | " time.tv_sec: %ld\n" | 160 | " time.tv_sec: %ld\n" |
160 | " time.tv_usec: %ld\n" | 161 | " time.tv_usec: %ld\n" |
161 | " return value: %d (%s)\n", | 162 | " return value: %d (%s)\n", |
162 | txc.constant, | 163 | txc.constant, |
163 | txc.precision, txc.tolerance, txc.tick, | 164 | txc.precision, txc.tolerance, txc.tick, |
164 | (long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript); | 165 | (long)txc.time.tv_sec, (long)txc.time.tv_usec, |
166 | ret, descript | ||
167 | ); | ||
165 | } | 168 | } |
166 | 169 | ||
167 | return 0; | 170 | return 0; |