[371] in Zephyr_Bugs

home help back first fref pref prev next nref lref last post

zwgc error

daemon@ATHENA.MIT.EDU (Marc Horowitz)
Sat Jun 20 01:15:24 1992

To: bugs@Athena.MIT.EDU, testers@Athena.MIT.EDU
Cc: bug-zephyr@Athena.MIT.EDU, lwvanels@Athena.MIT.EDU
Reply-To: Marc Horowitz <marc@MIT.EDU>
Date: Sat, 20 Jun 92 01:15:00 EDT
From: Marc Horowitz <marc@Athena.MIT.EDU>

There is a bug in zwgc which causes protect("@@>)}]") to display
"@@>)}]", rather than displaying "@>)}]", which is correct.

The patch involves changing two files, eval.c and formatter.c.  The
eval.c in the release source tree is the same as in the zephyr
development tree, so that patch (the first one) is straighforward.
However, formatter.c in the release source tree is one version older.
So, I've provided two diffs, one to bring the release locker up to
date, and another to fix the bug.  If you don't want to apply the code
enhancement, but do want the bug fix, you may have to apply the third
patch with fuzz or by hand.

		Marc

for eval.c:

*** 1.3	1989/11/15 16:34:55
--- 1.4	1992/06/20 04:03:14
***************
*** 5,11 ****
   *      Created by:     Marc Horowitz <marc@athena.mit.edu>
   *
   *      $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/zwgc/RCS/eval.c,v $
!  *      $Author: jtkohl $
   *
   *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
   *      For copying and distribution information, see the file
--- 5,11 ----
   *      Created by:     Marc Horowitz <marc@athena.mit.edu>
   *
   *      $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/zwgc/RCS/eval.c,v $
!  *      $Author: marc $
   *
   *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
   *      For copying and distribution information, see the file
***************
*** 13,19 ****
   */
  
  #if (!defined(lint) && !defined(SABER))
! static char rcsid_eval_c[] = "$Id: eval.c,v 1.3 1989/11/15 16:34:55 jtkohl Exp $";
  #endif
  
  #include <zephyr/mit-copyright.h>
--- 13,19 ----
   */
  
  #if (!defined(lint) && !defined(SABER))
! static char rcsid_eval_c[] = "$Id: eval.c,v 1.4 1992/06/20 04:03:14 marc Exp $";
  #endif
  
  #include <zephyr/mit-copyright.h>
***************
*** 160,166 ****
  	    break;
  
  	  case VERBATIM_OPCODE:
! 	    return(verbatim(first));
  
  	  case GETENV_OPCODE:
  	    result = getenv(first);
--- 160,166 ----
  	    break;
  
  	  case VERBATIM_OPCODE:
! 	    return(verbatim(first,0));
  
  	  case GETENV_OPCODE:
  	    result = getenv(first);


for formatter.c (1/2)

*** 1.9	1991/01/09 02:37:57
--- 1.10	1991/12/05 15:35:39
***************
*** 5,11 ****
   *      Created by:     Marc Horowitz <marc@athena.mit.edu>
   *
   *      $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/zwgc/RCS/formatter.c,v $
!  *      $Author: raeburn $
   *
   *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
   *      For copying and distribution information, see the file
--- 5,11 ----
   *      Created by:     Marc Horowitz <marc@athena.mit.edu>
   *
   *      $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/zwgc/RCS/formatter.c,v $
!  *      $Author: lwvanels $
   *
   *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
   *      For copying and distribution information, see the file
***************
*** 13,19 ****
   */
  
  #if (!defined(lint) && !defined(SABER))
! static char rcsid_formatter_c[] = "$Id: formatter.c,v 1.9 1991/01/09 02:37:57 raeburn Exp $";
  #endif
  
  #include <zephyr/mit-copyright.h>
--- 13,19 ----
   */
  
  #if (!defined(lint) && !defined(SABER))
! static char rcsid_formatter_c[] = "$Id: formatter.c,v 1.10 1991/12/05 15:35:39 lwvanels Exp $";
  #endif
  
  #include <zephyr/mit-copyright.h>
***************
*** 20,25 ****
--- 20,26 ----
  
  #include <stdio.h>
  #include <ctype.h>
+ #include <string.h>
  #include "new_memory.h"
  #include "char_stack.h"
  #include "string_dictionary.h"
