-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1980 Regents of the University of California */
+/* sccs id: @(#)ex.h 6.1 10/18/80 */
#ifdef V6
#include <retrofit.h>
#endif
/*
- * Ex version 3.1
+ * Ex version 3 (see exact version in ex_cmds.c, search for /Version/)
*
* Mark Horton, UC Berkeley
* Bill Joy, UC Berkeley
*
* Please forward bug reports to
*
- * Bill Joy
+ * Mark Horton
* Computer Science Division, EECS
* EVANS HALL
* U.C. Berkeley 94704
* (415) 642-4948
* (415) 642-1024 (dept. office)
*
- * or to wnj@mit-mc on the ARPA-net. I would particularly like to hear
+ * or to csvax.mark@berkeley on the ARPA-net. I would particularly like to hear
* of additional terminal descriptions you add to the termcap data base.
*/
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
-#include <sgtty.h>
#include <signal.h>
#include <setjmp.h>
#include <sys/stat.h>
+/*
+ * The following little dance copes with the new USG tty handling.
+ * This stuff has the advantage of considerable flexibility, and
+ * the disadvantage of being incompatible with anything else.
+ * The presence of the symbol USG3TTY will indicate the new code:
+ * in this case, we define CBREAK (because we can simulate it exactly),
+ * but we won't actually use it, so we set it to a value that will
+ * probably blow the compilation if we goof up.
+ */
+#ifdef USG3TTY
+#include <termio.h>
+#define CBREAK xxxxx
+#else
+#include <sgtty.h>
+#endif
+
extern int errno;
#ifndef VMUNIX
# undef putchar
# undef getchar
#else
-#ifdef VMUNIX
+# ifdef VMUNIX
# define BUFSIZ 1024
-#else
+# else
# define BUFSIZ 512
-#endif
+# endif
# define NULL 0
# define EOF -1
#endif
char *Command;
short defwind; /* -w# change default window size */
int dirtcnt; /* When >= MAXDIRT, should sync temporary */
+#ifdef TIOCLGET
+bool dosusp; /* Do SIGTSTP in visual when ^Z typed */
+#endif
bool edited; /* Current file is [Edited] */
line *endcore; /* Last available core location */
bool endline; /* Last cmd mode command ended with \n */
bool hush; /* Command line option - was given, hush up! */
char *globp; /* (Untyped) input string to command mode */
bool holdcm; /* Don't cursor address */
+bool inappend; /* in ex command append mode */
bool inglobal; /* Inside g//... or v//... */
char *initev; /* Initial : escape for visual */
bool inopen; /* Inside open or visual */
int notecnt; /* Count for notify (to visual from cmd) */
bool numberf; /* Command should run in number mode */
char obuf[BUFSIZ]; /* Buffer for tty output */
+short oprompt; /* Saved during source */
short ospeed; /* Output speed (from gtty) */
int otchng; /* Backup tchng to find changes in macros */
short peekc; /* Peek ahead character (cmd mode input) */
jmp_buf resetlab; /* For error throws to top level (cmd mode) */
int rpid; /* Pid returned from wait() */
bool ruptible; /* Interruptible is normal state */
+bool seenprompt; /* 1 if have gotten user input */
bool shudclob; /* Have a prompt to clobber (e.g. on ^D) */
int status; /* Status returned from wait() */
int tchng; /* If nonzero, then [Modified] */
short tfile; /* Temporary file unit */
bool vcatch; /* Want to catch an error (open/visual) */
jmp_buf vreslab; /* For error throws to a visual catch */
+bool writing; /* 1 if in middle of a file write */
int xchng; /* Suppresses multiple "No writes" in !cmd */
/*
* Macros
*/
#define CP(a, b) (ignore(strcpy(a, b)))
+ /*
+ * FIXUNDO: do we want to mung undo vars?
+ * Usually yes unless in a macro or global.
+ */
+#define FIXUNDO (inopen >= 0 && (inopen || !inglobal))
#define ckaw() {if (chng && value(AUTOWRITE)) wop(0);}
#define copy(a,b,c) Copy((char *) a, (char *) b, c)
#define eq(a, b) ((a) && (b) && strcmp(a, b) == 0)
* Environment like memory
*/
char altfile[FNSIZE]; /* Alternate file name */
-char direct[32]; /* Temp file goes here */
-char shell[32]; /* Copied to be settable */
-char ttytype[16]; /* A long and pretty name */
+char direct[ONMSZ]; /* Temp file goes here */
+char shell[ONMSZ]; /* Copied to be settable */
+char ttytype[ONMSZ]; /* A long and pretty name */
char uxb[UXBSIZE + 2]; /* Last !command for !! */
/*
#define UNDNONE 3
#define UNDPUT 4
+#ifdef CRYPT
+/*
+ * Various miscellaneous flags and buffers needed by the encryption routines.
+ */
+#define KSIZE 9 /* key size for encryption */
+#define KEYPROMPT "Key: "
+int xflag; /* True if we are in encryption mode */
+int xtflag; /* True if the temp file is being encrypted */
+int kflag; /* True if the key has been accepted */
+char perm[768];
+char tperm[768];
+char *key;
+char crbuf[CRSIZE];
+char *getpass();
+#endif
+
/*
* Function type definitions
*/
int (*oldquit)();
int onhup();
int onintr();
+int onsusp();
int putch();
int shift();
int termchar();