diff options
author | Dodji Seketeli <dodji@src.gnome.org> | 2003-02-27 19:11:25 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@src.gnome.org> | 2003-02-27 19:11:25 +0000 |
commit | 1bab70f1eff9d282467d6b9188d6f4f22fdd4e1b (patch) | |
tree | 2e89ee75d71eb8ece979b1560c209a2438e06a25 /tests/cr-test-utils.c | |
download | libcroco-1bab70f1eff9d282467d6b9188d6f4f22fdd4e1b.tar.gz |
Initial revision
Diffstat (limited to 'tests/cr-test-utils.c')
-rw-r--r-- | tests/cr-test-utils.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/cr-test-utils.c b/tests/cr-test-utils.c new file mode 100644 index 0000000..b39419e --- /dev/null +++ b/tests/cr-test-utils.c @@ -0,0 +1,43 @@ +#include <string.h> +#include "cr-test-utils.h" + +/** + *Parses the command line. + *@param a_argc the argc parameter of the main routine. + *@param the argv parameter of the main routine. + *@param a_options out parameter the parsed options. + */ +void +cr_test_utils_parse_cmd_line (int a_argc, char **a_argv, + struct Options *a_options) +{ + int i= 0 ; + + g_return_if_fail (a_options) ; + + memset (a_options, 0, sizeof (struct Options)) ; + + for (i = 1 ; i < a_argc ; i++) + { + if (a_argv[i][0] != '-') break ; + + if (!strcmp (a_argv[i], "-h") || !strcmp (a_argv[i], "--help")) + { + a_options->display_help = TRUE ; + } + if (!strcmp (a_argv[i], "--about")) + { + a_options->display_about = TRUE ; + } + } + + if (i >= a_argc) + { + /*No file parameter where given*/ + a_options->files_list = NULL ; + } + else + { + a_options->files_list = &a_argv[i] ; + } +} |