release
This commit is contained in:
parent
9f9476c233
commit
1ce2a2a9a2
27
src/csvparser.h
Normal file
27
src/csvparser.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
csvparser.h - function declarations
|
||||||
|
|
||||||
|
This file is part of libcsvparser.
|
||||||
|
|
||||||
|
libcsvparser is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
libcsvparser is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with mp3fw. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CSVPARSER_H_
|
||||||
|
#define CSVPARSER_H_
|
||||||
|
|
||||||
|
#define MAXCHAR 1000
|
||||||
|
|
||||||
|
int parse_tokens(char *file);
|
||||||
|
|
||||||
|
#endif
|
@ -1,24 +1,44 @@
|
|||||||
/*
|
/*
|
||||||
libcsvparser.c - simple CSV parser
|
libcsvparer.c - csv parsing library
|
||||||
*/
|
|
||||||
|
This file is part of libcsvparser.
|
||||||
|
|
||||||
|
libcsvparser is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
libcsvparser is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with mp3fw. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "csvparser.h"
|
||||||
|
|
||||||
#define MAXCHAR 1000
|
#define MAXCHAR 1000
|
||||||
|
|
||||||
int
|
int
|
||||||
parse_tokens(char *file)
|
parse_tokens(char *file)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int return_value;
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char row[MAXCHAR];
|
char row[MAXCHAR];
|
||||||
char *token;
|
char *token;
|
||||||
|
|
||||||
fp = fopen(file, "r");
|
fp = fopen(file, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
printf("csv file %s not found\n", file);
|
return_value = 1;
|
||||||
return 1;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (feof(fp) != true) {
|
while (feof(fp) != true) {
|
||||||
@ -31,5 +51,6 @@ parse_tokens(char *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return_value = 0;
|
||||||
|
return return_value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user