aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-01-25 16:20:00 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-01-25 16:20:00 +0100
commitc561aca4c9affa597d6a36d39d8a65c58ca78c87 (patch)
treefd70e77ba7191a5634a6995e5afa5caba8d0382b
parente31cd95dc2be55573d083c55636fe5d19c1421e6 (diff)
downloadmblaze-c561aca4c9affa597d6a36d39d8a65c58ca78c87.tar.gz
mflag: add: skip leading whitespace
-rw-r--r--mflag.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/mflag.c b/mflag.c
index 1c6dace..73941d2 100644
--- a/mflag.c
+++ b/mflag.c
@@ -26,16 +26,18 @@ char *curfile;
void
add(char *file)
{
- if (idx >= argsalloc) {
- argsalloc *= 2;
- if (argsalloc < 0)
- exit(-1);
- args = realloc(args, sizeof (char *) * argsalloc);
- }
- if (!args)
- exit(-1);
- args[idx] = strdup(file);
- idx++;
+ if (idx >= argsalloc) {
+ argsalloc *= 2;
+ if (argsalloc < 0)
+ exit(-1);
+ args = realloc(args, sizeof (char *) * argsalloc);
+ }
+ if (!args)
+ exit(-1);
+ while (*file == ' ' || *file == '\t')
+ file++;
+ args[idx] = strdup(file);
+ idx++;
}
void