about summary refs log tree commit diff
path: root/posix/wordexp-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/wordexp-test.c')
-rw-r--r--posix/wordexp-test.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 75cfe5f360..2a94caa367 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -89,8 +89,19 @@ struct test_case_struct
 
 static int testit (struct test_case_struct *tc);
 
+void
+command_line_test (const char *words)
+{
+  wordexp_t we;
+  int i;
+  int retval = wordexp (words, &we, 0);
+  printf ("wordexp returned %d\n", retval);
+  for (i = 0; i < we.we_wordc; i++)
+    printf ("we_wordv[%d] = \"%s\"\n", i, we.we_wordv[i]);
+}
+
 int
-main (int argc, char * argv[])
+main (int argc, char *argv[])
 {
   struct passwd *pw;
   int test;
@@ -101,6 +112,12 @@ main (int argc, char * argv[])
     if (testit (&test_case[test]))
       ++fail;
 
+  if (argc > 1)
+    {
+      command_line_test (argv[1]);
+      return 0;
+    }
+
   pw = getpwnam ("root");
   if (pw != NULL)
     {