File: spawnvp.c

package info (click to toggle)
icmake 6.22-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,148 kB
  • ctags: 1,042
  • sloc: ansic: 9,241; makefile: 1,134; sh: 235; asm: 126
file content (39 lines) | stat: -rw-r--r-- 537 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
33
34
35
36
37
38
39
#ifndef MSDOS

#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "icrssdef.h"

int _spawnvp (int mode, const char *prog, const char **av)
{
    char
    	buf [_MAX_PATH * 4];

    strcpy (buf, prog);
    av++;

    while (*av)
    {
    	strcat (buf, " ");
    	strcat (buf, *av);
    	av++;
    }

    return (system (buf));
}

#ifdef DEBUG
int main ()
{
    static char
    	*args [] = { "ls", "*.c", "*.h", NULL };

    _spawnvp (0, "ls", (const char **) args);

    return (0);
}
#endif

#endif