Welcome to mirror list, hosted at ThFree Co, Russian Federation.

single_argv.c « libbb - git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 594cb0d8dc05f12cb537cd7c77af47f4e3bd0ad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* vi: set sw=4 ts=4: */
/*
 * Utility routines.
 *
 * Copyright (C) 2009 Denys Vlasenko
 *
 * Licensed under GPLv2, see file LICENSE in this source tree.
 */
#include "libbb.h"

char** FAST_FUNC skip_dash_dash(char **argv)
{
	argv++;
	if (argv[0] && argv[0][0] == '-' && argv[0][1] == '-' && argv[0][2] == '\0')
		argv++;
	return argv;
}

char* FAST_FUNC single_argv(char **argv)
{
	argv = skip_dash_dash(argv);
	if (!argv[0] || argv[1])
		bb_show_usage();
	return argv[0];
}