diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2015-11-04 13:55:26 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2015-11-04 13:55:26 -0500 |
| commit | ded46d4768498c7d27fedcc438fe80a59ad63d0c (patch) | |
| tree | 1158247ec3b9580a3deaa320334c2d777050b6b9 /id_map.c | |
| parent | a5309fed914fdaa7697f2d369e7dcd02309063ab (diff) | |
| download | mrsync-ded46d4768498c7d27fedcc438fe80a59ad63d0c.tar.gz | |
move code into a src directory
Diffstat (limited to 'id_map.c')
| -rw-r--r-- | id_map.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/id_map.c b/id_map.c deleted file mode 100644 index 8b8dcaa..0000000 --- a/id_map.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2006 Renaissance Technologies Corp. - main developer: HP Wei <hp@rentec.com> - Copyright (C) 2005 Renaissance Technologies Corp. - main developer: HP Wei <hp@rentec.com> - - 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, 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; see the file COPYING. - If not, write to the Free Software Foundation, - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> -#include <string.h> - -void strip(char * str); - -/* place to hold the array of string */ -char ** machine_names = NULL; /* array of (char*) */ -int nTargets=0; - -void get_machine_names(char * filename) -{ - FILE *fd; - char line[PATH_MAX]; - int count=0; - - if ((fd = fopen(filename, "r")) == NULL) { - fprintf(stderr, "Cannot open file -- %s \n", filename); - return; - } - while (fgets(line, PATH_MAX, fd) != NULL) { - strip(line); - if (strlen(line) != 0) ++count; - } - if (count == 0) { - fclose(fd); - fprintf(stderr, "No machine names in the file = %s\n", filename); - return; - } - - nTargets = count; - - rewind(fd); - machine_names = malloc(nTargets * sizeof(void*)); - - line[0] = '\0'; - count = 0; - while(fgets(line, PATH_MAX, fd) != NULL) { - strip(line); - if (strlen(line)==0) continue; - machine_names[count] = (char*)strdup(line); - line[0] = '\0'; - ++count; - } - fclose(fd); -} - -char * id2name(int id) -{ - return (machine_names) ? machine_names[id] : ""; -} |
