2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
13 static const char sccsid[] = "$Id: v_util.c,v 10.14 2001/06/25 15:19:36 skimo Exp $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
20 #include <bitstring.h>
28 #include "../common/common.h"
33 * Vi end-of-file error.
35 * PUBLIC: void v_eof __P((SCR *, MARK *));
38 v_eof(SCR *sp, MARK *mp)
43 v_emsg(sp, NULL, VIM_EOF);
45 if (db_last(sp, &lno))
48 v_emsg(sp, NULL, VIM_EOF);
50 msgq(sp, M_BERR, "195|Movement past the end-of-file");
56 * Vi end-of-line error.
58 * PUBLIC: void v_eol __P((SCR *, MARK *));
61 v_eol(SCR *sp, MARK *mp)
66 v_emsg(sp, NULL, VIM_EOL);
68 if (db_get(sp, mp->lno, DBG_FATAL, NULL, &len))
70 if (mp->cno == len - 1)
71 v_emsg(sp, NULL, VIM_EOL);
73 msgq(sp, M_BERR, "196|Movement past the end-of-line");
79 * Vi no cursor movement error.
81 * PUBLIC: void v_nomove __P((SCR *));
86 msgq(sp, M_BERR, "197|No cursor movement made");
91 * Vi start-of-file error.
93 * PUBLIC: void v_sof __P((SCR *, MARK *));
96 v_sof(SCR *sp, MARK *mp)
98 if (mp == NULL || mp->lno == 1)
99 msgq(sp, M_BERR, "198|Already at the beginning of the file");
101 msgq(sp, M_BERR, "199|Movement past the beginning of the file");
106 * Vi start-of-line error.
108 * PUBLIC: void v_sol __P((SCR *));
113 msgq(sp, M_BERR, "200|Already in the first column");
118 * Return if the line contains nothing but white-space characters.
120 * PUBLIC: int v_isempty __P((CHAR_T *, size_t));
123 v_isempty(CHAR_T *p, size_t len)
133 * Display a few common vi messages.
135 * PUBLIC: void v_emsg __P((SCR *, char *, vim_t));
138 v_emsg(SCR *sp, char *p, vim_t which)
143 "201|Buffers should be specified before the command");
146 msgq(sp, M_BERR, "209|The file is empty");
149 msgq(sp, M_BERR, "202|Already at end-of-file");
152 msgq(sp, M_BERR, "203|Already at end-of-line");
157 which == VIM_NOCOM_B ? M_BERR : M_ERR,
158 "204|%s isn't a vi command", p);
161 msgq(sp, M_ERR, "Window resize interrupted text input mode");
164 msgq(sp, M_ERR, "205|Usage: %s", p);