#include <stdio.h>
Go to the source code of this file.
◆ feFopen()
FILE* feFopen |
( |
const char * |
path, |
|
|
const char * |
mode, |
|
|
char * |
where = 0 , |
|
|
short |
useWerror = 0 , |
|
|
short |
path_only = 0 |
|
) |
| |
Definition at line 47 of file feFopen.cc.
55 const char* home =
getenv(
"HOME");
57 if ((home==
NULL)||(!access(home,X_OK)))
62 strcpy(longpath, home);
63 strcat(longpath, &(path[1]));
67 #if defined(HAVE_PWD_H) && defined(HAVE_GETPWNAM)
71 struct passwd *pw_entry;
72 strcpy (longpath, path);
73 dir_sep = strchr(longpath,
DIR_SEP);
77 strcpy(
buf,
"illegal ~ in filename >>");
78 strncat(
buf,longpath,235);
84 pw_entry = getpwnam(&longpath[1]);
87 strcpy(longpath, pw_entry->pw_dir);
88 dir_sep = strchr((
char *)path,
DIR_SEP);
89 strcat(longpath, dir_sep);
102 res = stat(path,&statbuf);
103 }
while((
res < 0) and (errno == EINTR));
105 && (S_ISREG(statbuf.st_mode)))
108 if (where!=
NULL) strcpy(where,path);
111 ! (path[0] ==
'.' && path[1] ==
DIR_SEP) &&
132 if(!access(
s, R_OK)) {
found++;
break; }
150 if (where!=
NULL) strcpy(
s,path);
155 if ((
f==
NULL)&&(useWerror))
158 strcpy(
buf,
"cannot open `");
159 strncat(
buf,path,240);
const CanonicalForm int s
FILE * myfopen(const char *path, const char *mode)
void WerrorS(const char *s)
static char * feResource(feResourceConfig config, int warn)
void * malloc(size_t size)
int status int void * buf
◆ myfopen()
FILE* myfopen |
( |
const char * |
path, |
|
|
const char * |
mode |
|
) |
| |
Definition at line 167 of file feFopen.cc.
169 #if (defined(__CUGWIN__))
177 if (mode[
i] ==
'\0')
break;
178 if (mode[
i] ==
'w') done = 1;
179 if (mode[
i] ==
'a') done = 1;
180 if (mode[
i] ==
'b') done = 1;
188 return fopen(path, mmode);
190 return fopen(path, mode);
◆ myfread()
size_t myfread |
( |
void * |
ptr, |
|
|
size_t |
size, |
|
|
size_t |
nmemb, |
|
|
FILE * |
stream |
|
) |
| |
Definition at line 195 of file feFopen.cc.
197 size_t got = fread(ptr,
size, nmemb, stream) *
size;
200 for (
i=0;
i<got;
i++)
202 if ( ((
char*) ptr)[
i] ==
'\r')
204 if (
i+1 < got && ((
char*) ptr)[
i+1] ==
'\n')
205 ((
char*) ptr)[
i] =
' ';
207 ((
char*) ptr)[
i] =
'\n';
◆ WerrorS()
void WerrorS |
( |
const char * |
s | ) |
|
Definition at line 24 of file feFopen.cc.
29 fwrite(
" ? ",1,5,stderr);
30 fwrite((
char *)
s,1,strlen((
char *)
s),stderr);
31 fwrite(
"\n",1,1,stderr);
VAR void(* WerrorS_callback)(const char *s)
◆ errorreported
◆ PrintS_callback
◆ WerrorS_callback