Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2017 12:27:55 +0000 (UTC)
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r430461 - in head/textproc/libcsv: . files
Message-ID:  <201701031227.v03CRt6h075726@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: matthew
Date: Tue Jan  3 12:27:55 2017
New Revision: 430461
URL: https://svnweb.freebsd.org/changeset/ports/430461

Log:
  New maintainer: bob@eager.cx
  
  Add new 'EXAMPLES' option
  Use OPTIONS helpers
  Spelling fixes for man pages
  Add a csv_get_blk_size() function
  
  PR:		215720
  Submitted by:	bob@eager.cx

Added:
  head/textproc/libcsv/files/patch-csv.3   (contents, props changed)
  head/textproc/libcsv/files/patch-csv.h   (contents, props changed)
  head/textproc/libcsv/files/patch-libcsv.c   (contents, props changed)
Modified:
  head/textproc/libcsv/Makefile
  head/textproc/libcsv/pkg-plist

Modified: head/textproc/libcsv/Makefile
==============================================================================
--- head/textproc/libcsv/Makefile	Tue Jan  3 12:24:43 2017	(r430460)
+++ head/textproc/libcsv/Makefile	Tue Jan  3 12:27:55 2017	(r430461)
@@ -3,15 +3,16 @@
 
 PORTNAME=	libcsv
 PORTVERSION=	3.0.3
+PORTREVISION=	1
 CATEGORIES=	textproc
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	bob@eager.cx
 COMMENT=	Small, simple and fast CSV library
 
 LICENSE=	LGPL21
 
-OPTIONS_DEFINE=	PROFILE
+OPTIONS_DEFINE=	EXAMPLES PROFILE
 
 MAKEFILE=	Makefile.lib
 USES=		uidfix
@@ -21,17 +22,16 @@ PLIST_SUB=	SHLIB_MAJOR="${SHLIB_MAJOR}"
 
 SHLIB_MAJOR=	3
 
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MPROFILE}
-PLIST_SUB+=	PROFILE=""
-.else
-MAKE_ENV+=	NO_PROFILE=true
-PLIST_SUB+=	PROFILE="@comment "
-.endif
+PROFILE_PLIST_SUB=	PROFILE=""
+PROFILE_MAKE_ENV_OFF=	NO_PROFILE=true
+PROFILE_PLIST_SUB_OFF=	PROFILE="@comment "
 
 do-configure:
 	@${SED} -e 's|%%SHLIB_MAJOR%%|${SHLIB_MAJOR}|' \
 		< ${FILESDIR}/Makefile > ${WRKSRC}/${MAKEFILE}
 
