X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=oss%2Fcatdoc.git;a=blobdiff_plain;f=src%2Ffileutil.c;fp=src%2Ffileutil.c;h=657b02252375cf2a9caa7c7b1bccd801c28767a3;hp=d902a6a3d2f0f0d7ecd7ff84854d1374697377d9;hb=1202f84b0b3c0f7cf474fea44129ce736a3123f1;hpb=b3b0f8f43aa31bdf8146efd0a0d07a570fddf734 diff --git a/src/fileutil.c b/src/fileutil.c index d902a6a..657b022 100644 --- a/src/fileutil.c +++ b/src/fileutil.c @@ -71,13 +71,11 @@ char *find_file(char *name, const char *path) char *q; char path_buf[PATH_BUF_SIZE]; char dir_sep[2]={DIR_SEP,0}; - for (p=path;p;p=q+1) { + for (p=path;p;p=(q?(q+1):NULL)) { q=strchr(p,LIST_SEP); - if (q) { if (!prepare_path_buf(path_buf,p,q)) continue; } else { - q--; if (!prepare_path_buf(path_buf,p,p+strlen(p))) continue; } strcat(path_buf,dir_sep); /* always one char */ @@ -186,9 +184,8 @@ void list_charsets(void) { int count,glob_flags=GLOB_ERR; #endif char **ptr; - for (p=charset_path;p;p=q+1) { + for (p=charset_path;p;p=(q?(q+1):NULL)) { q=strchr(p,LIST_SEP); - if (q) { if (q-p>=PATH_BUF_SIZE) { /* Oops, dir name too long, perhabs broken config file */ @@ -197,7 +194,6 @@ void list_charsets(void) { strncpy(path_buf,p,q-p); path_buf[q-p]=0; } else { - q--; if (strlen(p)>=PATH_BUF_SIZE) continue; strcpy(path_buf,p); }