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