diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/execline/deps-exe/import | 2 | ||||
-rw-r--r-- | src/execline/import.c | 12 | ||||
-rw-r--r-- | src/execline/multisubstitute.c | 6 | ||||
-rw-r--r-- | src/include-local/exlsn.h | 1 | ||||
-rw-r--r-- | src/libexecline/deps-lib/execline | 2 | ||||
-rw-r--r-- | src/libexecline/exlsn_importas.c (renamed from src/libexecline/exlsn_import.c) | 23 |
6 files changed, 9 insertions, 37 deletions
diff --git a/src/execline/deps-exe/import b/src/execline/deps-exe/import deleted file mode 100644 index 97021b5..0000000 --- a/src/execline/deps-exe/import +++ /dev/null @@ -1,2 +0,0 @@ -${LIBEXECLINE} --lskarnet diff --git a/src/execline/import.c b/src/execline/import.c deleted file mode 100644 index 7d58f01..0000000 --- a/src/execline/import.c +++ /dev/null @@ -1,12 +0,0 @@ -/* ISC license. */ - -#include <skalibs/strerr2.h> -#include "exlsn.h" - -#define USAGE "import [ -i | -D default ] [ -u ] [ -n ] [ -s ] [ -C | -c ] [ -d delim ] var prog..." - -int main (int argc, char const **argv, char const *const *envp) -{ - PROG = "import" ; - exlsn_main(argc, argv, envp, &exlsn_import, USAGE) ; -} diff --git a/src/execline/multisubstitute.c b/src/execline/multisubstitute.c index 444ea47..c004a41 100644 --- a/src/execline/multisubstitute.c +++ b/src/execline/multisubstitute.c @@ -7,22 +7,20 @@ #define USAGE "see http://skarnet.org/software/execline/multisubstitute.html" -static char const *const commands[8] = +static char const *const commands[] = { "define", "importas", - "import", "elglob", "elgetpositionals", "multidefine", 0 } ; -static exlsnfunc_t_ref const functions[8] = +static exlsnfunc_t_ref const functions[] = { &exlsn_define, &exlsn_importas, - &exlsn_import, &exlsn_elglob, &exlsn_exlp, &exlsn_multidefine, diff --git a/src/include-local/exlsn.h b/src/include-local/exlsn.h index 238bd6b..832a67b 100644 --- a/src/include-local/exlsn.h +++ b/src/include-local/exlsn.h @@ -25,7 +25,6 @@ typedef exlsnfunc_t *exlsnfunc_t_ref ; extern exlsnfunc_t exlsn_define ; extern exlsnfunc_t exlsn_importas ; -extern exlsnfunc_t exlsn_import ; extern exlsnfunc_t exlsn_elglob ; extern exlsnfunc_t exlsn_exlp ; extern exlsnfunc_t exlsn_multidefine ; diff --git a/src/libexecline/deps-lib/execline b/src/libexecline/deps-lib/execline index 13a7352..96d4e18 100644 --- a/src/libexecline/deps-lib/execline +++ b/src/libexecline/deps-lib/execline @@ -15,7 +15,7 @@ el_transform.o el_vardupl.o exlsn_define.o exlsn_elglob.o -exlsn_import.o +exlsn_importas.o exlsn_multidefine.o exlsn_exlp.o exlsn_main.o diff --git a/src/libexecline/exlsn_import.c b/src/libexecline/exlsn_importas.c index 254ab78..d8d9ff6 100644 --- a/src/libexecline/exlsn_import.c +++ b/src/libexecline/exlsn_importas.c @@ -9,7 +9,7 @@ #include <execline/execline.h> #include "exlsn.h" -static int exlsn_import_as (int argc, char const **argv, char const *const *envp, exlsn_t *info, unsigned int as) +int exlsn_importas (int argc, char const **argv, char const *const *envp, exlsn_t *info) { eltransforminfo_t si = ELTRANSFORMINFO_ZERO ; subgetopt_t localopt = SUBGETOPT_ZERO ; @@ -40,18 +40,18 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp } argc -= localopt.ind ; argv += localopt.ind ; - if ((unsigned int)argc < 1+as) return -3 ; + if ((unsigned int)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], strlen(argv[0]) + 1)) return -1 ; - x = env_get2(envp, argv[as]) ; + x = env_get2(envp, argv[1]) ; if (!x) { - if (insist) strerr_dienotset(100, argv[as]) ; + if (insist) strerr_dienotset(100, argv[1]) ; x = defaultval ; } else if (unexport) { - if (!stralloc_catb(&info->modifs, argv[as], strlen(argv[as]) + 1)) goto err ; + if (!stralloc_catb(&info->modifs, argv[1], strlen(argv[1]) + 1)) goto err ; } if (!x) blah.n = 0 ; else @@ -63,21 +63,10 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp blah.n = r ; } if (!genalloc_append(elsubst_t, &info->data, &blah)) goto err ; - return localopt.ind + 1 + as ; + return localopt.ind + 2 ; err: info->vars.len = blah.var ; info->values.len = blah.value ; return -1 ; } - -int exlsn_import (int argc, char const **argv, char const *const *envp, exlsn_t *info) -{ - strerr_warnw1x("the import command and directive are obsolescent, please use importas instead!") ; - return exlsn_import_as(argc, argv, envp, info, 0) ; -} - -int exlsn_importas (int argc, char const **argv, char const *const *envp, exlsn_t *info) -{ - return exlsn_import_as(argc, argv, envp, info, 1) ; -} |