diff options
Diffstat (limited to 'src/libexecline')
-rw-r--r-- | src/libexecline/el_execsequence.c | 42 | ||||
-rw-r--r-- | src/libexecline/el_getstrict.c | 2 | ||||
-rw-r--r-- | src/libexecline/el_parse.c | 4 | ||||
-rw-r--r-- | src/libexecline/el_parse_from_buffer.c | 2 | ||||
-rw-r--r-- | src/libexecline/el_popenv.c | 10 | ||||
-rw-r--r-- | src/libexecline/el_pushenv.c | 10 | ||||
-rw-r--r-- | src/libexecline/el_semicolon.c | 6 | ||||
-rw-r--r-- | src/libexecline/el_substandrun_str.c | 2 | ||||
-rw-r--r-- | src/libexecline/el_transform.c | 8 | ||||
-rw-r--r-- | src/libexecline/el_vardupl.c | 2 | ||||
-rw-r--r-- | src/libexecline/exlp.c | 4 | ||||
-rw-r--r-- | src/libexecline/exlsn_define.c | 4 | ||||
-rw-r--r-- | src/libexecline/exlsn_elglob.c | 2 | ||||
-rw-r--r-- | src/libexecline/exlsn_exlp.c | 4 | ||||
-rw-r--r-- | src/libexecline/exlsn_import.c | 5 | ||||
-rw-r--r-- | src/libexecline/exlsn_multidefine.c | 4 |
16 files changed, 47 insertions, 64 deletions
diff --git a/src/libexecline/el_execsequence.c b/src/libexecline/el_execsequence.c index d697f2e..42ef104 100644 --- a/src/libexecline/el_execsequence.c +++ b/src/libexecline/el_execsequence.c @@ -1,41 +1,23 @@ /* ISC license. */ -#include <sys/types.h> -#ifdef EXECLINE_OLD_VARNAMES -#include <skalibs/bytestr.h> -#endif +#include <unistd.h> #include <skalibs/djbunix.h> #include <skalibs/env.h> #include <skalibs/strerr2.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <execline/execline.h> void el_execsequence (char const *const *argv1, char const *const *argv2, char const *const *envp) { - if (!argv2[0]) - { - pathexec0_run(argv1, envp) ; - strerr_dieexec(111, argv1[0]) ; - } - else - { - size_t j = 2 ; - int wstat ; -#ifdef EXECLINE_OLD_VARNAMES - char fmt[UINT_FMT * 2 + 15] = "?=" ; -#else - char fmt[UINT_FMT + 1] = "?=" ; -#endif - pid_t pid = el_spawn0(argv1[0], argv1, envp) ; - if (!pid) strerr_warnwu2sys("spawn ", argv1[0]) ; - if (wait_pid(pid, &wstat) < 0) - strerr_diefu2sys(111, "wait for ", argv1[0]) ; - j += uint_fmt(fmt + j, wait_status(wstat)) ; fmt[j++] = 0 ; -#ifdef EXECLINE_OLD_VARNAMES - byte_copy(fmt + j, 13, "LASTEXITCODE=") ; j += 13 ; - j += uint_fmt(fmt + j, wait_status(wstat)) ; fmt[j++] = 0 ; -#endif - pathexec_r(argv2, envp, env_len(envp), fmt, j) ; - } + size_t j = 2 ; + int wstat ; + char fmt[UINT_FMT + 1] = "?=" ; + pid_t pid = el_spawn0(argv1[0], argv1, envp) ; + if (!pid) strerr_warnwu2sys("spawn ", argv1[0]) ; + if (wait_pid(pid, &wstat) < 0) + strerr_diefu2sys(111, "wait for ", argv1[0]) ; + if (!argv2[0]) _exit(0) ; + j += uint_fmt(fmt + j, wait_status(wstat)) ; fmt[j++] = 0 ; + pathexec_r(argv2, envp, env_len(envp), fmt, j) ; strerr_dieexec(111, argv2[0]) ; } diff --git a/src/libexecline/el_getstrict.c b/src/libexecline/el_getstrict.c index 091845c..50127be 100644 --- a/src/libexecline/el_getstrict.c +++ b/src/libexecline/el_getstrict.c @@ -1,7 +1,7 @@ /* ISC license. */ #include <skalibs/env.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <execline/execline.h> unsigned int el_getstrict (void) diff --git a/src/libexecline/el_parse.c b/src/libexecline/el_parse.c index acff34a..53644ed 100644 --- a/src/libexecline/el_parse.c +++ b/src/libexecline/el_parse.c @@ -2,7 +2,7 @@ #include <sys/types.h> #include <stdint.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <skalibs/bytestr.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> @@ -56,7 +56,7 @@ int el_parse (stralloc *sa, el_chargen_func_t_ref next, void *source) if (c & 0x0200) { char tilde = EXECLINE_BLOCK_QUOTE_CHAR ; - register unsigned int i = blevel ; + unsigned int i = blevel ; if (!stralloc_readyplus(sa, i<<1)) return -1 ; while (i--) stralloc_catb(sa, &tilde, 1) ; } diff --git a/src/libexecline/el_parse_from_buffer.c b/src/libexecline/el_parse_from_buffer.c index 83862f3..f0d0578 100644 --- a/src/libexecline/el_parse_from_buffer.c +++ b/src/libexecline/el_parse_from_buffer.c @@ -7,7 +7,7 @@ static int next (unsigned char *c, void *p) { - register ssize_t r = buffer_get((buffer *)p, (char *)c, 1) ; + ssize_t r = buffer_get((buffer *)p, (char *)c, 1) ; if (r < 0) return 0 ; if (!r) *c = 0 ; return 1 ; diff --git a/src/libexecline/el_popenv.c b/src/libexecline/el_popenv.c index c0089d0..eff82cc 100644 --- a/src/libexecline/el_popenv.c +++ b/src/libexecline/el_popenv.c @@ -1,10 +1,10 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <errno.h> #include <skalibs/bytestr.h> #include <skalibs/stralloc.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <execline/execline.h> int el_popenv (stralloc *sa, char const *const *envp, size_t envlen, char const *const *list, size_t listlen) @@ -16,7 +16,7 @@ int el_popenv (stralloc *sa, char const *const *envp, size_t envlen, char const size_t equal, colon, n, j = 0 ; for (; j < listlen ; j++) if (str_start(envp[i], list[j])) break ; if (j == listlen) goto copyit ; - j = str_len(list[j]) ; + j = strlen(list[j]) ; colon = j + str_chr(envp[i] + j, ':') ; equal = j + str_chr(envp[i] + j, '=') ; if (!envp[i][equal]) goto badenv ; @@ -30,10 +30,10 @@ int el_popenv (stralloc *sa, char const *const *envp, size_t envlen, char const n = 1 + uint_fmt(fmt+1, n-1) ; if (!stralloc_catb(sa, fmt, n)) goto err ; } - if (!stralloc_catb(sa, envp[i] + equal, str_len(envp[i] + equal) + 1)) goto err ; + if (!stralloc_catb(sa, envp[i] + equal, strlen(envp[i] + equal) + 1)) goto err ; continue ; copyit: - if (!stralloc_catb(sa, envp[i], str_len(envp[i]) + 1)) goto err ; + if (!stralloc_catb(sa, envp[i], strlen(envp[i]) + 1)) goto err ; } return count ; diff --git a/src/libexecline/el_pushenv.c b/src/libexecline/el_pushenv.c index 4ec43bb..9af5ec5 100644 --- a/src/libexecline/el_pushenv.c +++ b/src/libexecline/el_pushenv.c @@ -1,10 +1,10 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <errno.h> #include <skalibs/bytestr.h> #include <skalibs/stralloc.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <execline/execline.h> int el_pushenv (stralloc *sa, char const *const *envp, size_t envlen, char const *const *list, size_t listlen) @@ -17,7 +17,7 @@ int el_pushenv (stralloc *sa, char const *const *envp, size_t envlen, char const for (; j < listlen ; j++) if (str_start(envp[i], list[j])) break ; if (j == listlen) goto copyit ; count++ ; - j = str_len(list[j]) ; + j = strlen(list[j]) ; colon = j + str_chr(envp[i] + j, ':') ; equal = j + str_chr(envp[i] + j, '=') ; if (!envp[i][equal]) goto badenv ; @@ -35,10 +35,10 @@ int el_pushenv (stralloc *sa, char const *const *envp, size_t envlen, char const if (!stralloc_catb(sa, envp[i], colon)) goto err ; if (!stralloc_catb(sa, fmt, n)) goto err ; } - if (!stralloc_catb(sa, envp[i] + equal, str_len(envp[i] + equal) + 1)) goto err ; + if (!stralloc_catb(sa, envp[i] + equal, strlen(envp[i] + equal) + 1)) goto err ; continue ; copyit: - if (!stralloc_catb(sa, envp[i], str_len(envp[i]) + 1)) goto err ; + if (!stralloc_catb(sa, envp[i], strlen(envp[i]) + 1)) goto err ; } return count ; diff --git a/src/libexecline/el_semicolon.c b/src/libexecline/el_semicolon.c index dc99daf..cfbfffd 100644 --- a/src/libexecline/el_semicolon.c +++ b/src/libexecline/el_semicolon.c @@ -2,17 +2,17 @@ #include <skalibs/env.h> #include <skalibs/strerr2.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <execline/execline.h> int el_semicolon (char const **argv) { static unsigned int nblock = 0 ; - register int argc1 = 0 ; + int argc1 = 0 ; nblock++ ; for (;; argc1++, argv++) { - register char const *arg = *argv ; + char const *arg = *argv ; if (!arg) return argc1 + 1 ; if ((arg[0] == EXECLINE_BLOCK_END_CHAR) && (!EXECLINE_BLOCK_END_CHAR || !arg[1])) return argc1 ; else if (arg[0] == EXECLINE_BLOCK_QUOTE_CHAR) ++*argv ; diff --git a/src/libexecline/el_substandrun_str.c b/src/libexecline/el_substandrun_str.c index a935b82..f87bddf 100644 --- a/src/libexecline/el_substandrun_str.c +++ b/src/libexecline/el_substandrun_str.c @@ -13,7 +13,7 @@ void el_substandrun_str (stralloc *src, size_t srcbase, char const *const *envp, exlsn_t const *info) { stralloc dst = STRALLOC_ZERO ; - register int r = el_substitute(&dst, src->s + srcbase, src->len, info->vars.s, info->values.s, genalloc_s(elsubst_t const, &info->data), genalloc_len(elsubst_t const, &info->data)) ; + int r = el_substitute(&dst, src->s + srcbase, src->len, info->vars.s, info->values.s, genalloc_s(elsubst_t const, &info->data), genalloc_len(elsubst_t const, &info->data)) ; if (r < 0) strerr_diefu1sys(111, "el_substitute") ; if (!r) _exit(0) ; stralloc_free(src) ; diff --git a/src/libexecline/el_transform.c b/src/libexecline/el_transform.c index 210cbdf..6048d1e 100644 --- a/src/libexecline/el_transform.c +++ b/src/libexecline/el_transform.c @@ -9,8 +9,8 @@ static void el_crunch (stralloc *sa, size_t base, char const *delim) { - register size_t i = base, j = base ; - register int crunching = 0 ; + size_t i = base, j = base ; + int crunching = 0 ; for (; i < sa->len ; i++) { if (!crunching) sa->s[j++] = sa->s[i] ; @@ -27,7 +27,7 @@ static void el_crunch (stralloc *sa, size_t base, char const *delim) static int el_split (stralloc *sa, size_t base, eltransforminfo_t const *si, int chomped) { int n = 0 ; - register size_t i = base ; + size_t i = base ; for (; i < sa->len ; i++) if (si->delim[str_chr(si->delim, sa->s[i])]) { @@ -51,7 +51,7 @@ static int el_splitnetstring (stralloc *sa, size_t base) int n = 0 ; while (i < sa->len) { - register ssize_t r = netstring_decode(&satmp, sa->s + i, sa->len - i) ; + ssize_t r = netstring_decode(&satmp, sa->s + i, sa->len - i) ; if (r < 0) goto err ; if (!stralloc_0(&satmp)) goto err ; i += r ; n++ ; diff --git a/src/libexecline/el_vardupl.c b/src/libexecline/el_vardupl.c index 279e79d..9efd586 100644 --- a/src/libexecline/el_vardupl.c +++ b/src/libexecline/el_vardupl.c @@ -6,7 +6,7 @@ int el_vardupl (char const *key, char const *s, size_t len) { - register size_t i = 0 ; + size_t i = 0 ; for (; i < len ; i += str_len(s + i) + 1) if (!str_diff(key, s + i)) return 1 ; return 0 ; diff --git a/src/libexecline/exlp.c b/src/libexecline/exlp.c index 1ba37c0..5e323a9 100644 --- a/src/libexecline/exlp.c +++ b/src/libexecline/exlp.c @@ -6,7 +6,7 @@ #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> #include <skalibs/genalloc.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <execline/execline.h> #include "exlsn.h" @@ -25,7 +25,7 @@ int exlp (unsigned int nmin, char const *const *envp, exlsn_t *info) if (el_vardupl("#", info->vars.s, info->vars.len)) return -2 ; if (el_vardupl("@", info->vars.s, info->vars.len)) return -2 ; { - register unsigned int strict = el_getstrict() ; + unsigned int strict = el_getstrict() ; if (strict && (n < nmin)) { char fmta[UINT_FMT] ; diff --git a/src/libexecline/exlsn_define.c b/src/libexecline/exlsn_define.c index 3abe516..066b8ff 100644 --- a/src/libexecline/exlsn_define.c +++ b/src/libexecline/exlsn_define.c @@ -16,7 +16,7 @@ int exlsn_define (int argc, char const **argv, char const *const *envp, exlsn_t blah.value = info->values.len ; for (;;) { - register int opt = subgetopt_r(argc, argv, "nsCcd:", &localopt) ; + int opt = subgetopt_r(argc, argv, "nsCcd:", &localopt) ; if (opt < 0) break ; switch (opt) { @@ -35,7 +35,7 @@ int exlsn_define (int argc, char const **argv, char const *const *envp, exlsn_t if (!stralloc_catb(&info->vars, argv[0], str_len(argv[0]) + 1)) return -1 ; if (!stralloc_cats(&info->values, argv[1])) goto err ; { - register int r = el_transform(&info->values, blah.value, &si) ; + int r = el_transform(&info->values, blah.value, &si) ; if (r < 0) goto err ; blah.n = r ; } diff --git a/src/libexecline/exlsn_elglob.c b/src/libexecline/exlsn_elglob.c index 67e939b..e64c598 100644 --- a/src/libexecline/exlsn_elglob.c +++ b/src/libexecline/exlsn_elglob.c @@ -29,7 +29,7 @@ int exlsn_elglob (int argc, char const **argv, char const *const *envp, exlsn_t blah.value = info->values.len ; for (;;) { - register int opt = subgetopt_r(argc, argv, "vwsme0", &localopt) ; + int opt = subgetopt_r(argc, argv, "vwsme0", &localopt) ; if (opt < 0) break ; switch (opt) { diff --git a/src/libexecline/exlsn_exlp.c b/src/libexecline/exlsn_exlp.c index 4ca513e..3a2e24b 100644 --- a/src/libexecline/exlsn_exlp.c +++ b/src/libexecline/exlsn_exlp.c @@ -1,7 +1,7 @@ /* ISC license. */ #include <skalibs/sgetopt.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include "exlsn.h" int exlsn_exlp (int argc, char const **argv, char const *const *envp, exlsn_t *info) @@ -11,7 +11,7 @@ int exlsn_exlp (int argc, char const **argv, char const *const *envp, exlsn_t *i int n ; for (;;) { - register int opt = subgetopt_r(argc, argv, "P:", &localopt) ; + int opt = subgetopt_r(argc, argv, "P:", &localopt) ; if (opt < 0) break ; switch (opt) { diff --git a/src/libexecline/exlsn_import.c b/src/libexecline/exlsn_import.c index 6e37fd0..3b3ddf9 100644 --- a/src/libexecline/exlsn_import.c +++ b/src/libexecline/exlsn_import.c @@ -23,7 +23,7 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp for (;;) { - register int opt = subgetopt_r(argc, argv, "iuD:nsCcd:", &localopt) ; + int opt = subgetopt_r(argc, argv, "iuD:nsCcd:", &localopt) ; if (opt < 0) break ; switch (opt) { @@ -56,7 +56,7 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp if (!x) blah.n = 0 ; else { - register int r ; + int r ; if (!stralloc_cats(&info->values, x)) goto err ; r = el_transform(&info->values, blah.value, &si) ; if (r < 0) goto err ; @@ -73,6 +73,7 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp int exlsn_import (int argc, char const **argv, char const *const *envp, exlsn_t *info) { + strerr_warn1x("the import command and directive are obsolescent, please use importas instead!") ; return exlsn_import_as(argc, argv, envp, info, 0) ; } diff --git a/src/libexecline/exlsn_multidefine.c b/src/libexecline/exlsn_multidefine.c index 9c5e248..4d84055 100644 --- a/src/libexecline/exlsn_multidefine.c +++ b/src/libexecline/exlsn_multidefine.c @@ -23,7 +23,7 @@ int exlsn_multidefine (int argc, char const **argv, char const *const *envp, exl si.split = 1 ; for (;;) { - register int opt = subgetopt_r(argc, argv, "0rnCcd:", &localopt) ; + int opt = subgetopt_r(argc, argv, "0rnCcd:", &localopt) ; if (opt < 0) break ; switch (opt) { @@ -45,7 +45,7 @@ int exlsn_multidefine (int argc, char const **argv, char const *const *envp, exl if (argc1 >= argc) return -3 ; if (!stralloc_cats(&info->values, x)) return -1 ; { - register int r = el_transform(&info->values, valbase, &si) ; + int r = el_transform(&info->values, valbase, &si) ; if (r < 0) goto err ; max = r ; } |