aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-11-19 16:42:06 -0600
committerRob Landley <rob@landley.net>2018-11-19 16:42:06 -0600
commit30ebb153fb129bae14c4d2d95e42db9b1a45416d (patch)
tree82a72dc4970d8256f563259d9f255c33043d85be /toys/lsb
parent3d4219014ae5f5a6553423994ff5ccd1d490a6fc (diff)
downloadtoybox-30ebb153fb129bae14c4d2d95e42db9b1a45416d.tar.gz
A few more GLOBALS() single character argument style conversions.
Diffstat (limited to 'toys/lsb')
-rw-r--r--toys/lsb/seq.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/toys/lsb/seq.c b/toys/lsb/seq.c
index a8c1a4e8..988466b7 100644
--- a/toys/lsb/seq.c
+++ b/toys/lsb/seq.c
@@ -26,8 +26,7 @@ config SEQ
#include "toys.h"
GLOBALS(
- char *sep;
- char *fmt;
+ char *s, *f;
int precision;
)
@@ -60,7 +59,7 @@ void seq_main(void)
double first = 1, increment = 1, last, dd;
int i;
- if (!TT.sep) TT.sep = "\n";
+ if (!TT.s) TT.s = "\n";
switch (toys.optc) {
case 3: increment = parsef(toys.optargs[1]);
case 2: first = parsef(*toys.optargs);
@@ -68,8 +67,8 @@ void seq_main(void)
}
// Prepare format string with appropriate precision. Can't use %g because 1e6
- if (toys.optflags & FLAG_f) insanitize(TT.fmt);
- else sprintf(TT.fmt = toybuf, "%%.%df", TT.precision);
+ if (toys.optflags & FLAG_f) insanitize(TT.f);
+ else sprintf(TT.f = toybuf, "%%.%df", TT.precision);
// Pad to largest width
if (toys.optflags & FLAG_w) {
@@ -77,9 +76,9 @@ void seq_main(void)
for (i=0; i<3; i++) {
dd = (double []){first, increment, last}[i];
- len = maxof(len, snprintf(0, 0, TT.fmt, dd));
+ len = maxof(len, snprintf(0, 0, TT.f, dd));
}
- sprintf(TT.fmt = toybuf, "%%0%d.%df", len, TT.precision);
+ sprintf(TT.f = toybuf, "%%0%d.%df", len, TT.precision);
}
// Other implementations output nothing if increment is 0 and first > last,
@@ -92,8 +91,8 @@ void seq_main(void)
// Multiply to avoid accumulating rounding errors from increment.
dd = first+i*increment;
if ((increment<0 && dd<last) || (increment>0 && dd>last)) break;
- if (i++) printf("%s", TT.sep);
- printf(TT.fmt, dd);
+ if (i++) printf("%s", TT.s);
+ printf(TT.f, dd);
}
if (i) printf("\n");