version 1.0
[nvi.git] / vi / v_mark.c
blob9f8496be169c6af57a991f36cca25176c0887474
1 /*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
6 */
8 #ifndef lint
9 static char sccsid[] = "$Id: v_mark.c,v 8.3 1993/10/31 14:20:09 bostic Exp $ (Berkeley) $Date: 1993/10/31 14:20:09 $";
10 #endif /* not lint */
12 #include <sys/types.h>
14 #include "vi.h"
15 #include "vcmd.h"
18 * v_mark -- m[a-z]
19 * Set a mark.
21 int
22 v_mark(sp, ep, vp, fm, tm, rp)
23 SCR *sp;
24 EXF *ep;
25 VICMDARG *vp;
26 MARK *fm, *tm, *rp;
28 rp->lno = fm->lno;
29 rp->cno = fm->cno;
30 return (mark_set(sp, ep, vp->character, fm, 1));
34 * v_gomark -- '['`a-z], or `['`a-z]
35 * Move to a mark.
37 * The single quote form moves to the first nonblank character of a line
38 * containing a mark. The back quote form moves to a mark, setting both
39 * row and column. We use a single routine for both forms, taking care
40 * of the nonblank behavior using a flag for the command.
42 * Although not commonly known, the "'`" and "'`" forms are historically
43 * valid. The behavior is determined by the first character, so "`'" is
44 * the same as "``". Remember this fact -- you'll be amazed at how many
45 * people don't know it and will be delighted that you are able to tell
46 * them.
48 int
49 v_gomark(sp, ep, vp, fm, tm, rp)
50 SCR *sp;
51 EXF *ep;
52 VICMDARG *vp;
53 MARK *fm, *tm, *rp;
55 MARK *mp;
57 if ((mp = mark_get(sp, ep, vp->character)) == NULL)
58 return (1);
59 *rp = *mp;
60 return (0);