From bfdbfc43ecab547af83542570c8b9b8da0f900ab Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 4 Jul 1999 16:20:35 +0000 Subject: [PATCH] (epxand_cell_name): clean-up git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6413 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/afsutil/afslog.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/appl/afsutil/afslog.c b/appl/afsutil/afslog.c index 13903fc09..10ca299e5 100644 --- a/appl/afsutil/afslog.c +++ b/appl/afsutil/afslog.c @@ -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; }