Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / nvi / ex / ex_equal.c
blob043840ccd22dc029460b4e4605347ec4da4628c8
1 /* $NetBSD: ex_equal.c,v 1.1.1.2 2008/05/18 14:31:14 aymeric Exp $ */
3 /*-
4 * Copyright (c) 1992, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1992, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved.
9 * See the LICENSE file for redistribution information.
12 #include "config.h"
14 #ifndef lint
15 static const char sccsid[] = "Id: ex_equal.c,v 10.12 2001/06/25 15:19:15 skimo Exp (Berkeley) Date: 2001/06/25 15:19:15";
16 #endif /* not lint */
18 #include <sys/types.h>
19 #include <sys/queue.h>
21 #include <bitstring.h>
22 #include <limits.h>
23 #include <stdio.h>
25 #include "../common/common.h"
28 * ex_equal -- :address =
30 * PUBLIC: int ex_equal __P((SCR *, EXCMD *));
32 int
33 ex_equal(SCR *sp, EXCMD *cmdp)
35 db_recno_t lno;
37 NEEDFILE(sp, cmdp);
40 * Print out the line number matching the specified address,
41 * or the number of the last line in the file if no address
42 * specified.
44 * !!!
45 * Historically, ":0=" displayed 0, and ":=" or ":1=" in an
46 * empty file displayed 1. Until somebody complains loudly,
47 * we're going to do it right. The tables in excmd.c permit
48 * lno to get away with any address from 0 to the end of the
49 * file, which, in an empty file, is 0.
51 if (F_ISSET(cmdp, E_ADDR_DEF)) {
52 if (db_last(sp, &lno))
53 return (1);
54 } else
55 lno = cmdp->addr1.lno;
57 (void)ex_printf(sp, "%ld\n", (unsigned long)lno);
58 return (0);