projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Dont assume error if fgets returns NULL
[yaz-moved-to-github.git]
/
client
/
client.c
diff --git
a/client/client.c
b/client/client.c
index
8016a15
..
93741ca
100644
(file)
--- a/
client/client.c
+++ b/
client/client.c
@@
-205,7
+205,7
@@
static void do_hex_dump(const char* buf, size_t len)
int x;
for (i = 0; i < len ; i = i+16 )
{
int x;
for (i = 0; i < len ; i = i+16 )
{
- printf(" %4.4d ",i);
+ printf(" %4.4ld ", (long) i);
for(x=0 ; i+x<len && x<16; ++x)
{
printf("%2.2X ",(unsigned int)((unsigned char)buf[i+x]));
for(x=0 ; i+x<len && x<16; ++x)
{
printf("%2.2X ",(unsigned int)((unsigned char)buf[i+x]));
@@
-3547,16
+3547,12
@@
int cmd_source(const char* arg, int echo )
return -1;
}
return -1;
}
- while (!feof(includeFile)) {
- memset(line, 0, sizeof(line));
- if (!fgets(line, sizeof(line), includeFile))
- {
- perror("fgets");
- break;
- }
-
- if (strlen(line) < 2) continue;
- if (line[0] == '#') continue;
+ while (fgets(line, sizeof(line), includeFile))
+ {
+ if (strlen(line) < 2)
+ continue;
+ if (line[0] == '#')
+ continue;
if ((cp = strrchr(line, '\n')))
*cp = '\0';
if ((cp = strrchr(line, '\n')))
*cp = '\0';
@@
-5054,6
+5050,7
@@
int main(int argc, char **argv)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab