From owner-freebsd-hackers Thu Oct 14 5:37:43 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp.dti.ne.jp (smtp.dti.ne.jp [210.170.128.120]) by hub.freebsd.org (Postfix) with ESMTP id 9C3CC14BC4 for ; Thu, 14 Oct 1999 05:37:19 -0700 (PDT) (envelope-from shigio@tamacom.com) Received: from choota.signet.or.jp (PPP65.tama-ap5.dti.ne.jp [210.170.192.83]) by smtp.dti.ne.jp (8.9.0/3.7W) with ESMTP id VAA28289 for ; Thu, 14 Oct 1999 21:37:17 +0900 (JST) Received: from choota.signet.or.jp (localhost [127.0.0.1]) by choota.signet.or.jp (8.8.8/) with ESMTP id VAA07300 for ; Thu, 14 Oct 1999 21:34:15 +0900 (JST) Message-Id: <199910141234.VAA07300@tamacom.com> To: hackers@FreeBSD.ORG Subject: Nvi's new variable '@' Date: Thu, 14 Oct 1999 21:34:15 +0900 From: Shigio Yamaguchi Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I made a private patch for nvi(1) that enable you to use new variable '@' in arguments of ex's ! or !! command. The '@' is similar to '%' which means the editing file name. If you are editing file.c at 110 line then ':!echo @' means ':!echo 110'. It is convenient to use with gozilla(1). If you have hypertext of source code generated by htags with -l option then you can display editing text on mozilla as a hypertext. :!gozilla +@ % Suggested .nexrc: +-------------------------- |map ^G :!gozilla +@ %^M But this is a serious modification of nvi's spec. You cannot use '@' as a constant in nvi's shell command line. So, you had better use this patch personally. Here is a patch for /usr/src/contrib/nvi/ex/ex_argv.c in freebsd-current. *** ex_argv.c.org Fri Nov 1 15:45:30 1996 --- ex_argv.c Thu Oct 14 20:30:04 1999 *************** *** 326,331 **** --- 326,332 ---- EX_PRIVATE *exp; char *bp, *t; size_t blen, len, off, tlen; + char b[30]; /* Replace file name characters. */ for (bp = *bpp, blen = *blenp, len = *lenp; cmdlen > 0; --cmdlen, ++cmd) *************** *** 348,354 **** F_SET(excp, E_MODIFY); break; case '%': ! if ((t = sp->frp->name) == NULL) { msgq(sp, M_ERR, "116|No filename to substitute for %%"); return (1); --- 349,359 ---- F_SET(excp, E_MODIFY); break; case '%': ! case '@': /* replace with line number */ ! if (*cmd == '@') { ! snprintf(b, sizeof(b), "%d", sp->lno); ! t = b; ! } else if ((t = sp->frp->name) == NULL) { msgq(sp, M_ERR, "116|No filename to substitute for %%"); return (1); -- Shigio Yamaguchi - Tama Communications Corporation Mail: shigio@tamacom.com, WWW: http://www.tamacom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message