Subversion Repositories Games.Carmageddon

Rev

Rev 14 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 18
Line 4... Line 4...
4
 
4
 
-
 
5
#include "harness/config.h"
5
#include "harness/os.h"
6
#include "harness/os.h"
6
#include <assert.h>
7
#include <assert.h>
7
#include <dirent.h>
8
#include <dirent.h>
8
#include <err.h>
9
#include <err.h>
9
#include <errno.h>
10
#include <errno.h>
Line 162... Line 163...
162
static uint8_t alternate_stack[SIGSTKSZ];
163
static uint8_t alternate_stack[SIGSTKSZ];
163
 
164
 
164
void resolve_full_path(char* path, const char* argv0) {
165
void resolve_full_path(char* path, const char* argv0) {
165
    if (argv0[0] == '/') { // run with absolute path
166
    if (argv0[0] == '/') { // run with absolute path
166
        strcpy(path, argv0);
167
        strcpy(path, argv0);
167
    } else {               // run with relative path
168
    } else { // run with relative path
168
        if (NULL == getcwd(path, PATH_MAX)) {
169
        if (NULL == getcwd(path, PATH_MAX)) {
169
            perror("getcwd error");
170
            perror("getcwd error");
170
            return;
171
            return;
171
        }
172
        }
172
        strcat(path, "/");
173
        strcat(path, "/");
Line 223... Line 224...
223
 
224
 
224
FILE* OS_fopen(const char* pathname, const char* mode) {
225
FILE* OS_fopen(const char* pathname, const char* mode) {
225
    FILE* f;
226
    FILE* f;
226
 
227
 
227
    f = fopen(pathname, mode);
228
    f = fopen(pathname, mode);
-
 
229
    if (harness_game_config.verbose) {
228
    if (f == NULL) {
230
        if (f == NULL) {
229
        fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(errno));
231
            fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(errno));
-
 
232
        }
230
    }
233
    }
231
 
234
 
232
    return f;
235
    return f;
233
}
236
}
234
 
237