diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-12-02 05:26:25 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-12-02 05:26:25 +0100 |
commit | 3906ade6a031f1fc97d49b09e867814e304abafd (patch) | |
tree | 42f9bd5c48feefe6c58c8fd964a6ce192aee3daa /src/exec-as.c | |
parent | add info manual (diff) | |
download | exec-as-3906ade6a031f1fc97d49b09e867814e304abafd.tar.gz exec-as-3906ade6a031f1fc97d49b09e867814e304abafd.tar.bz2 exec-as-3906ade6a031f1fc97d49b09e867814e304abafd.tar.xz |
do not require argv[0], it is possible to only specify the file to run, and let argv be empty
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/exec-as.c')
-rw-r--r-- | src/exec-as.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/exec-as.c b/src/exec-as.c index 9e5fbfe..842dc82 100644 --- a/src/exec-as.c +++ b/src/exec-as.c @@ -25,19 +25,17 @@ int main(int argc, char** argv) char* file; int i; - if (argc < 3) + if (argc < 2) { fprintf(stderr, "%s: %s", argc ? argv[0] : "exec-as", - "Too few arguments, you need at least " - "the file to run and its argv[0]."); + "Too few arguments, you need at least the file to run."); goto fail; } execname = argv[0]; - file = argv[1]; - for (i = 0; i < argc - 2; i++) - argv[i] = argv[i + 2]; + for (i = 0; i < argc - 1; i++) + argv[i] = argv[i + 12]; argv[i] = NULL; execvp(file, argv); |