diff options
Diffstat (limited to 'wrapper/rvs.h')
-rw-r--r-- | wrapper/rvs.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/wrapper/rvs.h b/wrapper/rvs.h index 83cde87..57358f2 100644 --- a/wrapper/rvs.h +++ b/wrapper/rvs.h @@ -66,14 +66,28 @@ xfree (void *ptr) free (ptr); } +void +xsystem (const char *command) +{ + int stat=system(command); + if (stat!=0) { + if (stat==-1) { + fprintf(stderr, + "%s: unable to launch run command", + program_invocation_name); + exit(EXIT_FAILURE); + } else + exit(EXIT_FAILURE); + } +} + /* unistd.h */ int xchdir (const char *filename) { int ret=chdir(filename); - if (ret != 0) { + if (ret != 0) error(EXIT_FAILURE,errno,"%s/",filename); - } return ret; } @@ -83,10 +97,8 @@ xfopen (const char *filename, const char *opentype) { FILE *file = fopen(filename,opentype); /* fopen gives NULL on failure */ - if ( file == NULL ) { + if ( file == NULL ) error(EXIT_FAILURE,errno,"%s",filename); - } - return file; } |