[PATCH] freebcp direction need not be case sensitive

"Craig A. Berry" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
As far as I can tell, the Microsoft bcp client does not care whether  
you say in or IN, out or OUT, etc.  And it's darn inconvenient to have  
to quote the direction in a command shell that does not preserve  
case.  So the attached teeny patch replaces some strcmp's with  
strcasecmp and all is well.

One file affected:

% lsdiff -s --strip=1 003_freebcp_direction.patch
! src/apps/freebcp.c

________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
  difficult than getting in."
                  Brad Leithauser

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
003_freebcp_direction.patch (application/octet-stream, 1 KB)
# HG changeset patch
# User BERRYC
# Date 1273698343 18000
# Node ID 706c19d002bb61c1676484c3f991d4897a0f2e30
# Parent  7cba529afe4bf32a96802a793817eab6d275cc3e
freebcp's direction doesn't need to be case sensitive.

diff -r 7cba529afe4b -r 706c19d002bb src/apps/freebcp.c
--- a/src/apps/freebcp.c	Wed May 12 15:25:43 2010 -0500
+++ b/src/apps/freebcp.c	Wed May 12 16:05:43 2010 -0500
@@ -182,11 +182,11 @@
 	/* argument 2 - the direction */
 	tds_strlcpy(pdata->dbdirection, argv[2], sizeof(pdata->dbdirection));
 
-	if (strcmp(pdata->dbdirection, "in") == 0) {
+	if (strcasecmp(pdata->dbdirection, "in") == 0) {
 		pdata->direction = DB_IN;
-	} else if (strcmp(pdata->dbdirection, "out") == 0) {
+	} else if (strcasecmp(pdata->dbdirection, "out") == 0) {
 		pdata->direction = DB_OUT;
-	} else if (strcmp(pdata->dbdirection, "queryout") == 0) {
+	} else if (strcasecmp(pdata->dbdirection, "queryout") == 0) {
 		pdata->direction = DB_QUERYOUT;
 	} else {
 		fprintf(stderr, "Copy direction must be either 'in', 'out' or 'queryout'.\n");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.