1/*	$OpenBSD: msg.h,v 1.3 2001/01/29 01:58:31 niklas Exp $	*/
2
3/*-
4 * Copyright (c) 1993, 1994
5 *	The Regents of the University of California.  All rights reserved.
6 * Copyright (c) 1993, 1994, 1995, 1996
7 *	Keith Bostic.  All rights reserved.
8 *
9 * See the LICENSE file for redistribution information.
10 *
11 *	@(#)msg.h	10.10 (Berkeley) 5/10/96
12 */
13
14/*
15 * Common messages (continuation or confirmation).
16 */
17typedef enum {
18	CMSG_CONF, CMSG_CONT, CMSG_CONT_EX,
19	CMSG_CONT_R, CMSG_CONT_S, CMSG_CONT_Q } cmsg_t;
20
21/*
22 * Message types.
23 *
24 * !!!
25 * In historical vi, O_VERBOSE didn't exist, and O_TERSE made the error
26 * messages shorter.  In this implementation, O_TERSE has no effect and
27 * O_VERBOSE results in informational displays about common errors, for
28 * naive users.
29 *
30 * M_NONE	Display to the user, no reformatting, no nothing.
31 *
32 * M_BERR	Error: M_ERR if O_VERBOSE, else bell.
33 * M_ERR	Error: Display in inverse video.
34 * M_INFO	 Info: Display in normal video.
35 * M_SYSERR	Error: M_ERR, using strerror(3) message.
36 * M_VINFO	 Info: M_INFO if O_VERBOSE, else ignore.
37 *
38 * The underlying message display routines only need to know about M_NONE,
39 * M_ERR and M_INFO -- all the other message types are converted into one
40 * of them by the message routines.
41 */
42typedef enum {
43	M_NONE = 1, M_BERR, M_ERR, M_INFO, M_SYSERR, M_VINFO } mtype_t;
44
45/*
46 * There are major problems with error messages being generated by routines
47 * preparing the screen to display error messages.  It's possible for the
48 * editor to generate messages before we have a screen in which to display
49 * them, or during the transition between ex (and vi startup) and a true vi.
50 * There's a queue in the global area to hold them.
51 *
52 * If SC_EX/SC_VI is set, that's the mode that the editor is in.  If the flag
53 * S_SCREEN_READY is set, that means that the screen is prepared to display
54 * messages.
55 */
56typedef struct _msgh MSGH;	/* MSGS list head structure. */
57LIST_HEAD(_msgh, _msg);
58struct _msg {
59	LIST_ENTRY(_msg) q;	/* Linked list of messages. */
60	mtype_t	 mtype;		/* Message type: M_NONE, M_ERR, M_INFO. */
61	char	*buf;		/* Message buffer. */
62	size_t	 len;		/* Message length. */
63};
64
65/* Flags to msgq_status(). */
66#define	MSTAT_SHOWLAST	0x01	/* Show the line number of the last line. */
67#define	MSTAT_TRUNCATE	0x02	/* Truncate the file name if it's too long. */
68