Denys Vlasenko | 727948e | 2017-08-04 16:23:42 +0200 | [diff] [blame^] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * Copyright (C) 2017 Denys Vlasenko |
| 4 | * |
| 5 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 6 | */ |
| 7 | #include "libbb.h" |
| 8 | |
| 9 | //kbuild:lib-y += getopt_allopts.o |
| 10 | |
| 11 | void FAST_FUNC make_all_argv_opts(char **argv) |
| 12 | { |
| 13 | /* Note: we skip argv[0] */ |
| 14 | while (*++argv) { |
| 15 | char *p; |
| 16 | |
| 17 | if (argv[0][0] == '-') |
| 18 | continue; |
| 19 | /* Neither top nor ps care if "" arg turns into "-" */ |
| 20 | /*if (argv[0][0] == '\0') |
| 21 | continue;*/ |
| 22 | p = xmalloc(strlen(*argv) + 2); |
| 23 | *p = '-'; |
| 24 | strcpy(p + 1, *argv); |
| 25 | *argv = p; |
| 26 | } |
| 27 | } |