1 | /* |
1 | /* |
2 | * static char *rcsid_c_misc_c = |
2 | * static char *rcsid_c_misc_c = |
3 | * "$Id: c_misc.C,v 1.3 2006/08/29 08:01:37 root Exp $"; |
3 | * "$Id: c_misc.C,v 1.4 2006/08/30 16:30:37 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
769 | FILE * fp; |
769 | FILE * fp; |
770 | if((fp = fopen( BUG_LOG , "a")) != NULL){ |
770 | if((fp = fopen( BUG_LOG , "a")) != NULL){ |
771 | fprintf(fp,"%s\n", reportstring); |
771 | fprintf(fp,"%s\n", reportstring); |
772 | fclose(fp); |
772 | fclose(fp); |
773 | } else { |
773 | } else { |
774 | LOG(llevError, "Cannot write bugs file %s: %s\n", BUG_LOG, strerror_local(errno)); |
774 | LOG(llevError, "Cannot write bugs file %s: %s\n", BUG_LOG, strerror(errno)); |
775 | } |
775 | } |
776 | } |
776 | } |
777 | |
777 | |
778 | int command_output_sync(object *op, char *params) |
778 | int command_output_sync(object *op, char *params) |
779 | { |
779 | { |
… | |
… | |
1259 | * Main help page? |
1259 | * Main help page? |
1260 | */ |
1260 | */ |
1261 | if (!params) { |
1261 | if (!params) { |
1262 | sprintf(filename, "%s/def_help", settings.datadir); |
1262 | sprintf(filename, "%s/def_help", settings.datadir); |
1263 | if ((fp=fopen(filename, "r")) == NULL) { |
1263 | if ((fp=fopen(filename, "r")) == NULL) { |
1264 | LOG(llevError, "Cannot open help file %s: %s\n", filename, strerror_local(errno)); |
1264 | LOG(llevError, "Cannot open help file %s: %s\n", filename, strerror(errno)); |
1265 | return 0; |
1265 | return 0; |
1266 | } |
1266 | } |
1267 | while (fgets(line, MAX_BUF, fp)) { |
1267 | while (fgets(line, MAX_BUF, fp)) { |
1268 | line[MAX_BUF-1] ='\0'; |
1268 | line[MAX_BUF-1] ='\0'; |
1269 | len =strlen(line)-1; |
1269 | len =strlen(line)-1; |
… | |
… | |
1323 | |
1323 | |
1324 | /* |
1324 | /* |
1325 | * Found that. Just cat it to screen. |
1325 | * Found that. Just cat it to screen. |
1326 | */ |
1326 | */ |
1327 | if ((fp=fopen(filename, "r")) == NULL) { |
1327 | if ((fp=fopen(filename, "r")) == NULL) { |
1328 | LOG(llevError, "Cannot open help file %s: %s\n", filename, strerror_local(errno)); |
1328 | LOG(llevError, "Cannot open help file %s: %s\n", filename, strerror(errno)); |
1329 | return 0; |
1329 | return 0; |
1330 | } |
1330 | } |
1331 | sprintf(line, "Help about '%s'", params); |
1331 | sprintf(line, "Help about '%s'", params); |
1332 | new_draw_info(NDI_UNIQUE, 0,op, line); |
1332 | new_draw_info(NDI_UNIQUE, 0,op, line); |
1333 | while (fgets(line, MAX_BUF, fp)) { |
1333 | while (fgets(line, MAX_BUF, fp)) { |