argv_parse.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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().
  6. *
  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);
  19. *
  20. * This function frees the argument vector created by argv_parse().
  21. ***********************************************************************
  22. *
  23. * Copyright 1999 by Theodore Ts'o.
  24. *
  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. extern int argv_parse(const char *in_buf, int *ret_argc, char ***ret_argv);
  42. extern void argv_free(char **argv);