/* @argvp: Returns newly allocated args list @add_args: Arguments to add, each a string @count: Number of arguments in @add_args  */
static int add_args(char ***argvp, char *add_args[], int count)
/* @argvp: Returns newly allocated args list @add_args: Arguments to add, each a string @count: Number of arguments in @add_args  */
static int add_args(char ***argvp, char *add_args[], int count)
{
	char **argv, **ap;
	int argc;
	for (argc = 0; (*argvp)[argc]; argc++)
		;
	argv = os_malloc((argc + count + 1) * sizeof(char *));
	if (!argv) {
		printf("Out of memory for %d argv\n", count);
		return -ENOMEM;
	}
	for (ap = *argvp, argc = 0; *ap; ap++) {
		char *arg = *ap;
		if (*arg == '-' && strlen(arg) == 2) {
			switch (arg[1]) {
			case 'j':
			case 'm':
				ap++;
				continue;
			}
		} else if (!strcmp(arg, "--rm_memory")) {
			ap++;
			continue;
		}
		argv[argc++] = arg;
	}
	memcpy(argv + argc, add_args, count * sizeof(char *));
	argv[argc + count] = NULL;
	*argvp = argv;
	return 0;
}