Misha Brukman | 593ece0 | 2003-08-15 23:31:16 +0000 | [diff] [blame] | 1 | /*===- SysUtils.h - Utilities to do low-level system stuff -------*- C -*--===*\ |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 2 | * * |
| 3 | * This file contains functions used to do a variety of low-level, often * |
| 4 | * system-specific, tasks. * |
| 5 | * * |
| 6 | \*===----------------------------------------------------------------------===*/ |
| 7 | |
| 8 | #ifndef SYSUTILS_H |
| 9 | #define SYSUTILS_H |
| 10 | |
Misha Brukman | 2e1fbdd | 2003-09-29 22:37:00 +0000 | [diff] [blame] | 11 | struct stat; |
| 12 | |
| 13 | /* |
| 14 | * isExecutable - This function returns true if given struct stat describes the |
| 15 | * file as being executable. |
| 16 | */ |
| 17 | unsigned isExecutable(const struct stat *buf); |
| 18 | |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 19 | /* |
| 20 | * isExecutableFile - This function returns true if the filename specified |
| 21 | * exists and is executable. |
| 22 | */ |
Misha Brukman | 593ece0 | 2003-08-15 23:31:16 +0000 | [diff] [blame] | 23 | unsigned isExecutableFile(const char *ExeFileName); |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 24 | |
| 25 | /* |
Misha Brukman | 593ece0 | 2003-08-15 23:31:16 +0000 | [diff] [blame] | 26 | * FindExecutable - Find a named executable in the path. |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 27 | */ |
| 28 | char *FindExecutable(const char *ExeName); |
| 29 | |
Misha Brukman | 2e1fbdd | 2003-09-29 22:37:00 +0000 | [diff] [blame] | 30 | /* |
| 31 | * This method finds the real `execve' call in the C library and executes the |
| 32 | * given program. |
| 33 | */ |
| 34 | int |
| 35 | executeProgram(const char *filename, char *const argv[], char *const envp[]); |
| 36 | |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 37 | #endif |