xref: /openbsd/usr.bin/vi/ex/ex_mark.c (revision 73471bf0)
1 /*	$OpenBSD: ex_mark.c,v 1.7 2016/01/06 22:28:52 millert Exp $	*/
2 
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.
8  *
9  * See the LICENSE file for redistribution information.
10  */
11 
12 #include "config.h"
13 
14 #include <sys/types.h>
15 #include <sys/queue.h>
16 
17 #include <bitstring.h>
18 #include <limits.h>
19 #include <stdio.h>
20 
21 #include "../common/common.h"
22 
23 /*
24  * ex_mark -- :mark char
25  *	      :k char
26  *	Mark lines.
27  *
28  *
29  * PUBLIC: int ex_mark(SCR *, EXCMD *);
30  */
31 int
32 ex_mark(SCR *sp, EXCMD *cmdp)
33 {
34 	NEEDFILE(sp, cmdp);
35 
36 	if (cmdp->argv[0]->len != 1) {
37 		msgq(sp, M_ERR, "Mark names must be a single character");
38 		return (1);
39 	}
40 	return (mark_set(sp, cmdp->argv[0]->bp[0], &cmdp->addr1, 1));
41 }
42