File: spawnlp.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 (42 lines) | stat: -rw-r--r-- 633 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
40
41
42
#ifndef MSDOS

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

int _spawnlp (int mode, const char *prog, const char *av0, ...)
{
    va_list
    	marker;
    register char
   	*nextarg;
    char
    	buf [_MAX_PATH * 4];

    strcpy (buf, prog);

    va_start (marker, av0);
    nextarg = va_arg (marker, char*);

    while (nextarg)
    {
    	strcat (buf, " ");
    	strcat (buf, nextarg);
    	nextarg = va_arg (marker, char*);
    }

    return (system (buf));
}

#ifdef DEBUG
int main ()
{
    _spawnlp (0, "ls", "ls", "*.c", "*.h", NULL);

    return (0);
}
#endif

#endif