+do-install-EXAMPLES-on:
+	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	(cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
+
 .include <bsd.port.mk>

Added: head/textproc/libcsv/files/patch-csv.3
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/libcsv/files/patch-csv.3	Tue Jan  3 12:27:55 2017	(r430461)
@@ -0,0 +1,127 @@
+--- csv.3.orig	2013-01-10 00:04:17 UTC
++++ csv.3
+@@ -1,4 +1,4 @@
+-.TH CSV 3 "9 January 2013"
++.TH CSV 3 "2 January 2016"
+ .SH NAME
+ csv \- CSV parser and writer library
+ .SH SYNOPSIS
+@@ -36,6 +36,9 @@ void csv_free(struct csv_parser *\fIp\fB
+ 
+ unsigned char csv_get_delim(struct csv_parser *\fIp\fB);
+ unsigned char csv_get_quote(struct csv_parser *\fIp\fB);
++void csv_set_delim(struct csv_parser *\fIp\fB, unsigned char \fIc\fB);
++void csv_set_quote(struct csv_parser *\fIp\fB, unsigned char \fIc\fP);
++
+ 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));
+ 
+@@ -75,7 +78,7 @@ The idea behind parsing with \fBlibcsv\f
+ end-of-row events.  \fBcsv_parse()\fP parses the data provided calling the
+ user-defined callback functions as it reads fields and rows.
+ When complete, \fBcsv_fini()\fP is called to finish processing the current
+-field and make a final call to the callback functions if neccessary.
++field and make a final call to the callback functions if necessary.
+ \fBcsv_free()\fP is then called to free the parser object.
+ \fBcsv_error()\fP and \fBcsv_strerror()\fP provide information about errors
+ encountered by the functions.
+@@ -147,8 +150,8 @@ Multiple options can be specified by OR-
+ .RE
+ 
+ By default \fIcb2\fP is not called when rows that do not contain any fields
+-are encountered.  This behavior is meant to accomodate files using
+-only either a linefeed or a carriage return as a record seperator to
++are encountered.  This behavior is meant to accommodate files using
++only either a linefeed or a carriage return as a record separator to
+ be parsed properly while at the same time being able to parse files with rows
+ terminated by multiple characters from resulting in blank rows after
+ each actual row of data (for example, processing a text CSV file
+@@ -178,7 +181,7 @@ functions may be called many times durin
+ depending on the amount of data being processed in a given call.
+ .PP
+ \fBcsv_parse()\fP returns the number of bytes processed, on a successful
+-call this will be \fIlen\fP, if it is less than len an error has occured.
++call this will be \fIlen\fP, if it is less than len an error has occurred.
+ An error can occur, for example, if there is insufficient memory
+ to store the contents of the current field in the entry buffer.
+ An error can also occur if malformed data is encountered while running
+@@ -192,7 +195,7 @@ of the error. \fBcsv_error()\fP takes a 
+ .PP
+ .RS
+ .TP
+-\fBCSV_EPARSE\fP\ \ \ A parse error has occured while in strict mode
++\fBCSV_EPARSE\fP\ \ \ A parse error has occurred while in strict mode
+ .TP
+ \fBCSV_ENOMEM\fP\ \ \ There was not enough memory while attempting to increase the entry buffer for the current field
+ .TP
+@@ -210,7 +213,7 @@ to call the \fBcsv_fini()\fP function.  
+ function with any remaining data in the entry buffer (if there is
+ any) and call the \fIcb2\fP function unless we are already at the end of a row
+ (the last byte processed was a newline character for example).
+-It is neccessary to call this function because the file being
++It is necessary to call this function because the file being
+ processed might not end with a carriage return or newline but the
+ data that has been read in to this point still needs to be 
+ submitted to the callback routines.
+@@ -293,13 +296,14 @@ 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 respetively, cast to unsigned char.  \fBcsv_get_delim()\fP
++and \fBcsv_set_delim()\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
+ when these functions are used to change the delimiter and/or quote characters,
+ fields containing the new quote character or delimiter must be quoted and quote
+-characters must be escaped with an immediately preceeding instance of the same
++characters must be escaped with an immediately preceding instance of the same
+ character.
+ Additionally, the \fBcsv_set_space_func()\fP and \fBcsv_set_term_func()\fP
+ allow a user-defined function to be provided which will be used determine
+@@ -333,7 +337,7 @@ reflect the most common usage of the for
+ .PP
+ .RS
+ .TP
+-Fields are seperated with commas.
++Fields are separated with commas.
+ .TP
+ Rows are delimited by newline sequences (see below).
+ .TP
+@@ -385,7 +389,7 @@ will be interpreted as 3 fields, equival
+ 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
+@@ -409,7 +413,7 @@ would be parsed equivalently to the corr
+ .fi
+ This is often desirable as there are some applications that do
+ not adhere to the specifications previously discussed.  However,
+-there are instances where malformed CSV data is ambigious, namely
++there are instances where malformed CSV data is ambiguous, namely
+ when a comma or newline is the next non-space character following
+ a quote such as:
+ .nf
+@@ -420,7 +424,7 @@ This could either be parsed as a single 
+ 
+ \fBSally said "Hello", Wally said "Goodbye"\fP
+ 
+-or as 2 seperate fields:
++or as 2 separate fields:
+ 
+ .fi
+ \fBSally said "Hello\fP
+@@ -431,7 +435,7 @@ Since the data is malformed, there is no
+ before the comma is meant to be a literal quote or if it signifies
+ the end of the field.  This is of course not an issue for properly
+ formed data as all quotes must be escaped.  \fBlibcsv\fP will parse this
+-example as 2 seperate fields.
++example as 2 separate fields.
+ 
+ \fBlibcsv\fP provides a strict mode that will return with a parse error
+ if a quote is seen inside a non-quoted field or if a non-escaped

Added: head/textproc/libcsv/files/patch-csv.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/libcsv/files/patch-csv.h	Tue Jan  3 12:27:55 2017	(r430461)
@@ -0,0 +1,10 @@
+--- csv.h.orig	2012-12-28 22:50:44 UTC
++++ csv.h
+@@ -79,6 +79,7 @@ void csv_set_term_func(struct csv_parser
+ void csv_set_realloc_func(struct csv_parser *p, void *(*)(void *, size_t));
+ void csv_set_free_func(struct csv_parser *p, void (*)(void *));
+ void csv_set_blk_size(struct csv_parser *p, size_t);
++size_t csv_get_blk_size(struct csv_parser *p);
+ size_t csv_get_buffer_size(struct csv_parser *p);
+ 
+ #ifdef __cplusplus

Added: head/textproc/libcsv/files/patch-libcsv.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/libcsv/files/patch-libcsv.c	Tue Jan  3 12:27:55 2017	(r430461)
@@ -0,0 +1,18 @@
+--- libcsv.c.orig	2012-12-28 22:50:44 UTC
++++ libcsv.c
+@@ -259,6 +259,15 @@ csv_set_blk_size(struct csv_parser *p, s
+ }
+ 
+ size_t
++csv_get_blk_size(struct csv_parser *p)
++{
++  /* Get the block size used to increment buffer size */
++  if (p)
++    return p->blk_size;
++  return 0;
++}
++
++size_t
+ csv_get_buffer_size(struct csv_parser *p)
+ {
+   /* Get the size of the entry buffer */

Modified: head/textproc/libcsv/pkg-plist
==============================================================================
--- head/textproc/libcsv/pkg-plist	Tue Jan  3 12:24:43 2017	(r430460)
+++ head/textproc/libcsv/pkg-plist	Tue Jan  3 12:27:55 2017	(r430461)
@@ -4,3 +4,7 @@ lib/libcsv.so
 lib/libcsv.so.%%SHLIB_MAJOR%%
 %%PROFILE%%lib/libcsv_p.a
 man/man3/csv.3.gz
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/csvfix.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/csvinfo.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/csvtest.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/csvvalid.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701031227.v03CRt6h075726>