summaryrefslogtreecommitdiff
path: root/src/skaembutils/s6-seq.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-02-11 03:12:21 +0000
committerLaurent Bercot <ska@appnovation.com>2023-02-11 03:12:21 +0000
commit774654ad56fc9304e4a064232760835c7a2a6c13 (patch)
tree3f539521073866497ff0370d8a6464c9356cadb4 /src/skaembutils/s6-seq.c
parent790c8681d3451b61a536871dad234fc294796fd8 (diff)
downloads6-portable-utils-774654ad56fc9304e4a064232760835c7a2a6c13.tar.xz
Add multicall configuration
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/skaembutils/s6-seq.c')
-rw-r--r--src/skaembutils/s6-seq.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/skaembutils/s6-seq.c b/src/skaembutils/s6-seq.c
deleted file mode 100644
index a7b70ba..0000000
--- a/src/skaembutils/s6-seq.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ISC license. */
-
-#include <string.h>
-
-#include <skalibs/types.h>
-#include <skalibs/sgetopt.h>
-#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-
-#define USAGE "s6-seq [ -w ] [ -s separator ] limits"
-#define dieusage() strerr_dieusage(100, USAGE)
-
-int main (int argc, char const *const *argv)
-{
- char const *sep = "\n" ;
- size_t fixed = 0, seplen = 1 ;
- unsigned int i = 1, increment = 1, last ;
- char fmt[UINT_FMT] ;
- PROG = "s6-seq" ;
- {
- subgetopt l = SUBGETOPT_ZERO ;
- for (;;)
- {
- int opt = subgetopt_r(argc, argv, "ws:", &l) ;
- if (opt == -1) break ;
- switch (opt)
- {
- case 'w': fixed = 1 ; break ;
- case 's': sep = l.arg ; seplen = strlen(sep) ; break ;
- default : dieusage() ;
- }
- }
- argc -= l.ind ; argv += l.ind ;
- }
- switch (argc)
- {
- case 1 :
- if (!uint0_scan(argv[0], &last)) dieusage() ;
- break ;
- case 2 :
- if (!uint0_scan(argv[0], &i)
- || !uint0_scan(argv[1], &last)) dieusage() ;
- break ;
- case 3 :
- if (!uint0_scan(argv[0], &i)
- || !uint0_scan(argv[1], &increment)
- || !uint0_scan(argv[2], &last)) dieusage() ;
- break ;
- default : dieusage() ;
- }
- if (!seplen) seplen = 1 ;
- if (fixed) fixed = uint_fmt(0, i + increment * ((last - i) / increment)) ;
- for (; i <= last ; i += increment)
- {
- if (buffer_put(buffer_1, fmt, fixed ? (uint0_fmt(fmt, i, fixed), fixed) : uint_fmt(fmt, i)) < 0) goto err ;
- if (buffer_put(buffer_1, sep, seplen) < 0) goto err ;
- }
- if (!buffer_flush(buffer_1)) goto err ;
- return 0 ;
-
-err:
- strerr_diefu1sys(111, "write to stdout") ;
-}