diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-04-20 01:56:27 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-04-20 01:56:27 +0000 |
commit | 02cefc20e87ed0406131c4bf2e9b3648bc8adcf5 (patch) | |
tree | bce7b2c94dfc0e402de09756b280ec28a65a5233 /lib/libpbmfont.c | |
parent | 939ec42422e7db7c56ff5f736c00565f1bf621ff (diff) | |
download | netpbm-mirror-02cefc20e87ed0406131c4bf2e9b3648bc8adcf5.tar.gz netpbm-mirror-02cefc20e87ed0406131c4bf2e9b3648bc8adcf5.tar.xz netpbm-mirror-02cefc20e87ed0406131c4bf2e9b3648bc8adcf5.zip |
Release 10.47.12
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@1194 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/libpbmfont.c')
-rw-r--r-- | lib/libpbmfont.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/lib/libpbmfont.c b/lib/libpbmfont.c index 902eaf0d..ff75d0a1 100644 --- a/lib/libpbmfont.c +++ b/lib/libpbmfont.c @@ -1102,20 +1102,32 @@ mk_argvn(char * const s, static int -readline(FILE * const fp, - char * const buf, - const char ** const arg) { +readline(FILE * const ifP, + char * const line, + const char ** const wordList) { +/*---------------------------------------------------------------------------- + Read a nonblank line from file *ifP. Return the value of the whole line + in *buf (must be at least 1024 bytes long), and parse it into words + in *wordList (must have at least 32 entries). - int retval; - char * rc; + If there is no nonblank line before EOF, return rc == -1. +-----------------------------------------------------------------------------*/ + bool gotLine; + bool error; - rc = fgets(buf, 1024, fp); - if (rc == NULL) - retval = -1; - else - retval = mk_argvn(buf, arg, 32); + for (gotLine = false, error = false; !gotLine && !error; ) { + char * rc; - return retval; + rc = fgets(line, 1024, ifP); + if (rc == NULL) + error = true; + else { + mk_argvn(line, wordList, 32); + if (wordList[0] != NULL) + gotLine = true; + } + } + return error ? -1 : 0; } |