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