From 3906ade6a031f1fc97d49b09e867814e304abafd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 2 Dec 2015 05:26:25 +0100 Subject: do not require argv[0], it is possible to only specify the file to run, and let argv be empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/exec-as.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2