projects
/
mmh
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2c31657
)
make m_getfld2() aware of CRLF lineendings
author
Philipp Takacs
<philipp@bureaucracy.de>
Sat, 21 Nov 2015 11:20:36 +0000
(12:20 +0100)
committer
Philipp Takacs
<philipp@bureaucracy.de>
Fri, 27 Nov 2015 01:01:14 +0000
(
02:01
+0100)
sbr/m_getfld2.c
patch
|
blob
|
history
diff --git
a/sbr/m_getfld2.c
b/sbr/m_getfld2.c
index
970a3f0
..
a2b8ae9
100644
(file)
--- a/
sbr/m_getfld2.c
+++ b/
sbr/m_getfld2.c
@@
-10,6
+10,7
@@
#include <h/utils.h>
#include <stdio.h>
#include <ctype.h>
#include <h/utils.h>
#include <stdio.h>
#include <ctype.h>
+#include <stdbool.h>
enum threestate {
enum threestate {
@@
-23,7
+24,7
@@
enum threestate {
*/
static enum threestate is_falted(FILE *);
static size_t copyname(char *, char *);
*/
static enum threestate is_falted(FILE *);
static size_t copyname(char *, char *);
-static int is_separator(char *);
+static bool is_separator(char *);
/*
/*
@@
-237,7
+238,7
@@
copyname(char *dst, char *src)
return strlen(dst);
}
return strlen(dst);
}
-static int
+static bool
is_separator(char *line)
{
/*
is_separator(char *line)
{
/*
@@
-247,8
+248,8
@@
is_separator(char *line)
while (*line == '-') {
line++;
}
while (*line == '-') {
line++;
}
- if (strcmp("\n", line)==0) {
- return 1;
+ if (strcmp("\n", line) == 0 || strcmp("\r\n", line) == 0 ) {
+ return true;
}
}
- return 0;
+ return false;
}
}