(epxand_cell_name): clean-up

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6413 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-07-04 16:20:35 +00:00
parent d4f34bffc3
commit bfdbfc43ec

View File

@@ -71,26 +71,25 @@ static int num_args = sizeof(args) / sizeof(args[0]);
static const char *
expand_cell_name(const char *cell)
{
FILE *F;
FILE *f;
static char buf[128];
char *p;
F = fopen(_PATH_CELLSERVDB, "r");
if(F == NULL)
f = fopen(_PATH_CELLSERVDB, "r");
if(f == NULL)
return cell;
do{
fgets(buf, 128, F);
while (fgets (buf, sizeof(buf), f) != NULL) {
if(buf[0] == '>'){
for(p=buf; *p && !isspace(*p) && *p != '#'; p++)
;
*p=0;
*p = '\0';
if(strstr(buf, cell)){
fclose(F);
return buf + 1;
}
}
buf[0] = 0;
}while(!feof(F));
}
fclose(F);
return cell;
}