linux/bootstrap: use Forbid/Permit only when thread is main AROS thread
[AROS.git] / compiler / stdc / system.c
blob1b6d7885070218e9b23a496358be4a57e111163e
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function system().
6 */
8 #include <dos/dos.h>
9 #include <proto/dos.h>
10 #include <errno.h>
12 #define DEBUG 0
13 #include <aros/debug.h>
15 /*****************************************************************************
17 NAME */
18 #include <stdlib.h>
20 int system (
22 /* SYNOPSIS */
23 const char *string)
25 /* FUNCTION
26 Execute a command string. If string is NULL then 1 will be returned.
28 INPUTS
29 string - command to execute or NULL
31 RESULT
32 Return value of command executed. If value < 0 errno indicates error.
33 1 is return if string is NULL.
35 NOTES
36 The system() version of stdcio.library just passes the command
37 to SystemTags() dos.library call.
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 ******************************************************************************/
49 int ret;
51 if (string == NULL)
52 return 1; /* We have AmigaShell */
54 ret = (int)SystemTags(string, NULL);
56 if (ret == -1)
57 errno = __stdc_ioerr2errno(IoErr());
59 return ret;
60 } /* system */