(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 * static const char *
expand_cell_name(const char *cell) expand_cell_name(const char *cell)
{ {
FILE *F; FILE *f;
static char buf[128]; static char buf[128];
char *p; char *p;
F = fopen(_PATH_CELLSERVDB, "r"); f = fopen(_PATH_CELLSERVDB, "r");
if(F == NULL) if(f == NULL)
return cell; return cell;
do{ while (fgets (buf, sizeof(buf), f) != NULL) {
fgets(buf, 128, F);
if(buf[0] == '>'){ if(buf[0] == '>'){
for(p=buf; *p && !isspace(*p) && *p != '#'; p++) for(p=buf; *p && !isspace(*p) && *p != '#'; p++)
; ;
*p=0; *p = '\0';
if(strstr(buf, cell)){ if(strstr(buf, cell)){
fclose(F); fclose(F);
return buf + 1; return buf + 1;
} }
} }
buf[0] = 0; buf[0] = 0;
}while(!feof(F)); }
fclose(F); fclose(F);
return cell; return cell;
} }