This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
FILE * | my_open_file (char *name, char *mode, int *openway) |
void | my_close_file (FILE *f, int *openway) |
void my_close_file | ( | FILE * | f, | |
int * | openway | |||
) |
Definition at line 61 of file mechfile.c.
Referenced by load_xcode(), and SaveSpecialObjects().
00062 { 00063 if(!f) 00064 return; 00065 if(*openway) { 00066 pclose(f); 00067 00068 /* close(1); */ 00069 } else 00070 fclose(f); 00071 }
FILE* my_open_file | ( | char * | name, | |
char * | mode, | |||
int * | openway | |||
) |
Definition at line 20 of file mechfile.c.
Referenced by load_xcode(), map_load(), map_savemap(), and SaveSpecialObjects().
00021 { 00022 FILE *f; 00023 char buf[512]; 00024 char buf2[512]; 00025 00026 if(!strcmp(mode, "w")) { 00027 #ifdef FILES_COMPRESSED_BY_DEFAULT 00028 00029 /* dup2(2, 1); */ 00030 sprintf(buf, "nice gzip -c > %s.gz", name); 00031 if(!(f = popen(buf, mode))) 00032 return NULL; 00033 *openway = 1; 00034 return f; 00035 #else 00036 if(!(f = fopen(name, mode))) 00037 return NULL; 00038 *openway = 0; 00039 return f; 00040 #endif 00041 } 00042 if((f = fopen(name, mode))) { 00043 *openway = 0; 00044 return f; 00045 } 00046 sprintf(buf, "%s.gz", name); 00047 if((f = fopen(buf, mode))) 00048 fclose(f); 00049 else 00050 return NULL; 00051 sprintf(buf2, "nice gzip -dc < %s", buf); 00052 00053 /* dup2(2, 1); */ 00054 if((f = popen(buf2, mode))) { 00055 *openway = 1; 00056 return f; 00057 } 00058 return NULL; 00059 }