xref: /aosp_15_r20/external/e2fsprogs/lib/support/argv_parse.h (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Worker /*
2*6a54128fSAndroid Build Coastguard Worker  * argv_parse.h --- header file for the argv parser.
3*6a54128fSAndroid Build Coastguard Worker  *
4*6a54128fSAndroid Build Coastguard Worker  * This file defines the interface for the functions argv_parse() and
5*6a54128fSAndroid Build Coastguard Worker  * argv_free().
6*6a54128fSAndroid Build Coastguard Worker  *
7*6a54128fSAndroid Build Coastguard Worker  ***********************************************************************
8*6a54128fSAndroid Build Coastguard Worker  * int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv)
9*6a54128fSAndroid Build Coastguard Worker  *
10*6a54128fSAndroid Build Coastguard Worker  * This function takes as its first argument a string which it will
11*6a54128fSAndroid Build Coastguard Worker  * parse into an argv argument vector, with each white-space separated
12*6a54128fSAndroid Build Coastguard Worker  * word placed into its own slot in the argv.  This function handles
13*6a54128fSAndroid Build Coastguard Worker  * double quotes and backslashes so that the parsed words can contain
14*6a54128fSAndroid Build Coastguard Worker  * special characters.   The count of the number words found in the
15*6a54128fSAndroid Build Coastguard Worker  * parsed string, as well as the argument vector, are returned into
16*6a54128fSAndroid Build Coastguard Worker  * ret_argc and ret_argv, respectively.
17*6a54128fSAndroid Build Coastguard Worker  ***********************************************************************
18*6a54128fSAndroid Build Coastguard Worker  * extern void argv_free(char **argv);
19*6a54128fSAndroid Build Coastguard Worker  *
20*6a54128fSAndroid Build Coastguard Worker  * This function frees the argument vector created by argv_parse().
21*6a54128fSAndroid Build Coastguard Worker  ***********************************************************************
22*6a54128fSAndroid Build Coastguard Worker  *
23*6a54128fSAndroid Build Coastguard Worker  * Copyright 1999 by Theodore Ts'o.
24*6a54128fSAndroid Build Coastguard Worker  *
25*6a54128fSAndroid Build Coastguard Worker  * Permission to use, copy, modify, and distribute this software for
26*6a54128fSAndroid Build Coastguard Worker  * any purpose with or without fee is hereby granted, provided that
27*6a54128fSAndroid Build Coastguard Worker  * the above copyright notice and this permission notice appear in all
28*6a54128fSAndroid Build Coastguard Worker  * copies.  THE SOFTWARE IS PROVIDED "AS IS" AND THEODORE TS'O (THE
29*6a54128fSAndroid Build Coastguard Worker  * AUTHOR) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
30*6a54128fSAndroid Build Coastguard Worker  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
31*6a54128fSAndroid Build Coastguard Worker  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
32*6a54128fSAndroid Build Coastguard Worker  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
33*6a54128fSAndroid Build Coastguard Worker  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
34*6a54128fSAndroid Build Coastguard Worker  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
35*6a54128fSAndroid Build Coastguard Worker  * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.  (Isn't
36*6a54128fSAndroid Build Coastguard Worker  * it sick that the U.S. culture of lawsuit-happy lawyers requires
37*6a54128fSAndroid Build Coastguard Worker  * this kind of disclaimer?)
38*6a54128fSAndroid Build Coastguard Worker  *
39*6a54128fSAndroid Build Coastguard Worker  * Version 1.1, modified 2/27/1999
40*6a54128fSAndroid Build Coastguard Worker  */
41*6a54128fSAndroid Build Coastguard Worker 
42*6a54128fSAndroid Build Coastguard Worker extern int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv);
43*6a54128fSAndroid Build Coastguard Worker extern void argv_free(char **argv);
44