summaryrefslogtreecommitdiff
path: root/src/execline/export.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/execline/export.c')
-rw-r--r--src/execline/export.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/execline/export.c b/src/execline/export.c
index b189268..5319c71 100644
--- a/src/execline/export.c
+++ b/src/execline/export.c
@@ -1,7 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
#include <skalibs/djbunix.h>
@@ -13,15 +12,15 @@ int main (int argc, char const *const *argv, char const *const *envp)
size_t len1 ;
PROG = "export" ;
if (argc < 4) strerr_dieusage(100, USAGE) ;
- len1 = str_len(argv[1]) ;
- if (byte_chr(argv[1], len1, '=') < len1)
+ len1 = strlen(argv[1]) ;
+ if (memchr(argv[1], '=', len1))
strerr_dief2x(100, "invalid variable name: ", argv[1]) ;
{
- size_t len2 = str_len(argv[2]) ;
+ size_t len2 = strlen(argv[2]) ;
char fmt[len1 + len2 + 2] ;
- byte_copy(fmt, len1, argv[1]) ;
+ memcpy(fmt, argv[1], len1) ;
fmt[len1] = '=' ;
- byte_copy(fmt + len1 + 1, len2 + 1, argv[2]) ;
+ memcpy(fmt + len1 + 1, argv[2], len2 + 1) ;
pathexec_r(argv+3, envp, env_len(envp), fmt, len1 + len2 + 2) ;
}
strerr_dieexec(111, argv[3]) ;