// TODO: better rewrite static char *getbfroma(const char *path) { FILE *fp; static char buf1[256], buf2[256]; memset(buf1, '\0', sizeof(buf1)); memset(buf2, '\0', sizeof(buf2)); if (path == NULL || *path == '\0') return ""; ++path; fp = fopen("0Announce/.Search", "r"); if (fp == NULL) return ""; while (true) { if(fscanf(FCGI_ToFILE(fp), "%s %s", buf1, buf2) <= 0) break; if (*buf1 != '\0') buf1[strlen(buf1) - 1] = '\0'; if (*buf1 == '*') continue; size_t len = strlen(buf2); if(!strncmp(buf2, path, len) && (path[len] == '/' || path[len] == '\0')) { fclose(fp); return buf1; } } fclose(fp); return ""; }
void show_special(char *id2) { FILE *fp; char id1[80], name[80]; fp = fopen("etc/sysops", "r"); if (fp == 0) return; while (1) { id1[0] = 0; name[0] = 0; if (fscanf(FCGI_ToFILE(fp), "%s %s", id1, name) <= 0) break; if (!strcmp(id1, id2)) hprintf(" [1;31m��[0;36m%s[1;31m��[m", name); } fclose(fp); }
int get_key(R_RSA_PUBLIC_KEY& key) { int retval; char buf[256]; sprintf(buf, "%s/upload_public", config.key_dir); #ifndef _USING_FCGI_ FILE *f = fopen(buf, "r"); #else FCGI_FILE *f = FCGI::fopen(buf, "r"); #endif if (!f) return -1; #ifdef _USING_FCGI_ retval = scan_key_hex(FCGI_ToFILE(f), (KEY*)&key, sizeof(key)); #else retval = scan_key_hex(f, (KEY*)&key, sizeof(key)); #endif fclose(f); if (retval) return retval; return 0; }
void show_special(char *id2) { FILE *fp; char id1[80], name[80]; fp = fopen("etc/sysops", "r"); if (fp == 0) return; while (1) { id1[0] = 0; name[0] = 0; if (fscanf(FCGI_ToFILE(fp), "%s %s", id1, name) <= 0) break; if (!strcmp(id1, id2)) printf (" <font color=red>★</font><font color=olive>%s</font><font color=red>★</font>", name); } fclose(fp); }