Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Aug 2002 15:01:46 GMT
From:      Michael Pearce <mpearce@coreth.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/41719: field positions of output are one character off
Message-ID:  <200208161501.g7GF1kuj054062@dread.coreth.com>

next in thread | raw e-mail | index | archive | help

>Number:         41719
>Category:       ports
>Synopsis:       field positions of output are one character off
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 16 13:00:06 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Michael Pearce <mpearce@coreth.com>
>Release:        FreeBSD 4.6-RELEASE i386
>Organization:
Coreth Consulting, Inc.
>Environment:
System: FreeBSD dread.coreth.com 4.6-RELEASE FreeBSD 4.6-RELEASE #0: Tue Jun 11 06:14:12 GMT 2002 murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC i386


>Description:
	The first character of every field appears to be missing, and actually
	appears at the end of the previous field.  Trimming of trailing
	spaces also fails.
>How-To-Repeat:
	Use dbview to output a dBase file:

		dbview myfile.dbf
>Fix:

	In db_dump.c, two reads are done for the character which terminates
	the database header.  I assume that this was necessary under some
	DOS or Windows environment to compensate for the \r\n to \n
	converstion normally performed by the standard library provided with
	DOS C compilers.  Take one of these reads out and it works.  Attached
	is a .diff, in the format needed for the ports collection.

	While I was at it, I fixed a problem with the feature that trims
	trailing spaces from fields.  It miscalculated the end of the string
	and didn't trim anything.  This is in the same source file and fixed
	in the same .diff file.

--- patch-ab begins here ---
--- db_dump.c.orig	Tue Oct  8 02:25:54 1996
+++ db_dump.c	Fri Aug 16 14:24:09 2002
@@ -116,7 +116,7 @@
 {
     char *c=var;
 
-    for (c+=strlen(var); isspace (*c); c--);
+    for (c+=strlen(var)-1; isspace (*c); c--);
 
     *(++c) = '\0';
     return var;
@@ -210,7 +210,9 @@
 	stack_field(fld);
     }
     read(dbfile,Buffer,1);              /* read the silly little \r 0x0d character */
+#ifdef I_USE_A_LAME_OS_LIKE_DOS
     read(dbfile,Buffer,1);              /* strange, it only works if we read another byte */
+#endif
 
     return;
 }
--- patch-ab ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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