File: vmsmain.c

package info (click to toggle)
fsp 2.81.b3-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,072 kB
  • ctags: 1,264
  • sloc: ansic: 7,764; makefile: 357; sh: 312
file content (32 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>

int
main(int argc,char **argv,char **envp)
{
char *arg,*here;
int ac=1,count=1;	/* argument counts */
char *av[255]; /* will go wrong when you have more than 255 arguments.. */

av[0]=argv[0]; /* 0th argument always name of command */

while (count<argc)
{
 arg=here=argv[count]; /* get the 1st argument */

 while (*here==' ') { arg++; here++; } /* string leading spaces */

 while (*here)
 {
  if ((*here)==' ') /* arguments separated with spaces */
  { *here=0;	  /* terminate this one */
    av[ac++]=arg; /* add it to the new argument list */
    arg=here+1;   /* hold the next arg. */
  }
  here++;
 }
 if (*arg) av[ac++]=arg; /* last of this argument */
 count++;
}

return(vms_main(ac,av,envp));
}