diff --git a/src/csvparser.h b/src/csvparser.h new file mode 100644 index 0000000..e48967b --- /dev/null +++ b/src/csvparser.h @@ -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 . +*/ + +#ifndef CSVPARSER_H_ +#define CSVPARSER_H_ + +#define MAXCHAR 1000 + +int parse_tokens(char *file); + +#endif diff --git a/src/libcsvparser.c b/src/libcsvparser.c index ed1ca47..2474166 100644 --- a/src/libcsvparser.c +++ b/src/libcsvparser.c @@ -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 . +*/ #include #include #include +#include "csvparser.h" + #define MAXCHAR 1000 int parse_tokens(char *file) { + + int return_value; + FILE *fp; char row[MAXCHAR]; char *token; fp = fopen(file, "r"); if (fp == NULL) { - printf("csv file %s not found\n", file); - return 1; + return_value = 1; + return return_value; } while (feof(fp) != true) { @@ -31,5 +51,6 @@ parse_tokens(char *file) } } - return 0; + return_value = 0; + return return_value; }