[hackers] [sbase] Audit seq(1) || FRIGN
commit f1e865df061826182aade770cad5edc1638283bd
Author: FRIGN <dev_AT_frign.de>
Date: Fri Mar 20 16:04:23 2015 +0100
Audit seq(1)
Mostly manpage-stuff and style-changes in the code.
diff --git a/README b/README
index 8033776..ac44696 100644
--- a/README
+++ b/README
_AT_@ -60,7 +60,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
=*| rm yes none (-i)
=*| rmdir yes none
# sed yes none
-= seq non-posix none
+=*| seq non-posix none
=*| setsid non-posix none
=*| sha1sum non-posix none
=*| sha256sum non-posix none
diff --git a/seq.1 b/seq.1
index e186e79..baf1e64 100644
--- a/seq.1
+++ b/seq.1
_AT_@ -1,4 +1,4 @@
-.Dd January 30, 2015
+.Dd March 20, 2015
.Dt SEQ 1
.Os sbase
.Sh NAME
_AT_@ -8,29 +8,32 @@
.Nm
.Op Fl w
.Op Fl f Ar fmt
-.Op Fl s Ar separator
-.Op Ar start Op Ar step
-.Ar end
+.Op Fl s Ar sep
+.Op Ar startnum Op Ar step
+.Ar endnum
.Sh DESCRIPTION
.Nm
-will print a sequence of numbers from
-.Ar start
+writes a sequence of numbers from
+.Ar startnum
(default: 1) to
-.Ar end ,
+.Ar endnum
in
.Ar step
-intervals (default: 1).
+intervals (default: 1)
+to stdout.
.Sh OPTIONS
.Bl -tag -width Ds
-.It Fl f Ar format
-Specifies the format used for output lines, as per
+.It Fl f Ar fmt
+Use
+.Ar fmt
+as the output line format according to
.Xr printf 3 .
-.It Fl s Ar separator
-Specifies the separator to print between output lines.
+.It Fl s Ar sep
+Print
+.Ar sep
+between output lines. The default is "\en".
.It Fl w
-Tells
-.Nm
-to print out lines in equal width.
+Print out lines in equal width.
.El
.Sh SEE ALSO
.Xr printf 3
diff --git a/seq.c b/seq.c
index 27fe7e1..9e1f87b 100644
--- a/seq.c
+++ b/seq.c
_AT_@ -14,7 +14,7 @@ digitsleft(const char *d)
if (*d == '+')
d++;
exp = strpbrk(d, "eE");
- shift = exp ? estrtonum(&exp[1], INT_MIN, INT_MAX) : 0;
+ shift = exp ? estrtonum(exp + 1, INT_MIN, INT_MAX) : 0;
return MAX(0, strspn(d, "-0123456789") + shift);
}
_AT_@ -72,8 +72,8 @@ format:
static void
usage(void)
{
- eprintf("usage: %s [-f fmt] [-s separator] [-w width] [start"
- " [step]] end\n", argv0);
+ eprintf("usage: %s [-f fmt] [-s sep] [-w] [startnum"
+ " [step]] endnum\n", argv0);
}
int
_AT_@ -142,7 +142,7 @@ main(int argc, char *argv[])
fputs(sep, stdout);
printf(fmt, out);
}
- printf("\n");
+ putchar('\n');
return 0;
}
Received on Fri Mar 20 2015 - 21:22:28 CET
This archive was generated by hypermail 2.3.0
: Fri Mar 20 2015 - 21:24:13 CET