Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Again: Patch to make '\n' work in faxcover comments



Ooops, I sent out a normal diff. The other one will work, but not so
fault tolerant. Here it is again this time a context diff.

Here is a patch against 4.0pl2 to faxcover that allows line feeds in the
comments to do the right thing. There was an extra '\' in the wrong
place along with a few other things. I have increased the maximum
comment length to 60 and put it into a variable (it was hard coded at
35). This should really be extracted from a config file somewhere.

This will only fix things if you use the comment1, comment2, comment3
postscript variables in your cover page (the default one does not). The
comment variable (which holds the whole lot - not split into lines)
still doesn't treat linefeeds correctly (it ignores them). This requires
a change to the postscript function. I am not a good postscript
programmer unfortunately.

You should be in the faxcover source directory, before running this
patch.

Problems let me know.

Damian
-- 
 ______________________________________________________________________
* Damian Ivereigh     *      ||        ||      * Cisco Systems, Inc.   *
* MIS Printer Admin   *    .||||.    .||||.    * 408-526-4413          *
* Linux Bigot         * ..:||||||:..:||||||:.. * 800-800-1180 x64413   *
* damian@cisco.com    *   cisco Systems, Inc.  * Fax:   408-527-2563   *
*______________________________________________________________________*Index: faxcover.c++
===================================================================
RCS file: /usr/local/cvsroot/source/hylafax/faxcover/faxcover.c++,v
retrieving revision 1.1.1.1
retrieving revision 1.1.2.1
diff -c -r1.1.1.1 -r1.1.2.1
*** faxcover.c++	1998/07/01 21:50:44	1.1.1.1
--- faxcover.c++	1998/07/07 19:19:18	1.1.2.1
***************
*** 1,4 ****
! /*	$Id: faxcover.c++,v 1.1.1.1 1998/07/01 21:50:44 damian Exp $ */
  /*
   * Copyright (c) 1990-1996 Sam Leffler
   * Copyright (c) 1991-1996 Silicon Graphics, Inc.
--- 1,4 ----
! /*	$Id: faxcover.c++,v 1.1.2.1 1998/07/07 19:19:18 damian Exp $ */
  /*
   * Copyright (c) 1990-1996 Sam Leffler
   * Copyright (c) 1991-1996 Silicon Graphics, Inc.
***************
*** 53,58 ****
--- 53,59 ----
      float	pageWidth;	// page width (mm)
      float	pageLength;	// page length (mm)
      int		maxcomments;	// max # of comment lines
+     int		maxcommlen;	// max length of comment lines
  
      static const char* prologue;
  
***************
*** 81,86 ****
--- 82,88 ----
  {
      db = 0;
      maxcomments = 20;
+ 	maxcommlen = 60;
  }
  
  faxCoverApp::~faxCoverApp()
***************
*** 338,347 ****
      int line = 1;
      while (comments.length() > 0) {
  	// strip leading white space
! 	while (comments.length() > 0 && isspace(comments[0]))
  	    comments.remove(0);
! 	int len = fxmin(comments.length(), (u_int) 35);
! 	if (len == 35 && !isspace(comments[len-1])) {// break on word boundary
  	    int l = len-1;
  	    for (; l > 1 && !isspace(comments[l-1]); l--)
  		;
--- 340,349 ----
      int line = 1;
      while (comments.length() > 0) {
  	// strip leading white space
! 	while (comments.length() > 0 && isspace(comments[0]) && comments[0]!='\n')
  	    comments.remove(0);
! 	int len = fxmin(comments.length(), (u_int) maxcommlen);
! 	if (len == maxcommlen && !isspace(comments[len-1])) {// break on word boundary
  	    int l = len-1;
  	    for (; l > 1 && !isspace(comments[l-1]); l--)
  		;
***************
*** 350,363 ****
  	    // otherwise, break in the middle of this really long word
  	}
        int tot = comments.length();
!       u_int crlf = comments.find(0, "\\n", (u_int) 0);
        if ( crlf < comments.length() && crlf < len ) {
                len = crlf;
        }
  	fxStr num(line, "%u");
  	coverDef("comments" | num, comments.cut(0,len));
!       if ( crlf < tot && comments.length() >= 2 ) {
!               comments.cut(0, 2);
        }
  	line++;
      }
--- 352,365 ----
  	    // otherwise, break in the middle of this really long word
  	}
        int tot = comments.length();
!       u_int crlf = comments.find(0, "\n", (u_int) 0);
        if ( crlf < comments.length() && crlf < len ) {
                len = crlf;
        }
  	fxStr num(line, "%u");
  	coverDef("comments" | num, comments.cut(0,len));
!       if ( crlf < tot && comments.length() >= 1 ) {
!               comments.cut(0, 1);
        }
  	line++;
      }



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services