***************
*** 286,292 ****
  
     temp=lbreak(&str,allmaskable_set);
     while(*str) {
!       bracketnum=(int) (index(brackets,str[0])-brackets);
        temp=string_Concat2(temp,openbracket[bracketnum]);
        temp=string_Concat2(temp,temp2=lany(&str," "));
        free(temp2);
--- 287,293 ----
  
     temp=lbreak(&str,allmaskable_set);
     while(*str) {
!       bracketnum=(int) (strchr(brackets,str[0])-brackets);
        temp=string_Concat2(temp,openbracket[bracketnum]);
        temp=string_Concat2(temp,temp2=lany(&str," "));
        free(temp2);


for formatter.c (2/2)

*** 1.10	1991/12/05 15:35:39
--- 1.11	1992/06/20 04:49:10
***************
*** 5,11 ****
   *      Created by:     Marc Horowitz <marc@athena.mit.edu>
   *
   *      $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/zwgc/RCS/formatter.c,v $
!  *      $Author: lwvanels $
   *
   *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
   *      For copying and distribution information, see the file
--- 5,11 ----
   *      Created by:     Marc Horowitz <marc@athena.mit.edu>
   *
   *      $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/zwgc/RCS/formatter.c,v $
!  *      $Author: marc $
   *
   *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
   *      For copying and distribution information, see the file
***************
*** 13,19 ****
   */
  
  #if (!defined(lint) && !defined(SABER))
! static char rcsid_formatter_c[] = "$Id: formatter.c,v 1.10 1991/12/05 15:35:39 lwvanels Exp $";
  #endif
  
  #include <zephyr/mit-copyright.h>
--- 13,19 ----
   */
  
  #if (!defined(lint) && !defined(SABER))
! static char rcsid_formatter_c[] = "$Id: formatter.c,v 1.11 1992/06/20 04:49:10 marc Exp $";
  #endif
  
  #include <zephyr/mit-copyright.h>
***************
*** 228,235 ****
  /* the char * that str points to is free'd by this function.
   * if you want to keep it, save it yourself
   */
! string verbatim(str)
       string str;
  {
     char *temp,*temp2;
     int bracketnum,len;
--- 228,236 ----
  /* the char * that str points to is free'd by this function.
   * if you want to keep it, save it yourself
   */
! string verbatim(str, bracketsonly)
       string str;
+      int bracketsonly;
  {
     char *temp,*temp2;
     int bracketnum,len;
***************
*** 285,291 ****
        }
     }
  
!    temp=lbreak(&str,allmaskable_set);
     while(*str) {
        bracketnum=(int) (strchr(brackets,str[0])-brackets);
        temp=string_Concat2(temp,openbracket[bracketnum]);
--- 286,292 ----
        }
     }
  
!    temp=lbreak(&str,bracketsonly?allbracket_set:allmaskable_set);
     while(*str) {
        bracketnum=(int) (strchr(brackets,str[0])-brackets);
        temp=string_Concat2(temp,openbracket[bracketnum]);
***************
*** 292,298 ****
        temp=string_Concat2(temp,temp2=lany(&str," "));
        free(temp2);
        temp=string_Concat2(temp,closebracket[bracketnum]);
!       temp=string_Concat2(temp,temp2=lbreak(&str,allmaskable_set));
        free(temp2);
     }
     free(str);  /* str is "" at this point, anyway */
--- 293,300 ----
        temp=string_Concat2(temp,temp2=lany(&str," "));
        free(temp2);
        temp=string_Concat2(temp,closebracket[bracketnum]);
!       temp=string_Concat2(temp,temp2=lbreak(&str,bracketsonly?
! 					  allbracket_set:allmaskable_set));
        free(temp2);
     }
     free(str);  /* str is "" at this point, anyway */
***************
*** 337,347 ****
  	    templen += len;
  	    free(temp2);
  	 } else {
! 	    /* if the block is top level text, verbatim it and add to temp */
  
  	    temp2 = string_CreateFromData(str,len);
  	    str += len;
! 	    temp3 = verbatim(temp2);
  	    temp = string_Concat2(temp,temp3);
  	    templen += strlen(temp3);
  	    free(temp3);
--- 339,350 ----
  	    templen += len;
  	    free(temp2);
  	 } else {
! 	    /* if the block is top level text, verbatim brackets only
! 	       (not @'s) and add text to temp */
  
  	    temp2 = string_CreateFromData(str,len);
  	    str += len;
! 	    temp3 = verbatim(temp2,1);
  	    temp = string_Concat2(temp,temp3);
  	    templen += strlen(temp3);
  	    free(temp3);

home help back first fref pref prev next nref lref last post