rgamble / libcsv

Fast and flexible CSV library written in pure ANSI C that can read and write CSV data.
GNU Lesser General Public License v2.1
181 stars 40 forks source link

Missing function prototypes and minor typos in csv.3 #30

Open chrisinmtown opened 2 years ago

chrisinmtown commented 2 years ago

I found a couple very minor opportunities for improvement in csv.3. Please see the git diff below. I hope you will find my suggestions are accurate, and that this is helpful even tho it is not a pull request.

diff --git a/csv.3 b/csv.3
index 9469439..843a62c 100644
--- a/csv.3
+++ b/csv.3
@@ -35,7 +35,9 @@ void *\fIdata\fB);
 void csv_free(struct csv_parser *\fIp\fB);

 unsigned char csv_get_delim(struct csv_parser *\fIp\fB);
+void csv_set_delim(struct csv_parser *\fIp\fB), unsigned char \fIc\fB);
 unsigned char csv_get_quote(struct csv_parser *\fIp\fB);
+void csv_set_quote(struct csv_parser *\fIp\fB), unsigned char \fIc\fB);
 void csv_set_space_func(struct csv_parser *\fIp\fB, int (*\fIf\fB)(unsigned char));
 void csv_set_term_func(struct csv_parser *\fIp\fB, int (*\fIf\fB)(unsigned char));

@@ -139,7 +141,7 @@ Multiple options can be specified by OR-ing them together.
 .TP
 \fIcb1\fP is a pointer to the callback function that will be called from \fBcsv_parse()\fP after an entire field has been read. \fIcb1\fP will be called with a pointer to the parsed data (which is NOT nul-terminated unless the CSV_APPEND_NULL option is set), the number of bytes in the data, and the pointer that was passed to \fBcsv_parse()\fP.
 .TP
-\fIcb2\fP is a pointer to the callback function that will be called when the end of a record is encountered, it will be called with the character that caused the record to end, cast to an unsigned char, or -1 if called from csv_fini, and the pointer that was passed to \fBcsv_init()\fP.
+\fIcb2\fP is a pointer to the callback function that will be called when the end of a record is encountered, it will be called with the character that caused the record to end, cast to an unsigned char, or -1 if called from csv_fini, and the pointer that was passed to \fBcsv_parse()\fP.
 .TP
 \fIdata\fP is a pointer to user-defined data that will be passed to the callback functions when invoked.
 .TP
@@ -156,7 +158,7 @@ created that was created on a Windows machine on a Unix machine).
 The \fBCSV_REPALL_NL\fP option will cause \fBcb2\fP to be called
 once for every carriage return or linefeed encountered outside of a field.  
 \fIcb2\fP is called with the character that prompted the call to the function,
-, cast to an unsigned char, either \fBCSV_CR\fP for carriage return, \fBCSV_LF\fP for linefeed, or \fB-1\fP
+cast to an unsigned char, either \fBCSV_CR\fP for carriage return, \fBCSV_LF\fP for linefeed, or \fB-1\fP
 for record termination from a call to \fBcsv_fini()\fP (see below).
 A carriage return or linefeed within a non-quoted field always
 marks both the end of the field and the row.  Other characters can be used as row terminators and thus be provided as
@@ -218,7 +220,7 @@ If \fIcb2\fP is called from within \fBcsv_fini()\fP it will be because the row w
 not terminated with a newline sequence, in this case \fIcb2\fP will be
 called with an argument of -1.

-\fBNote:\fP A call to \fBcsv_fini\fP implicitly ends the field current field
+\fBNote:\fP A call to \fBcsv_fini\fP implicitly ends the current field
 and row.  If the last field processed is a quoted field that ends before a
 closing quote is encountered, no error will be reported by default, even if
 CSV_STRICT is specified.  To cause \fBcsv_fini()\fP to report an error in such a
@@ -293,7 +295,7 @@ CUSTOMIZING THE PARSER
 .br
 The \fBcsv_set_delim()\fP and \fBcsv_set_quote()\fP functions provide a
 means to change the characters that the parser will consider the delimiter
-and quote characters respetively, cast to unsigned char.  \fBcsv_get_delim()\fP  and \fBcsv_get_delim()\fP
+and quote characters respectively, cast to unsigned char.  \fBcsv_get_delim()\fP  and \fBcsv_get_quote()\fP
 return the current delimiter and quote characters respectively.  When
 \fBcsv_init()\fP is called the delimiter is set to \fBCSV_COMMA\fP and the quote
 to \fBCSV_QUOTE\fP.  Note that the rest of the CSV conventions still apply
@@ -318,7 +320,7 @@ Likewise, \fBcsv_set_free_func()\fP is used to set the function called to free
 the internal buffer, the default is the standard free function.

 \fBcsv_get_blk_size()\fP and \fBcsv_set_blk_size()\fP can be used to get and set
-the block size of the parser respectively.  The block size if the amount of 
+the block size of the parser respectively.  The block size is the amount of
 extra memory allocated every time the internal buffer needs to be increased,
 the default is 128.  \fBcsv_get_buffer_size()\fP will return the current
 number of bytes allocated for the internal buffer.
@@ -385,7 +387,7 @@ will be interpreted as 3 fields, equivalent to:
 RFC 4180 limits the allowable characters in a CSV field, \fBlibcsv\fP
 allows any character to be present in a field provided it adheres
 to the conventions mentioned above.  This makes it possible to
-store binary data in CSV format, an attribute that many application rely on.
+store binary data in CSV format, an attribute that many applications rely on.
 .PP
 RFC 4180 states that a Carriage Return plus Linefeed combination is
 used to delimit records, \fBlibcsv\fP allows any combination of Carriage
@@ -471,7 +473,7 @@ Example 2
 \fB"ab"c\fP
 Parses as: \fBab"c\fP
 .fi
-The first qute marks the field as quoted, the second quote is taken
+The first quote marks the field as quoted, the second quote is taken
 as a literal quote since the next non-space character is not a
 comma, or newline and the quote is not escaped.  The last quote ends
 the field (assuming there is a newline character following).