GRASS Programmer's Manual
6.5.svn(2014)-r66266
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
run.c
Go to the documentation of this file.
1
2
/****************************************************************
3
this program runs its arguments as a commmand. it essentially
4
does what the sh would do to look for the command. if / occurs in
5
the command it runs it as is, otherwise it search the PATH
6
variable. care is taken to preserve the PATH variable that is
7
passed (as part of the environment) to the command being invoked.
8
9
the signals SIGINT and SIGQUIT are set to the default action
10
before running the command.
11
12
This program is needed because the GIS shell must ignore
13
interrupts when it runs the user's shell. There is no way to tell
14
the user's shell to re-activate interrupts in shell-ese.
15
****************************************************************/
16
17
#include <stdio.h>
18
#include <stdlib.h>
19
#include <signal.h>
20
#include <unistd.h>
21
#include "
local_proto.h
"
22
23
int
main
(
int
argc,
char
*argv[])
24
{
25
signal
(SIGINT, SIG_DFL);
26
#ifndef __MINGW32__
27
signal
(SIGQUIT, SIG_DFL);
28
#endif
29
30
argc--;
31
argv++;
32
if
(argc <= 0)
33
exit(1);
34
35
execvp(argv[0], argv);
36
fprintf(stderr,
"%s: Command not found\n"
, argv[0]);
37
exit(127);
38
39
exit(0);
40
}
main
int main(int argc, char *argv[])
Definition:
gem/main.c:302
signal
Definition:
spawn.c:69
local_proto.h
lib
init
run.c
Generated on Sat Jan 2 2016 01:46:49 for GRASS Programmer's Manual by
1.8.5