Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * linux/lib/cmdline.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Helper functions generally used for parsing kernel command line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * and module options.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Code and copyrights come from init/main.c and arch/i386/kernel/setup.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * GNU Indent formatting options for this file: -kr -i8 -npsl -pcs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/ctype.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *	If a hyphen was found in get_option, this will handle the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *	range of numbers, M-N.  This will expand the range and insert
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *	the values[M, M+1, ..., N] into the ints array in get_options.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) static int get_range(char **str, int *pint, int n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	int x, inc_counter, upper_range;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	(*str)++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	upper_range = simple_strtol((*str), NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	inc_counter = upper_range - *pint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	for (x = *pint; n && x < upper_range; x++, n--)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		*pint++ = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	return inc_counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  *	get_option - Parse integer from an option string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *	@str: option string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *	@pint: (output) integer value parsed from @str
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *	Read an int from an option string; if available accept a subsequent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  *	comma as well.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  *	Return values:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  *	0 - no int in string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  *	1 - int found, no subsequent comma
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  *	2 - int found including a subsequent comma
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  *	3 - hyphen found to denote a range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) int get_option(char **str, int *pint)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	char *cur = *str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	if (!cur || !(*cur))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	*pint = simple_strtol(cur, str, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	if (cur == *str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	if (**str == ',') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		(*str)++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		return 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	if (**str == '-')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		return 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) EXPORT_SYMBOL(get_option);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  *	get_options - Parse a string into a list of integers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  *	@str: String to be parsed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  *	@nints: size of integer array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  *	@ints: integer array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  *	This function parses a string containing a comma-separated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  *	list of integers, a hyphen-separated range of _positive_ integers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  *	or a combination of both.  The parse halts when the array is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  *	full, or when no more numbers can be retrieved from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  *	string.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  *	Return value is the character in the string which caused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  *	the parse to end (typically a null terminator, if @str is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  *	completely parseable).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) char *get_options(const char *str, int nints, int *ints)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	int res, i = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	while (i < nints) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		res = get_option((char **)&str, ints + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		if (res == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		if (res == 3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			int range_nums;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			range_nums = get_range((char **)&str, ints + i, nints - i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 			if (range_nums < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			 * Decrement the result by one to leave out the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 			 * last number in the range.  The next iteration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 			 * will handle the upper number in the range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			i += (range_nums - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		i++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		if (res == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	ints[0] = i - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	return (char *)str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) EXPORT_SYMBOL(get_options);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  *	memparse - parse a string with mem suffixes into a number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  *	@ptr: Where parse begins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  *	@retptr: (output) Optional pointer to next char after parse completes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  *	Parses a string into a number.  The number stored at @ptr is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  *	potentially suffixed with K, M, G, T, P, E.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) unsigned long long memparse(const char *ptr, char **retptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	char *endptr;	/* local pointer to end of parsed string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	unsigned long long ret = simple_strtoull(ptr, &endptr, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	switch (*endptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	case 'E':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	case 'e':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		ret <<= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		/* fall through */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	case 'P':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	case 'p':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		ret <<= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		/* fall through */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	case 'T':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	case 't':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		ret <<= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		/* fall through */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	case 'G':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	case 'g':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		ret <<= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		/* fall through */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	case 'M':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	case 'm':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		ret <<= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		/* fall through */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	case 'K':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	case 'k':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		ret <<= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		endptr++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	if (retptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		*retptr = endptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) EXPORT_SYMBOL(memparse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  *	parse_option_str - Parse a string and check an option is set or not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  *	@str: String to be parsed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  *	@option: option name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  *	This function parses a string containing a comma-separated list of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  *	strings like a=b,c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  *	Return true if there's such option in the string, or return false.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) bool parse_option_str(const char *str, const char *option)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	while (*str) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		if (!strncmp(str, option, strlen(option))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			str += strlen(option);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			if (!*str || *str == ',')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		while (*str && *str != ',')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			str++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		if (*str == ',')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			str++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * Parse a string to get a param value pair.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * You can use " around spaces, but can't escape ".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  * Hyphens and underscores equivalent in parameter names.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) char *next_arg(char *args, char **param, char **val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	unsigned int i, equals = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	int in_quote = 0, quoted = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	char *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	if (*args == '"') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		args++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		in_quote = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		quoted = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	for (i = 0; args[i]; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		if (isspace(args[i]) && !in_quote)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		if (equals == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 			if (args[i] == '=')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 				equals = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		if (args[i] == '"')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 			in_quote = !in_quote;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	*param = args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	if (!equals)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		*val = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		args[equals] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		*val = args + equals + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		/* Don't include quotes in value. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		if (**val == '"') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 			(*val)++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			if (args[i-1] == '"')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 				args[i-1] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	if (quoted && args[i-1] == '"')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		args[i-1] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	if (args[i]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		args[i] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 		next = args + i + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		next = args + i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	/* Chew up trailing spaces. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	return skip_spaces(next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }