/* * MusicMUD Helper Program, version 1.0 * Copyright (C) 1998 Abigail Brady * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char buffer[4096]; FILE * f = popen("grep \"^string name\" ../vardata/users/*", "r"); char lastu[100] = ""; while (1) { fgets(buffer, 4000, f); if (feof(f)) break; *strchr(buffer, '\n') = 0; char *user = buffer; while (strchr(user, '/')) { user = strchr(user, '/')+1; } char *colon = strchr(user, ':'); char *name_str = strchr(strchr(colon, ' ')+1, ' ')+2; *colon = 0; *strchr(name_str, '"')=0; if (strcmp(user, lastu)!=0) printf("%s %s\n", user, name_str); strcpy(lastu, user); } pclose(f); }