From owner-freebsd-hackers Sat Oct 21 4:30:49 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.inka.de (quechua.inka.de [212.227.14.2]) by hub.freebsd.org (Postfix) with ESMTP id 9798537B4C5 for ; Sat, 21 Oct 2000 04:30:45 -0700 (PDT) Received: from kemoauc.mips.inka.de (uucp@) by mail.inka.de with local-bsmtp id 13mwrM-00064d-01; Sat, 21 Oct 2000 13:30:44 +0200 Received: (from naddy@localhost) by kemoauc.mips.inka.de (8.11.0/8.11.0) id e9LBS0C67484 for freebsd-hackers@freebsd.org; Sat, 21 Oct 2000 13:28:00 +0200 (CEST) (envelope-from naddy) Date: Sat, 21 Oct 2000 13:28:00 +0200 From: Christian Weisgerber To: freebsd-hackers@freebsd.org Subject: Anybody want to review vi patch? Message-ID: <20001021132800.A67078@kemoauc.mips.inka.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="UugvWAfsgieZRqgk" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline There's a bug in nvi 1.79. The options "noprint", "print", and "octal" don't work properly. When these options are changed, the routine that evaluates them is called before the option has been set. Do we have any people who know their way around the guts of nvi? I've appended a patch, partly based on a change in nvi 1.81 where this is fixed incompletely, and I'd like somebody to review this. -- Christian "naddy" Weisgerber naddy@mips.inka.de --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="nvi.patch" diff -ur /usr/src/contrib/nvi/common/options.c nvi/common/options.c --- /usr/src/contrib/nvi/common/options.c Sat Apr 19 01:36:33 1997 +++ nvi/common/options.c Sat Oct 21 13:06:06 2000 @@ -132,7 +132,7 @@ /* O_NUMBER 4BSD */ {"number", f_reformat, OPT_0BOOL, 0}, /* O_OCTAL 4.4BSD */ - {"octal", f_print, OPT_0BOOL, 0}, + {"octal", f_octal, OPT_0BOOL, 0}, /* O_OPEN 4BSD */ {"open", NULL, OPT_1BOOL, 0}, /* O_OPTIMIZE 4BSD */ diff -ur /usr/src/contrib/nvi/common/options_f.c nvi/common/options_f.c --- /usr/src/contrib/nvi/common/options_f.c Fri Nov 1 07:45:38 1996 +++ nvi/common/options_f.c Sat Oct 21 13:11:14 2000 @@ -190,6 +190,34 @@ char *str; u_long *valp; { + /* Preset the value, needed for reinitialization of lookup table. */ + if (o_set(sp, op-sp->opts, OS_STRDUP, str, 0)) + return(1); + + /* Reinitialize the key fast lookup table. */ + v_key_ilookup(sp); + + /* Reformat the screen. */ + F_SET(sp, SC_SCR_REFORMAT); + return (0); +} + +/* + * PUBLIC: int f_octal __P((SCR *, OPTION *, char *, u_long *)); + */ +int +f_octal(sp, op, str, valp) + SCR *sp; + OPTION *op; + char *str; + u_long *valp; +{ + /* Preset the value, needed for reinitialization of lookup table. */ + if (*valp) + O_CLR(sp, op - sp->opts); + else + O_SET(sp, op - sp->opts); + /* Reinitialize the key fast lookup table. */ v_key_ilookup(sp); diff -ur /usr/src/contrib/nvi/include/com_extern.h nvi/include/com_extern.h --- /usr/src/contrib/nvi/include/com_extern.h Fri Nov 1 07:45:31 1996 +++ nvi/include/com_extern.h Sat Oct 21 13:05:53 2000 @@ -157,6 +157,7 @@ int f_msgcat __P((SCR *, OPTION *, char *, u_long *)); int f_paragraph __P((SCR *, OPTION *, char *, u_long *)); int f_print __P((SCR *, OPTION *, char *, u_long *)); +int f_octal __P((SCR *, OPTION *, char *, u_long *)); int f_readonly __P((SCR *, OPTION *, char *, u_long *)); int f_recompile __P((SCR *, OPTION *, char *, u_long *)); int f_reformat __P((SCR *, OPTION *, char *, u_long *)); --UugvWAfsgieZRqgk-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message