OSDN Git Service

* gcc.c-torture/execute/990628-1.c: Tweak to work on targets
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 980707-1.c
1 #include <stdio.h>
2 #include <ctype.h>
3 #include <string.h>
4
5 char **
6 buildargv (char *input)
7 {
8   static char *arglist[256];
9   int numargs = 0;
10
11   while (1)
12     {
13       while (isspace ((unsigned char)*input) && *input != 0)
14         input++;
15       if (*input == 0)
16         break;
17       arglist [numargs++] = input;
18       while (!isspace ((unsigned char)*input) && *input != 0)
19         input++;
20       if (*input == 0)
21         break;
22       *(input++) = 0;
23     }
24   arglist [numargs] = NULL;
25   return arglist;
26 }
27
28
29 int main()
30 {
31   char **args;
32   char input[256];
33   int i;
34
35   strcpy(input, " a b");
36   args = buildargv(input);
37
38   if (strcmp (args[0], "a"))
39     abort ();
40   if (strcmp (args[1], "b"))
41     abort ();
42   if (args[2] != NULL)
43     abort ();
44   
45   exit (0);
46 }