Date: 01/11/06 (Code WTF) Keywords: no keywords Писано каким-то китайцем в далеком 1992 году. sprintf(buf, "ps -aux | grep %s > ps.tab", tran_path); system(buf); input_stream = fopen("ps.tab", "r"); while ((fgets(line, n, input_stream)) != NULL) { len = strlen(line); line[len - 1] = '\0'; if (os_strstr(line, master_path) != NULL) { /* found a line with master */ fclose(input_stream); system("rm -f ps.tab>>/dev/null"); return (1); } } fclose(input_stream); system("rm -f ps.tab>>/dev/null"); return (0); Source: http://community.livejournal.com/code_wtf/23192.html
|