Man page - execsp(3)
Packages contains this manual
- eexecs(3)
- system_execsa(3)
- system_execsqp(3)
- system_execsqra(3)
- system_execsr(3)
- system_execsqrp(3)
- eexecspe(3)
- coprocspe(3)
- pclose_nosh(3)
- popen_execsp(3)
- system_execsra(3)
- coprocv(3)
- pclose_execs(3)
- coprocs(3)
- execs(3)
- execspe(3)
- system_nosh(3)
- system_eexecsp(3)
- coprocsp(3)
- pclose_execsp(3)
- esystem(3)
- coprocvp(3)
- coprocvpe(3)
- coprocse(3)
- system_execsqa(3)
- popen_execs(3)
- s2argv(3)
- popen_nosh(3)
- system_execsrp(3)
- eexecsp(3)
- execse(3)
- execsp(3)
- system_execs(3)
- coprocess(3)
- coprocve(3)
- system_execsp(3)
- system_safe(3)
- eexecse(3)
apt-get install libexecs-dev
Manual
execs
NAMESYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
SEE ALSO
BUGS
AUTHOR
NAME
execs, execsp, execspe - execute a file taking its arguments from a string
SYNOPSIS
#include
<unistd.h>
#include <execs.h>
int
execs(const char *
path
, const char
*
args
);
int execse(const char *
path
, const char
*
args
, char *const
envp
[]);
int execsp(const char *
args
);
int execspe(const char *
args
, char *const
envp
[]);
int
eexecs(const char *
path
, char
*
args
);
int eexecse(const char *
path
, char
*
args
, char *const
envp
[]);
int eexecsp(char *
args
);
int eexecspe(char *
args
, char *const
envp
[]);
These functions are provided by libexecs and libeexecs. Link with -lexecs or -leexecs .
DESCRIPTION
This group of
functions extends the family of
exec
(3) provided by
the libc.
execs
,
execse
,
execsp
and
execspe
are similar to
execv
(3),
execve
(2),
execvp
(3) and
execvpe
(3), respectively, but
take the command line arguments for the file to execute (and
the also the command name for
execsp
(3) and
execspe
(3)) by parsing a command string
args
.
Command arguments in
args
are delimited by space
characters (blank, tabs or new lines). Single or double
quotes can be used to delimitate command arguments including
spaces and a non quoted backslash (
\
) is the escape
character to protect the next char.
execs
,
execse
,
execsp
and
execspe
do not use dynamic allocation but require space on the stack
to store an entire copy of
args
.
eexecs
,
eexecse
,
eexecsp
and
eexecspe
do not
use extra stack space but modify
args
.
In case the same argv should be used for several exec command, use s2argv (3) to parse the args just once.
RETURN VALUE
These functions return only if an error has occurred. The return value is always -1. The failure cases and errno values are those specified for execve (2).
EXAMPLE
The following program demonstrates the use of execs :
#include
<stdio.h>
#include <unistd.h>
#include <execs.h>
#define BUFLEN
1024
int main(int argc, char *argv)
{
|
char buf[BUFLEN]; |
|||
|
printf("type in a command and its arguments, e.g. ’ls -l’\n"); |
|||
|
if (fgets(buf, BUFLEN, stdin) != NULL) { |
|||
|
execsp(buf); |
|||
|
printf("exec error\n"); |
|||
|
} |
}
SEE ALSO
exec (3), s2argv (3)
BUGS
Bug reports should be addressed to <info@virtualsquare.org>
AUTHOR
Renzo Davoli <renzo@cs.unibo.it>