summaryrefslogtreecommitdiff
path: root/csv-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'csv-test.c')
-rw-r--r--csv-test.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/csv-test.c b/csv-test.c
index ccf9bad..7860da1 100644
--- a/csv-test.c
+++ b/csv-test.c
@@ -4,7 +4,8 @@
4#include <time.h> 4#include <time.h>
5#include <stdbool.h> 5#include <stdbool.h>
6 6
7#define INLINE static inline 7//#define INLINE static inline
8#define INLINE /**/
8 9
9/* === CSV-STRING Interface === */ 10/* === CSV-STRING Interface === */
10 11
@@ -283,12 +284,16 @@ csv_read(csv_t *csv, FILE *in)
283 return csv->csv_field.pos; 284 return csv->csv_field.pos;
284 285
285 case ZST_END_FILE: 286 case ZST_END_FILE:
286 if ( !csv_string_empty(&csv->csv_string) ) { 287 if ( csv_string_empty(&csv->csv_string) ) {
287 /* EOF wurde gelesen, allerdings sind Daten zur Vearbeitung vorhanden! */ 288 return -1; /* EOF reached */
288 csv_string_append(&csv->csv_string, '\0');
289 return csv->csv_field.pos;
290 } 289 }
291 return -1; /* EOF reached */ 290
291 /* EOF wurde gelesen, allerdings sind Daten zur Vearbeitung vorhanden! */
292 /* => aktuelles Feld abschließen... */
293 csv_string_append(&csv->csv_string, '\0');
294
295 /* ... und die Anzahl der Felder zurückliefern! */
296 return csv->csv_field.pos;
292 } 297 }
293 } 298 }
294} 299}
@@ -299,8 +304,6 @@ main(void)
299 csv_t csv[1]; 304 csv_t csv[1];
300 int n, line = 0; 305 int n, line = 0;
301 306
302 setvbuf(stdin, NULL, _IOFBF, 16384);
303
304#if 0 307#if 0
305 char data[] = "\"\"aaa\",\"b\"\"bb\",\"ccc\"\n" 308 char data[] = "\"\"aaa\",\"b\"\"bb\",\"ccc\"\n"
306 "zzz,,yyy,xxx\n" 309 "zzz,,yyy,xxx\n"