Subversion Repositories Games.Carmageddon

Rev

Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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