FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
sys_hshell.c
Go to the documentation of this file.
1
/* SHELL command */
2
3
#include "../fb.h"
4
#include "
fb_private_console.h
"
5
#include <sys/wait.h>
6
7
int
fb_hShell
(
char
*program )
8
{
9
int
errcode;
10
11
FB_LOCK
( );
12
fb_hExitConsole
();
13
FB_UNLOCK
( );
14
15
errcode = system( program );
16
17
/* system() result uses same format as the status
18
returned by waitpid(), or -1 on error */
19
if
( errcode != -1 && WIFEXITED( errcode ) ) {
20
errcode = WEXITSTATUS( errcode );
21
if
( errcode == 127 ) {
22
/* /bin/sh could not be executed */
23
/* FIXME: can't tell difference if /bin/sh returned 127 */
24
errcode = -1;
25
}
26
}
27
28
FB_LOCK
( );
29
fb_hInitConsole
();
30
FB_UNLOCK
( );
31
32
return
errcode;
33
}
rtlib
unix
sys_hshell.c
Generated on Thu Jan 23 2014 19:40:10 for FreeBASIC by
1.8.4