summaryrefslogtreecommitdiff
path: root/src/libexecline/exlsn_import.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-12-31 12:30:13 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-12-31 12:30:13 +0000
commit151f30888748cc37b82c1c21c4428c53279bf8eb (patch)
tree74609951ea0c8a3062a4093323089b64947591b7 /src/libexecline/exlsn_import.c
parentea96addef47063dc6858c63f00e8e9731a31a990 (diff)
downloadexecline-151f30888748cc37b82c1c21c4428c53279bf8eb.tar.xz
Add option -u to import and importas
Diffstat (limited to 'src/libexecline/exlsn_import.c')
-rw-r--r--src/libexecline/exlsn_import.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libexecline/exlsn_import.c b/src/libexecline/exlsn_import.c
index 1574027..6e37fd0 100644
--- a/src/libexecline/exlsn_import.c
+++ b/src/libexecline/exlsn_import.c
@@ -17,16 +17,18 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp
char const *defaultval = 0 ;
char const *x ;
int insist = 0 ;
+ int unexport = 0 ;
blah.var = info->vars.len ;
blah.value = info->values.len ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "iD:nsCcd:", &localopt) ;
+ register int opt = subgetopt_r(argc, argv, "iuD:nsCcd:", &localopt) ;
if (opt < 0) break ;
switch (opt)
{
case 'i' : insist = 1 ; break ;
+ case 'u' : unexport = 1 ; break ;
case 'D' : defaultval = localopt.arg ; break ;
case 'n' : si.chomp = 1 ; break ;
case 's' : si.split = 1 ; break ;
@@ -47,6 +49,10 @@ static int exlsn_import_as (int argc, char const **argv, char const *const *envp
if (insist) strerr_dienotset(100, argv[as]) ;
x = defaultval ;
}
+ else if (unexport)
+ {
+ if (!stralloc_catb(&info->modifs, argv[as], str_len(argv[as]) + 1)) goto err ;
+ }
if (!x) blah.n = 0 ;
else
{