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