Exemplo n.º 1
0
/* Locate a system file called `name' by using the search path in
   `Directory', checking that the file can be accesses in mode `mode', and
   return an open stdio stream for that file.  If `complete_path_return' is
   not NULL, `*complete_path_return' points to a malloced string with the
   complete path if the file was found or is NULL if not.  */
FILE *sysfile_open(const char *name, char **complete_path_return,
                   const char *open_mode)
{
#ifndef DINGOO_NATIVE
    char *p = NULL;
#endif
    FILE *f;

#ifdef DINGOO_NATIVE
    *complete_path_return = make_absolute_system_path(name);
    f = fopen(*complete_path_return, open_mode);
    if (!f) {
        *complete_path_return = NULL;
    }
    return f;
#else
    if (name == NULL || *name == '\0') {
        log_error(LOG_DEFAULT, "Missing name for system file.");
        return NULL;
    }

    p = findpath(name, expanded_system_path, IOUTIL_ACCESS_R_OK);

    if (p == NULL) {
        if (complete_path_return != NULL) {
            *complete_path_return = NULL;
        }
        return NULL;
    } else {
        f = fopen(p, open_mode);

        if (f == NULL || complete_path_return == NULL) {
            lib_free(p);
            p = NULL;
        }
        if (complete_path_return != NULL) {
            *complete_path_return = p;
        }
        return f;
    }
#endif  /* DINGOO_NATIVE */
}
Exemplo n.º 2
0
char *archdep_default_rtc_file_name(void)
{
    return make_absolute_system_path("rtcfile");
}
Exemplo n.º 3
0
char *archdep_make_backup_filename(const char *fname)
{
    return make_absolute_system_path("vicerc.bu");
}
Exemplo n.º 4
0
char *archdep_default_fliplist_file_name(void)
{
    return make_absolute_system_path("fliplist");
}
Exemplo n.º 5
0
char *archdep_default_save_resource_file_name(void)
{
    return make_absolute_system_path("vicerc-native");
}