prompt.h (1b35f8f70349c56eaae8c72a3de1e59db56da9c0) | prompt.h (b6217683dc0269a53b799399522dbdfb5a4919cc) |
---|---|
1/*- 2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: prompt.h,v 1.1.2.2 1998/02/16 00:01:00 brian Exp $ | 26 * $Id: prompt.h,v 1.1.2.3 1998/02/17 19:28:13 brian Exp $ |
27 */ 28 | 27 */ 28 |
29#define LOCAL_AUTH 0x01 30#define LOCAL_NO_AUTH 0x02 31#define LOCAL_DENY 0x03 32#define LOCAL_CX 0x04 /* OR'd value - require a context */ 33#define LOCAL_CX_OPT 0x08 /* OR'd value - optional context */ 34 35struct server; 36struct bundle; 37 |
|
29struct prompt { 30 struct descriptor desc; 31 int fd_in, fd_out; 32 struct datalink *TermMode; /* The modem we're talking directly to */ 33 FILE *Term; /* sits on top of fd_out */ | 38struct prompt { 39 struct descriptor desc; 40 int fd_in, fd_out; 41 struct datalink *TermMode; /* The modem we're talking directly to */ 42 FILE *Term; /* sits on top of fd_out */ |
43 u_char auth; /* Local Authorized status */ 44 struct server *owner; /* who created me */ 45 struct bundle *bundle; /* who I'm controlling */ 46 unsigned nonewline : 1; /* need a newline before our prompt ? */ 47 unsigned needprompt : 1; /* Show a prompt at the next UpdateSet() */ |
|
34 | 48 |
49 char who[40]; /* Where do I come from */ 50 51 struct prompt *lognext; /* Maintained in log.c */ 52 u_long logmask; /* Maintained in log.c */ 53 |
|
35 struct termios oldtio; /* Original tty mode */ 36 struct termios comtio; /* Command level tty mode */ 37}; 38 39#define prompt2descriptor(p) (&(p)->desc) 40#define descriptor2prompt(d) \ 41 ((d)->type == PROMPT_DESCRIPTOR ? (struct prompt *)(d) : NULL) 42 | 54 struct termios oldtio; /* Original tty mode */ 55 struct termios comtio; /* Command level tty mode */ 56}; 57 58#define prompt2descriptor(p) (&(p)->desc) 59#define descriptor2prompt(d) \ 60 ((d)->type == PROMPT_DESCRIPTOR ? (struct prompt *)(d) : NULL) 61 |
43extern struct prompt prompt; 44 45#define prompt_Active(p) ((p)->Term ? 1 : 0) 46#define PROMPT_NONE -2 47#define PROMPT_STD -1 48extern int prompt_Init(struct prompt *, int); 49extern void prompt_Display(struct prompt *, struct bundle *); 50extern void prompt_Drop(struct prompt *, int); | 62#define PROMPT_STD (-1) 63extern struct prompt *prompt_Create(struct server *, struct bundle *, int); 64extern void prompt_Destroy(struct prompt *, int); 65extern void prompt_DestroyUnclean(struct prompt *); 66extern void prompt_Required(struct prompt *); |
51extern void prompt_Printf(struct prompt *, const char *, ...); 52extern void prompt_vPrintf(struct prompt *, const char *, _BSD_VA_LIST_); 53#define PROMPT_DONT_WANT_INT 1 54#define PROMPT_WANT_INT 0 55extern void prompt_TtyInit(struct prompt *, int); 56extern void prompt_TtyCommandMode(struct prompt *); 57extern void prompt_TtyTermMode(struct prompt *, struct datalink *); 58extern void prompt_TtyOldMode(struct prompt *); 59extern pid_t prompt_pgrp(struct prompt *); | 67extern void prompt_Printf(struct prompt *, const char *, ...); 68extern void prompt_vPrintf(struct prompt *, const char *, _BSD_VA_LIST_); 69#define PROMPT_DONT_WANT_INT 1 70#define PROMPT_WANT_INT 0 71extern void prompt_TtyInit(struct prompt *, int); 72extern void prompt_TtyCommandMode(struct prompt *); 73extern void prompt_TtyTermMode(struct prompt *, struct datalink *); 74extern void prompt_TtyOldMode(struct prompt *); 75extern pid_t prompt_pgrp(struct prompt *); |
60#define prompt_IsTermMode(p) ((p)->TermMode ? 1 : 0) | 76extern int PasswdCommand(struct cmdargs const *); 77#define prompt_IsTermMode(p, dl) ((p)->TermMode == (dl) ? 1 : 0) 78#define prompt_IsController(p) (!(p) || (p)->owner ? 0 : 1) 79#define prompt_Required(p) ((p)->needprompt = 1) |