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