diff options
Diffstat (limited to 'src/libexecline')
-rw-r--r-- | src/libexecline/el_substitute.c | 8 | ||||
-rw-r--r-- | src/libexecline/el_transform.c | 9 | ||||
-rw-r--r-- | src/libexecline/el_vardupl.c | 7 | ||||
-rw-r--r-- | src/libexecline/exlp.c | 9 | ||||
-rw-r--r-- | src/libexecline/exlsn_define.c | 4 | ||||
-rw-r--r-- | src/libexecline/exlsn_elglob.c | 6 | ||||
-rw-r--r-- | src/libexecline/exlsn_import.c | 6 | ||||
-rw-r--r-- | src/libexecline/exlsn_multidefine.c | 7 |
8 files changed, 26 insertions, 30 deletions
diff --git a/src/libexecline/el_substitute.c b/src/libexecline/el_substitute.c index 9fa2f70..6f50c2c 100644 --- a/src/libexecline/el_substitute.c +++ b/src/libexecline/el_substitute.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <skalibs/bytestr.h> #include <skalibs/stralloc.h> #include <skalibs/genalloc.h> @@ -65,12 +65,12 @@ static ssize_t parseword (stralloc *sa, genalloc *list, char const *s, char cons unsigned int i = 0 ; for (; i < nsubst ; i++) { - if (!str_diffn(vars + substs[i].var, s + mark, pos - mark) && !vars[substs[i].var + pos - mark]) + if (!strncmp(vars + substs[i].var, s + mark, pos - mark) && !vars[substs[i].var + pos - mark]) { sa->len -= esc >> 1 ; offset += esc >> 1 ; if (esc & 1) { - byte_copy(sa->s + mark - offset - 2 - supp, pos - mark + 1 + supp, sa->s + mark - offset + (esc>>1) - 1 - supp) ; + memcpy(sa->s + mark - offset - 2 - supp, sa->s + mark - offset + (esc>>1) - 1 - supp, pos - mark + 1 + supp) ; sa->len-- ; offset++ ; } else @@ -118,7 +118,7 @@ static int substword (subsuinfo_t *info, size_t wordstart, size_t wordlen, unsig stralloc_catb(&info->sa, info->sa.s + wordstart, l) ; for (; i < list[n].subst->n ; i++) { - size_t plen = str_len(p) ; + size_t plen = strlen(p) ; int r ; info->sa.len = sabase + l ; if (!stralloc_readyplus(&info->sa, plen + wordlen - l)) goto err ; diff --git a/src/libexecline/el_transform.c b/src/libexecline/el_transform.c index 6048d1e..59c146d 100644 --- a/src/libexecline/el_transform.c +++ b/src/libexecline/el_transform.c @@ -1,7 +1,6 @@ /* ISC license. */ -#include <sys/types.h> -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/netstring.h> #include <skalibs/skamisc.h> #include <skalibs/stralloc.h> @@ -14,7 +13,7 @@ static void el_crunch (stralloc *sa, size_t base, char const *delim) for (; i < sa->len ; i++) { if (!crunching) sa->s[j++] = sa->s[i] ; - if (delim[str_chr(delim, sa->s[i])]) crunching = 1 ; + if (strchr(delim, sa->s[i])) crunching = 1 ; else if (crunching) { i-- ; @@ -29,7 +28,7 @@ static int el_split (stralloc *sa, size_t base, eltransforminfo_t const *si, int int n = 0 ; size_t i = base ; for (; i < sa->len ; i++) - if (si->delim[str_chr(si->delim, sa->s[i])]) + if (strchr(si->delim, sa->s[i])) { sa->s[i] = 0 ; n++ ; @@ -75,7 +74,7 @@ int el_transform (stralloc *sa, size_t i, eltransforminfo_t const *si) int chomped = 0 ; if (si->crunch && *si->delim) el_crunch(sa, i, si->delim) ; if (si->chomp && (sa->len > i) - && si->delim[str_chr(si->delim, sa->s[sa->len-1])]) + && strchr(si->delim, sa->s[sa->len-1])) { sa->len-- ; chomped = 1 ; diff --git a/src/libexecline/el_vardupl.c b/src/libexecline/el_vardupl.c index 9efd586..d6c7dbf 100644 --- a/src/libexecline/el_vardupl.c +++ b/src/libexecline/el_vardupl.c @@ -1,13 +1,12 @@ /* ISC license. */ -#include <sys/types.h> -#include <skalibs/bytestr.h> +#include <string.h> #include <execline/execline.h> int el_vardupl (char const *key, char const *s, size_t len) { size_t i = 0 ; - for (; i < len ; i += str_len(s + i) + 1) - if (!str_diff(key, s + i)) return 1 ; + for (; i < len ; i += strlen(s + i) + 1) + if (!strcmp(key, s + i)) return 1 ; return 0 ; } diff --git a/src/libexecline/exlp.c b/src/libexecline/exlp.c index 5e323a9..1fae415 100644 --- a/src/libexecline/exlp.c +++ b/src/libexecline/exlp.c @@ -1,7 +1,6 @@ /* ISC license. */ -#include <sys/types.h> -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/env.h> #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> @@ -42,7 +41,7 @@ int exlp (unsigned int nmin, char const *const *envp, exlsn_t *info) blah.value = info->values.len ; blah.n = 1 ; if (!stralloc_catb(&info->vars, "#\0@", 4) - || !stralloc_catb(&info->values, x, str_len(x) + 1) + || !stralloc_catb(&info->values, x, strlen(x) + 1) || !genalloc_append(elsubst_t, &info->data, &blah)) goto err ; ntot = n > nmin ? n : nmin ; poszero = info->values.len ; @@ -58,11 +57,11 @@ int exlp (unsigned int nmin, char const *const *envp, exlsn_t *info) blah.value = info->values.len ; blah.n = 1 ; if (!stralloc_catb(&info->vars, fmt, l+1) - || !stralloc_catb(&info->values, x, str_len(x) + 1) + || !stralloc_catb(&info->values, x, strlen(x) + 1) || !genalloc_append(elsubst_t, &info->data, &blah)) goto err ; } blah.var = varbase + 2 ; - blah.value = poszero + str_len(info->values.s + poszero) + 1 ; + blah.value = poszero + strlen(info->values.s + poszero) + 1 ; blah.n = n ; if (!genalloc_append(elsubst_t, &info->data, &blah)) goto err ; return n ; diff --git a/src/libexecline/exlsn_define.c b/src/libexecline/exlsn_define.c index 066b8ff..3e7429c 100644 --- a/src/libexecline/exlsn_define.c +++ b/src/libexecline/exlsn_define.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/sgetopt.h> #include <skalibs/stralloc.h> #include <skalibs/genalloc.h> @@ -32,7 +32,7 @@ int exlsn_define (int argc, char const **argv, char const *const *envp, exlsn_t if (argc < 2) return -3 ; if (!*argv[0] || el_vardupl(argv[0], info->vars.s, info->vars.len)) return -2 ; - if (!stralloc_catb(&info->vars, argv[0], str_len(argv[0]) + 1)) return -1 ; + if (!stralloc_catb(&info->vars, argv[0], strlen(argv[0]) + 1)) return -1 ; if (!stralloc_cats(&info->values, argv[1])) goto err ; { int r = el_transform(&info->values, blah.value, &si) ; diff --git a/src/libexecline/exlsn_elglob.c b/src/libexecline/exlsn_elglob.c index e64c598..62734e6 100644 --- a/src/libexecline/exlsn_elglob.c +++ b/src/libexecline/exlsn_elglob.c @@ -2,7 +2,7 @@ #include <errno.h> #include <glob.h> -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> @@ -46,7 +46,7 @@ int exlsn_elglob (int argc, char const **argv, char const *const *envp, exlsn_t if (argc < 2) return -3 ; if (!*argv[0] || el_vardupl(argv[0], info->vars.s, info->vars.len)) return -2 ; - if (!stralloc_catb(&info->vars, argv[0], str_len(argv[0]) + 1)) return -1 ; + if (!stralloc_catb(&info->vars, argv[0], strlen(argv[0]) + 1)) return -1 ; pglob.gl_offs = 0 ; switch (glob(argv[1], flags, verbose ? &elgloberrfunc : 0, &pglob)) @@ -61,7 +61,7 @@ int exlsn_elglob (int argc, char const **argv, char const *const *envp, exlsn_t default: goto err ; } for ( ; i < (unsigned int)pglob.gl_pathc ; i++) - if (!stralloc_catb(&info->values, pglob.gl_pathv[i], str_len(pglob.gl_pathv[i]) + 1)) + if (!stralloc_catb(&info->values, pglob.gl_pathv[i], strlen(pglob.gl_pathv[i]) + 1)) goto globerr ; blah.n = pglob.gl_pathc ; globfree(&pglob) ; diff --git a/src/libexecline/exlsn_import.c b/src/libexecline/exlsn_import.c index ff05113..254ab78 100644 --- a/src/libexecline/exlsn_import.c +++ b/src/libexecline/exlsn_import.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> @@ -42,7 +42,7 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp if ((unsigned int)argc < 1+as) return -3 ; if (!*argv[0] || el_vardupl(argv[0], info->vars.s, info->vars.len)) return -2 ; - if (!stralloc_catb(&info->vars, argv[0], str_len(argv[0]) + 1)) return -1 ; + if (!stralloc_catb(&info->vars, argv[0], strlen(argv[0]) + 1)) return -1 ; x = env_get2(envp, argv[as]) ; if (!x) { @@ -51,7 +51,7 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp } else if (unexport) { - if (!stralloc_catb(&info->modifs, argv[as], str_len(argv[as]) + 1)) goto err ; + if (!stralloc_catb(&info->modifs, argv[as], strlen(argv[as]) + 1)) goto err ; } if (!x) blah.n = 0 ; else diff --git a/src/libexecline/exlsn_multidefine.c b/src/libexecline/exlsn_multidefine.c index 4d84055..bf50087 100644 --- a/src/libexecline/exlsn_multidefine.c +++ b/src/libexecline/exlsn_multidefine.c @@ -1,8 +1,7 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <skalibs/sgetopt.h> -#include <skalibs/bytestr.h> #include <skalibs/stralloc.h> #include <skalibs/genalloc.h> #include <execline/execline.h> @@ -57,12 +56,12 @@ int exlsn_multidefine (int argc, char const **argv, char const *const *envp, exl elsubst_t blah ; blah.var = info->vars.len ; if (el_vardupl(argv[i], info->vars.s, info->vars.len)) goto err2 ; - if (!stralloc_catb(&info->vars, argv[i], str_len(argv[i]) + 1)) goto err ; + if (!stralloc_catb(&info->vars, argv[i], strlen(argv[i]) + 1)) goto err ; blah.value = i < max ? pos : info->values.len - 1 ; blah.n = (i < max) || !zeroword ; if (!genalloc_append(elsubst_t, &info->data, &blah)) goto err ; } - if (i < max) pos += str_len(info->values.s + pos) + 1 ; + if (i < max) pos += strlen(info->values.s + pos) + 1 ; } if ((i < max) && likeread) genalloc_s(elsubst_t, &info->data)[i-1].n = max - i + 1 ; |