From d5dc3160cfa2f2c648f008d7fef1506303b7a1da Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 30 Sep 2005 22:52:45 -0700 Subject: [PATCH] Lots of ANSI'fication and cleanups Still tons of warnings with "-Wall", but now it's actually getting closer. It even compiles again. --- basic.c | 1 + bind.c | 3 +- buffer.c | 1 + crypt.c | 28 +- display.c | 1 + edef.h | 226 ---------------- efunc.h | 790 ++++++++++++++++++++++++++---------------------------- estruct.h | 2 +- eval.c | 195 ++++++++------ exec.c | 343 ++++++++++++------------ file.c | 74 ++--- fileio.c | 24 +- input.c | 1 + isearch.c | 70 +++-- line.c | 1 + lock.c | 70 ++--- main.c | 11 +- makefile | 4 +- names.c | 224 ++++++++++++++++ random.c | 1 + region.c | 1 + search.c | 166 +++++------- spawn.c | 46 ++-- tcap.c | 1 + window.c | 5 +- word.c | 1 + 26 files changed, 1151 insertions(+), 1139 deletions(-) create mode 100644 names.c diff --git a/basic.c b/basic.c index 96c25e5..184b6d7 100644 --- a/basic.c +++ b/basic.c @@ -12,6 +12,7 @@ #include #include "estruct.h" #include "edef.h" +#include "efunc.h" /* * Move the cursor to the diff --git a/bind.c b/bind.c index d918ac3..f8c515f 100644 --- a/bind.c +++ b/bind.c @@ -10,6 +10,7 @@ #include #include "estruct.h" #include "edef.h" +#include "efunc.h" #include "epath.h" int help(int f, int n) @@ -443,7 +444,7 @@ unsigned int getckey(int mflag) * * char *sfname; name of startup file (null if default) */ -startup(char *sfname) +int startup(char *sfname) { char *fname; /* resulting file name to execute */ diff --git a/buffer.c b/buffer.c index 3b32cd1..f8730ec 100644 --- a/buffer.c +++ b/buffer.c @@ -12,6 +12,7 @@ #include #include "estruct.h" #include "edef.h" +#include "efunc.h" /* * Attach a buffer to a window. The diff --git a/crypt.c b/crypt.c index 8fc56e6..96906be 100644 --- a/crypt.c +++ b/crypt.c @@ -8,16 +8,19 @@ #include #include "estruct.h" #include "edef.h" +#include "efunc.h" #if CRYPT static int mod95(); -setkey(f, n) - /* reset encryption key of current buffer */ -int f; /* default flag */ -int n; /* numeric argument */ - +/* + * reset encryption key of current buffer + * + * int f; default flag + * int n; numeric argument + */ +int setkey(int f, int n) { register int status; /* return status */ int odisinp; /* original vlaue of disinp */ @@ -134,11 +137,13 @@ int n; /* numeric argument */ * protection and security of the keys themselves are the * responsiblity of the user. * + * + * char *bptr; buffer of characters to be encrypted + * unsigned len; number of characters in the buffer + * **********/ -crypt(bptr, len) -register char *bptr; /* buffer of characters to be encrypted */ -register unsigned len; /* number of characters in the buffer */ +void crypt(char *bptr, unsigned len) { register int cc; /* current character being considered */ @@ -194,10 +199,7 @@ register unsigned len; /* number of characters in the buffer */ return; } -static int mod95(val) - -register int val; - +static int mod95(int val) { /* The mathematical MOD does not match the computer MOD */ @@ -215,7 +217,7 @@ register int val; return (val); } #else -nocrypt() +static void nocrypt(void) { } #endif diff --git a/display.c b/display.c index ba0b8dc..e8e0944 100644 --- a/display.c +++ b/display.c @@ -13,6 +13,7 @@ #include #include "estruct.h" #include "edef.h" +#include "efunc.h" typedef struct VIDEO { int v_flag; /* Flags */ diff --git a/edef.h b/edef.h index 398bc6a..b54d22e 100644 --- a/edef.h +++ b/edef.h @@ -318,229 +318,3 @@ extern char outline[]; /* global string to hold debug line text */ #ifndef termdef extern TERM term; /* Terminal information. */ #endif - -/* word.c */ -extern int wrapword(int f, int n); -extern int backword(int f, int n); -extern int forwword(int f, int n); -extern int upperword(int f, int n); -extern int lowerword(int f, int n); -extern int capword(int f, int n); -extern int delfword(int f, int n); -extern int delbword(int f, int n); -extern int inword(void); -extern int fillpara(int f, int n); -extern int justpara(int f, int n); -extern int killpara(int f, int n); -extern int wordcount(int f, int n); - -/* line.c */ -extern int lfree(LINE *lp); -extern int lchange(int flag); -extern int insspace(int f, int n); -extern int linstr(char *instr); -extern int linsert(int n, int c); -extern int lowrite(int c); -extern int lover(char *ostr); -extern int lnewline(void); -extern int ldelete(long n, int kflag); -extern char *getctext(void); -extern int putctext(char *iline); -extern int ldelnewline(void); -extern int kdelete(void); -extern int kinsert(int c); -extern int yank(int f, int n); - -/* window.c */ -extern int reposition(int f, int n); -extern int refresh(int f, int n); -extern int nextwind(int f, int n); -extern int prevwind(int f, int n); -extern int mvdnwind(int f, int n); -extern int mvupwind(int f, int n); -extern int onlywind(int f, int n); -extern int delwind(int f, int n); -extern int splitwind(int f, int n); -extern int enlargewind(int f, int n); -extern int shrinkwind(int f, int n); -extern int resize(int f, int n); -extern int scrnextup(int f, int n); -extern int scrnextdw(int f, int n); -extern int savewnd(int f, int n); -extern int restwnd(int f, int n); -extern int newsize(int f, int n); -extern int newwidth(int f, int n); -extern int getwpos(void); -extern int cknewwindow(void); - -/* basic.c */ -extern int gotobol(int f, int n); -extern int backchar(int f, int n); -extern int gotoeol(int f, int n); -extern int forwchar(int f, int n); -extern int gotoline(int f, int n); -extern int gotobob(int f, int n); -extern int gotoeob(int f, int n); -extern int forwline(int f, int n); -extern int backline(int f, int n); -extern int gotobop(int f, int n); -extern int gotoeop(int f, int n); -extern int getgoal(LINE *dlp); -extern int forwpage(int f, int n); -extern int backpage(int f, int n); -extern int setmark(int f, int n); -extern int swapmark(int f, int n); - -/* random.c */ -extern int tabsize; /* Tab size (0: use real tabs) */; -extern int setfillcol(int f, int n); -extern int showcpos(int f, int n); -extern int getcline(void); -extern int getccol(int bflg); -extern int setccol(int pos); -extern int twiddle(int f, int n); -extern int quote(int f, int n); -extern int tab(int f, int n); -extern int detab(int f, int n); -extern int entab(int f, int n); -extern int trim(int f, int n); -extern int openline(int f, int n); -extern int newline(int f, int n); -extern int cinsert(void); -extern int insbrace(int n, int c); -extern int insbrace(int n, int c); -extern int inspound(void); -extern int deblank(int f, int n); -extern int indent(int f, int n); -extern int forwdel(int f, int n); -extern int backdel(int f, int n); -extern int killtext(int f, int n); -extern int setmode(int f, int n); -extern int delmode(int f, int n); -extern int setgmode(int f, int n); -extern int delgmode(int f, int n); -extern int adjustmode(int kind, int global); -extern int clrmes(int f, int n); -extern int writemsg(int f, int n); -extern int getfence(int f, int n); -extern int fmatch(int ch); -extern int istring(int f, int n); -extern int ovstring(int f, int n); - -/* main.c */ -extern int edinit(char *bname); -extern int execute(int c, int f, int n); -extern int quickexit(int f, int n); -extern int quit(int f, int n); -extern int ctlxlp(int f, int n); -extern int ctlxrp(int f, int n); -extern int ctlxe(int f, int n); -extern int ctrlg(int f, int n); -extern int rdonly(void); -extern int resterr(void); -extern int nullproc(int f, int n); -extern int meta(int f, int n); -extern int cex(int f, int n); -extern int unarg(int f, int n); -extern int cexit(int status); - -/* display.c */ -extern void vtinit(void); -extern void vtfree(void); -extern void vttidy(void); -extern void vtmove(int row, int col); -extern void vtputc(int c); -extern void vteeol(void); -extern int upscreen(int f, int n); -extern int update(int force); -extern int reframe(WINDOW *wp); -extern void updone(WINDOW *wp); -extern void updall(WINDOW *wp); -extern void updpos(void); -extern void upddex(void); -extern void updgar(void); -extern int updupd(int force); -extern int scrolls(int inserts); -extern void scrscroll(int from, int to, int count); -extern int texttest(int vrow, int prow); -extern int endofline(char *s, int n); -extern void updext(void); -extern int updateline(int row, struct VIDEO *vp1, struct VIDEO *vp2); -extern void modeline(WINDOW *wp); -extern void upmode(void); -extern void movecursor(int row, int col); -extern void mlerase(void); -extern void mlwrite(const char *fmt, ...); -extern void mlforce(char *s); -extern void mlputs(char *s); -extern void mlputi(int i, int r); -extern void mlputli(long l, int r); -extern void mlputf(int s); -extern void putline(int row, int col, char *buf); -extern void getscreensize(int *widthp, int *heightp); -extern void sizesignal(int signr); -extern int newscreensize(int h, int w); - -/* region.c */ -extern int killregion(int f, int n); -extern int copyregion(int f, int n); -extern int lowerregion(int f, int n); -extern int upperregion(int f, int n); -extern int getregion(REGION *rp); - -/* posix.c */ -extern void ttopen(void); -extern void ttclose(void); -extern int ttputc(int c); -extern void ttflush(void); -extern int ttgetc(void); -extern int typahead(void); - -/* input.c */ -extern int mlyesno(char *prompt); -extern int mlreply(char *prompt, char *buf, int nbuf); -extern int mlreplyt(char *prompt, char *buf, int nbuf, int eolchar); -extern int ectoc(int c); -extern int ctoec(int c); -extern fn_t getname(void); -extern int tgetc(void); -extern int get1key(void); -extern int getcmd(void); -extern int getstring(char *prompt, char *buf, int nbuf, int eolchar); -extern void outstring(char *s); -extern void ostring(char *s); - -/* bind.c */ -extern int help(int f, int n); -extern int deskey(int f, int n); -extern int bindtokey(int f, int n); -extern int unbindkey(int f, int n); -extern int unbindchar(int c); -extern int desbind(int f, int n); -extern int apro(int f, int n); -extern int buildlist(int type, char *mstring); -extern int strinc(char *source, char *sub); -extern unsigned int getckey(int mflag); -extern startup(char *sfname); -extern char *flook(char *fname, int hflag); -extern void cmdstr(int c, char *seq); -extern fn_t getbind(int c); -extern char *getfname(fn_t); -extern fn_t fncmatch(char *); -extern unsigned int stock(char *keyname); -extern char *transbind(char *skey); - -/* buffer.c */ -extern int usebuffer(int f, int n); -extern int nextbuffer(int f, int n); -extern int swbuffer(BUFFER *bp); -extern int killbuffer(int f, int n); -extern int zotbuf(BUFFER *bp); -extern int namebuffer(int f, int n); -extern int listbuffers(int f, int n); -extern int makelist(int iflag); -extern void ltoa(char *buf, int width, long num); -extern int addline(char *text); -extern int anycb(void); -extern int bclear(BUFFER *bp); -extern int unmark(int f, int n); diff --git a/efunc.h b/efunc.h index edd3468..b408b77 100644 --- a/efunc.h +++ b/efunc.h @@ -12,420 +12,386 @@ /* External function declarations */ -extern int ctrlg(); /* Abort out of things */ -extern int quit(); /* Quit */ -extern int ctlxlp(); /* Begin macro */ -extern int ctlxrp(); /* End macro */ -extern int ctlxe(); /* Execute macro */ -extern int fileread(); /* Get a file, read only */ -extern int filefind(); /* Get a file, read write */ -extern int filewrite(); /* Write a file */ -extern int filesave(); /* Save current file */ -extern int filename(); /* Adjust file name */ -extern int getccol(); /* Get current column */ -extern int gotobol(); /* Move to start of line */ -extern int forwchar(); /* Move forward by characters */ -extern int gotoeol(); /* Move to end of line */ -extern int backchar(); /* Move backward by characters */ -extern int forwline(); /* Move forward by lines */ -extern int backline(); /* Move backward by lines */ -extern int forwpage(); /* Move forward by pages */ -extern int backpage(); /* Move backward by pages */ -extern int gotobob(); /* Move to start of buffer */ -extern int gotoeob(); /* Move to end of buffer */ -extern int setfillcol(); /* Set fill column. */ -extern int setmark(); /* Set mark */ -extern int swapmark(); /* Swap "." and mark */ -extern int forwsearch(); /* Search forward */ -extern int backsearch(); /* Search backwards */ -extern int sreplace(); /* search and replace */ -extern int qreplace(); /* search and replace w/query */ -extern int showcpos(); /* Show the cursor position */ -extern int nextwind(); /* Move to the next window */ -extern int prevwind(); /* Move to the previous window */ -extern int onlywind(); /* Make current window only one */ -extern int splitwind(); /* Split current window */ -extern int mvdnwind(); /* Move window down */ -extern int mvupwind(); /* Move window up */ -extern int enlargewind(); /* Enlarge display window. */ -extern int shrinkwind(); /* Shrink window. */ -extern int listbuffers(); /* Display list of buffers */ -extern int usebuffer(); /* Switch a window to a buffer */ -extern int killbuffer(); /* Make a buffer go away. */ -extern int reposition(); /* Reposition window */ -extern int refresh(); /* Refresh the screen */ -extern int twiddle(); /* Twiddle characters */ -extern int tab(); /* Insert tab */ -extern int newline(); /* Insert CR-LF */ -extern int indent(); /* Insert CR-LF, then indent */ -extern int openline(); /* Open up a blank line */ -extern int deblank(); /* Delete blank lines */ -extern int quote(); /* Insert literal */ -extern int backword(); /* Backup by words */ -extern int forwword(); /* Advance by words */ -extern int forwdel(); /* Forward delete */ -extern int backdel(); /* Backward delete */ -extern int killtext(); /* Kill forward */ -extern int yank(); /* Yank back from killbuffer. */ -extern int upperword(); /* Upper case word. */ -extern int lowerword(); /* Lower case word. */ -extern int upperregion(); /* Upper case region. */ -extern int lowerregion(); /* Lower case region. */ -extern int capword(); /* Initial capitalize word. */ -extern int delfword(); /* Delete forward word. */ -extern int delbword(); /* Delete backward word. */ -extern int killregion(); /* Kill region. */ -extern int copyregion(); /* Copy region to kill buffer. */ -extern int spawncli(); /* Run CLI in a subjob. */ -extern int spawn(); /* Run a command in a subjob. */ -#if BSD | __hpux | SVR4 -extern int bktoshell(); /* suspend emacs to parent shell */ -extern int rtfrmshell(); /* return from a suspended state */ -#endif -extern int quickexit(); /* low keystroke style exit. */ -extern int setmode(); /* set an editor mode */ -extern int delmode(); /* delete a mode */ -extern int gotoline(); /* go to a numbered line */ -extern int namebuffer(); /* rename the current buffer */ -#if WORDPRO -extern int gotobop(); /* go to beginning/paragraph */ -extern int gotoeop(); /* go to end/paragraph */ -extern int fillpara(); /* fill current paragraph */ -#if PKCODE -extern int justpara(); /* justify current paragraph */ -#endif -#endif -extern int help(); /* get the help file here */ -extern int deskey(); /* describe a key's binding */ -extern int viewfile(); /* find a file in view mode */ -extern int insfile(); /* insert a file */ -extern int scrnextup(); /* scroll next window back */ -extern int scrnextdw(); /* scroll next window down */ -extern int bindtokey(); /* bind a function to a key */ -extern int unbindkey(); /* unbind a key's function */ -extern int namedcmd(); /* execute named command */ -extern int desbind(); /* describe bindings */ -extern int execcmd(); /* execute a command line */ -extern int execbuf(); /* exec commands from a buffer */ -extern int execfile(); /* exec commands from a file */ -extern int nextbuffer(); /* switch to the next buffer */ -#if WORDPRO -extern int killpara(); /* kill the current paragraph */ -#endif -extern int setgmode(); /* set a global mode */ -extern int delgmode(); /* delete a global mode */ -extern int insspace(); /* insert a space forword */ -extern int forwhunt(); /* hunt forward for next match */ -extern int backhunt(); /* hunt backwards for next match */ -extern int pipecmd(); /* pipe command into buffer */ -extern int filter(); /* filter buffer through dos */ -extern int delwind(); /* delete the current window */ -extern int cbuf1(); /* execute numbered comd buffer */ -extern int cbuf2(); -extern int cbuf3(); -extern int cbuf4(); -extern int cbuf5(); -extern int cbuf6(); -extern int cbuf7(); -extern int cbuf8(); -extern int cbuf9(); -extern int cbuf10(); -extern int cbuf11(); -extern int cbuf12(); -extern int cbuf13(); -extern int cbuf14(); -extern int cbuf15(); -extern int cbuf16(); -extern int cbuf17(); -extern int cbuf18(); -extern int cbuf19(); -extern int cbuf20(); -extern int cbuf21(); -extern int cbuf22(); -extern int cbuf23(); -extern int cbuf24(); -extern int cbuf25(); -extern int cbuf26(); -extern int cbuf27(); -extern int cbuf28(); -extern int cbuf29(); -extern int cbuf30(); -extern int cbuf31(); -extern int cbuf32(); -extern int cbuf33(); -extern int cbuf34(); -extern int cbuf35(); -extern int cbuf36(); -extern int cbuf37(); -extern int cbuf38(); -extern int cbuf39(); -extern int cbuf40(); -extern int storemac(); /* store text for macro */ -extern int resize(); /* resize current window */ -extern int clrmes(); /* clear the message line */ -extern int meta(); /* meta prefix dummy function */ -extern int cex(); /* ^X prefix dummy function */ -extern int unarg(); /* ^U repeat arg dummy function */ -extern int istring(); /* insert string in text */ -extern int unmark(); /* unmark current buffer */ -#if ISRCH -extern int fisearch(); /* forward incremental search */ -extern int risearch(); /* reverse incremental search */ -#endif -#if WORDPRO -extern int wordcount(); /* count words in region */ -#endif -extern int savewnd(); /* save current window */ -extern int restwnd(); /* restore current window */ -extern int upscreen(); /* force screen update */ -extern int writemsg(); /* write text on message line */ -#if FNLABEL -extern int fnclabel(); /* set function key label */ -#endif -#if APROP -extern int apro(); /* apropos fuction */ -#endif -#if CRYPT -extern int setkey(); /* set encryption key */ -#endif -extern int wrapword(); /* wordwrap function */ -#if CFENCE -extern int getfence(); /* move cursor to a matching fence */ -#endif -extern int newsize(); /* change the current screen size */ -extern int setvar(); /* set a variables value */ -extern int newwidth(); /* change the current screen width */ -#if AEDIT -extern int trim(); /* trim whitespace from end of line */ -extern int detab(); /* detab rest of line */ -extern int entab(); /* entab rest of line */ -#endif -#if PROC -extern int storeproc(); /* store names procedure */ -extern int execproc(); /* execute procedure */ -#endif -extern int nullproc(); /* does nothing... */ -extern int ovstring(); /* overwrite a string */ -extern int execprg(); /* execute a program */ +/* word.c */ +extern int wrapword(int f, int n); +extern int backword(int f, int n); +extern int forwword(int f, int n); +extern int upperword(int f, int n); +extern int lowerword(int f, int n); +extern int capword(int f, int n); +extern int delfword(int f, int n); +extern int delbword(int f, int n); +extern int inword(void); +extern int fillpara(int f, int n); +extern int justpara(int f, int n); +extern int killpara(int f, int n); +extern int wordcount(int f, int n); -extern int cknewwindow(); +/* line.c */ +extern int lfree(LINE *lp); +extern int lchange(int flag); +extern int insspace(int f, int n); +extern int linstr(char *instr); +extern int linsert(int n, int c); +extern int lowrite(int c); +extern int lover(char *ostr); +extern int lnewline(void); +extern int ldelete(long n, int kflag); +extern char *getctext(void); +extern int putctext(char *iline); +extern int ldelnewline(void); +extern int kdelete(void); +extern int kinsert(int c); +extern int yank(int f, int n); -/* Name to function binding table +/* window.c */ +extern int reposition(int f, int n); +extern int refresh(int f, int n); +extern int nextwind(int f, int n); +extern int prevwind(int f, int n); +extern int mvdnwind(int f, int n); +extern int mvupwind(int f, int n); +extern int onlywind(int f, int n); +extern int delwind(int f, int n); +extern int splitwind(int f, int n); +extern int enlargewind(int f, int n); +extern int shrinkwind(int f, int n); +extern int resize(int f, int n); +extern int scrnextup(int f, int n); +extern int scrnextdw(int f, int n); +extern int savewnd(int f, int n); +extern int restwnd(int f, int n); +extern int newsize(int f, int n); +extern int newwidth(int f, int n); +extern int getwpos(void); +extern void cknewwindow(void); - This table gives the names of all the bindable functions - end their C function address. These are used for the bind-to-key - function. -*/ +/* basic.c */ +extern int gotobol(int f, int n); +extern int backchar(int f, int n); +extern int gotoeol(int f, int n); +extern int forwchar(int f, int n); +extern int gotoline(int f, int n); +extern int gotobob(int f, int n); +extern int gotoeob(int f, int n); +extern int forwline(int f, int n); +extern int backline(int f, int n); +extern int gotobop(int f, int n); +extern int gotoeop(int f, int n); +extern int getgoal(LINE *dlp); +extern int forwpage(int f, int n); +extern int backpage(int f, int n); +extern int setmark(int f, int n); +extern int swapmark(int f, int n); -NBIND names[] = { - {"abort-command", ctrlg}, - {"add-mode", setmode}, - {"add-global-mode", setgmode}, -#if APROP - {"apropos", apro}, -#endif - {"backward-character", backchar}, - {"begin-macro", ctlxlp}, - {"beginning-of-file", gotobob}, - {"beginning-of-line", gotobol}, - {"bind-to-key", bindtokey}, - {"buffer-position", showcpos}, - {"case-region-lower", lowerregion}, - {"case-region-upper", upperregion}, - {"case-word-capitalize", capword}, - {"case-word-lower", lowerword}, - {"case-word-upper", upperword}, - {"change-file-name", filename}, - {"change-screen-size", newsize}, - {"change-screen-width", newwidth}, - {"clear-and-redraw", refresh}, - {"clear-message-line", clrmes}, - {"copy-region", copyregion}, -#if WORDPRO - {"count-words", wordcount}, -#endif - {"ctlx-prefix", cex}, - {"delete-blank-lines", deblank}, - {"delete-buffer", killbuffer}, - {"delete-mode", delmode}, - {"delete-global-mode", delgmode}, - {"delete-next-character", forwdel}, - {"delete-next-word", delfword}, - {"delete-other-windows", onlywind}, - {"delete-previous-character", backdel}, - {"delete-previous-word", delbword}, - {"delete-window", delwind}, - {"describe-bindings", desbind}, - {"describe-key", deskey}, -#if AEDIT - {"detab-line", detab}, -#endif - {"end-macro", ctlxrp}, - {"end-of-file", gotoeob}, - {"end-of-line", gotoeol}, -#if AEDIT - {"entab-line", entab}, -#endif - {"exchange-point-and-mark", swapmark}, - {"execute-buffer", execbuf}, - {"execute-command-line", execcmd}, - {"execute-file", execfile}, - {"execute-macro", ctlxe}, - {"execute-macro-1", cbuf1}, - {"execute-macro-2", cbuf2}, - {"execute-macro-3", cbuf3}, - {"execute-macro-4", cbuf4}, - {"execute-macro-5", cbuf5}, - {"execute-macro-6", cbuf6}, - {"execute-macro-7", cbuf7}, - {"execute-macro-8", cbuf8}, - {"execute-macro-9", cbuf9}, - {"execute-macro-10", cbuf10}, - {"execute-macro-11", cbuf11}, - {"execute-macro-12", cbuf12}, - {"execute-macro-13", cbuf13}, - {"execute-macro-14", cbuf14}, - {"execute-macro-15", cbuf15}, - {"execute-macro-16", cbuf16}, - {"execute-macro-17", cbuf17}, - {"execute-macro-18", cbuf18}, - {"execute-macro-19", cbuf19}, - {"execute-macro-20", cbuf20}, - {"execute-macro-21", cbuf21}, - {"execute-macro-22", cbuf22}, - {"execute-macro-23", cbuf23}, - {"execute-macro-24", cbuf24}, - {"execute-macro-25", cbuf25}, - {"execute-macro-26", cbuf26}, - {"execute-macro-27", cbuf27}, - {"execute-macro-28", cbuf28}, - {"execute-macro-29", cbuf29}, - {"execute-macro-30", cbuf30}, - {"execute-macro-31", cbuf31}, - {"execute-macro-32", cbuf32}, - {"execute-macro-33", cbuf33}, - {"execute-macro-34", cbuf34}, - {"execute-macro-35", cbuf35}, - {"execute-macro-36", cbuf36}, - {"execute-macro-37", cbuf37}, - {"execute-macro-38", cbuf38}, - {"execute-macro-39", cbuf39}, - {"execute-macro-40", cbuf40}, - {"execute-named-command", namedcmd}, -#if PROC - {"execute-procedure", execproc}, -#endif - {"execute-program", execprg}, - {"exit-emacs", quit}, -#if WORDPRO - {"fill-paragraph", fillpara}, -#endif - {"filter-buffer", filter}, - {"find-file", filefind}, - {"forward-character", forwchar}, - {"goto-line", gotoline}, -#if CFENCE - {"goto-matching-fence", getfence}, -#endif - {"grow-window", enlargewind}, - {"handle-tab", tab}, - {"hunt-forward", forwhunt}, - {"hunt-backward", backhunt}, - {"help", help}, - {"i-shell", spawncli}, -#if ISRCH - {"incremental-search", fisearch}, -#endif - {"insert-file", insfile}, - {"insert-space", insspace}, - {"insert-string", istring}, -#if WORDPRO -#if PKCODE - {"justify-paragraph", justpara}, -#endif - {"kill-paragraph", killpara}, -#endif - {"kill-region", killregion}, - {"kill-to-end-of-line", killtext}, -#if FNLABEL - {"label-function-key", fnclabel}, -#endif - {"list-buffers", listbuffers}, - {"meta-prefix", meta}, - {"move-window-down", mvdnwind}, - {"move-window-up", mvupwind}, - {"name-buffer", namebuffer}, - {"newline", newline}, - {"newline-and-indent", indent}, - {"next-buffer", nextbuffer}, - {"next-line", forwline}, - {"next-page", forwpage}, -#if WORDPRO - {"next-paragraph", gotoeop}, -#endif - {"next-window", nextwind}, - {"next-word", forwword}, - {"nop", nullproc}, - {"open-line", openline}, - {"overwrite-string", ovstring}, - {"pipe-command", pipecmd}, - {"previous-line", backline}, - {"previous-page", backpage}, -#if WORDPRO - {"previous-paragraph", gotobop}, -#endif - {"previous-window", prevwind}, - {"previous-word", backword}, - {"query-replace-string", qreplace}, - {"quick-exit", quickexit}, - {"quote-character", quote}, - {"read-file", fileread}, - {"redraw-display", reposition}, - {"resize-window", resize}, - {"restore-window", restwnd}, - {"replace-string", sreplace}, -#if ISRCH - {"reverse-incremental-search", risearch}, -#endif -#if PROC - {"run", execproc}, -#endif - {"save-file", filesave}, - {"save-window", savewnd}, - {"scroll-next-up", scrnextup}, - {"scroll-next-down", scrnextdw}, - {"search-forward", forwsearch}, - {"search-reverse", backsearch}, - {"select-buffer", usebuffer}, - {"set", setvar}, -#if CRYPT - {"set-encryption-key", setkey}, -#endif - {"set-fill-column", setfillcol}, - {"set-mark", setmark}, - {"shell-command", spawn}, - {"shrink-window", shrinkwind}, - {"split-current-window", splitwind}, - {"store-macro", storemac}, -#if PROC - {"store-procedure", storeproc}, -#endif -#if BSD | __hpux | SVR4 - {"suspend-emacs", bktoshell}, -#endif - {"transpose-characters", twiddle}, -#if AEDIT - {"trim-line", trim}, -#endif - {"unbind-key", unbindkey}, - {"universal-argument", unarg}, - {"unmark-buffer", unmark}, - {"update-screen", upscreen}, - {"view-file", viewfile}, - {"wrap-word", wrapword}, - {"write-file", filewrite}, - {"write-message", writemsg}, - {"yank", yank}, +/* random.c */ +extern int tabsize; /* Tab size (0: use real tabs) */; +extern int setfillcol(int f, int n); +extern int showcpos(int f, int n); +extern int getcline(void); +extern int getccol(int bflg); +extern int setccol(int pos); +extern int twiddle(int f, int n); +extern int quote(int f, int n); +extern int tab(int f, int n); +extern int detab(int f, int n); +extern int entab(int f, int n); +extern int trim(int f, int n); +extern int openline(int f, int n); +extern int newline(int f, int n); +extern int cinsert(void); +extern int insbrace(int n, int c); +extern int inspound(void); +extern int deblank(int f, int n); +extern int indent(int f, int n); +extern int forwdel(int f, int n); +extern int backdel(int f, int n); +extern int killtext(int f, int n); +extern int setmode(int f, int n); +extern int delmode(int f, int n); +extern int setgmode(int f, int n); +extern int delgmode(int f, int n); +extern int adjustmode(int kind, int global); +extern int clrmes(int f, int n); +extern int writemsg(int f, int n); +extern int getfence(int f, int n); +extern int fmatch(int ch); +extern int istring(int f, int n); +extern int ovstring(int f, int n); - {"", NULL} -}; +/* main.c */ +extern int edinit(char *bname); +extern int execute(int c, int f, int n); +extern int quickexit(int f, int n); +extern int quit(int f, int n); +extern int ctlxlp(int f, int n); +extern int ctlxrp(int f, int n); +extern int ctlxe(int f, int n); +extern int ctrlg(int f, int n); +extern int rdonly(void); +extern int resterr(void); +extern int nullproc(int f, int n); +extern int meta(int f, int n); +extern int cex(int f, int n); +extern int unarg(int f, int n); +extern int cexit(int status); + +/* display.c */ +extern void vtinit(void); +extern void vtfree(void); +extern void vttidy(void); +extern void vtmove(int row, int col); +extern void vtputc(int c); +extern void vteeol(void); +extern int upscreen(int f, int n); +extern int update(int force); +extern int reframe(WINDOW *wp); +extern void updone(WINDOW *wp); +extern void updall(WINDOW *wp); +extern void updpos(void); +extern void upddex(void); +extern void updgar(void); +extern int updupd(int force); +extern int scrolls(int inserts); +extern void scrscroll(int from, int to, int count); +extern int texttest(int vrow, int prow); +extern int endofline(char *s, int n); +extern void updext(void); +extern int updateline(int row, struct VIDEO *vp1, struct VIDEO *vp2); +extern void modeline(WINDOW *wp); +extern void upmode(void); +extern void movecursor(int row, int col); +extern void mlerase(void); +extern void mlwrite(const char *fmt, ...); +extern void mlforce(char *s); +extern void mlputs(char *s); +extern void mlputi(int i, int r); +extern void mlputli(long l, int r); +extern void mlputf(int s); +extern void putline(int row, int col, char *buf); +extern void getscreensize(int *widthp, int *heightp); +extern void sizesignal(int signr); +extern int newscreensize(int h, int w); + +/* region.c */ +extern int killregion(int f, int n); +extern int copyregion(int f, int n); +extern int lowerregion(int f, int n); +extern int upperregion(int f, int n); +extern int getregion(REGION *rp); + +/* posix.c */ +extern void ttopen(void); +extern void ttclose(void); +extern int ttputc(int c); +extern void ttflush(void); +extern int ttgetc(void); +extern int typahead(void); + +/* input.c */ +extern int mlyesno(char *prompt); +extern int mlreply(char *prompt, char *buf, int nbuf); +extern int mlreplyt(char *prompt, char *buf, int nbuf, int eolchar); +extern int ectoc(int c); +extern int ctoec(int c); +extern fn_t getname(void); +extern int tgetc(void); +extern int get1key(void); +extern int getcmd(void); +extern int getstring(char *prompt, char *buf, int nbuf, int eolchar); +extern void outstring(char *s); +extern void ostring(char *s); + +/* bind.c */ +extern int help(int f, int n); +extern int deskey(int f, int n); +extern int bindtokey(int f, int n); +extern int unbindkey(int f, int n); +extern int unbindchar(int c); +extern int desbind(int f, int n); +extern int apro(int f, int n); +extern int buildlist(int type, char *mstring); +extern int strinc(char *source, char *sub); +extern unsigned int getckey(int mflag); +extern int startup(char *sfname); +extern char *flook(char *fname, int hflag); +extern void cmdstr(int c, char *seq); +extern fn_t getbind(int c); +extern char *getfname(fn_t); +extern fn_t fncmatch(char *); +extern unsigned int stock(char *keyname); +extern char *transbind(char *skey); + +/* buffer.c */ +extern int usebuffer(int f, int n); +extern int nextbuffer(int f, int n); +extern int swbuffer(BUFFER *bp); +extern int killbuffer(int f, int n); +extern int zotbuf(BUFFER *bp); +extern int namebuffer(int f, int n); +extern int listbuffers(int f, int n); +extern int makelist(int iflag); +extern void ltoa(char *buf, int width, long num); +extern int addline(char *text); +extern int anycb(void); +extern int bclear(BUFFER *bp); +extern int unmark(int f, int n); + +/* file.c */ +extern int fileread(int f, int n); +extern int insfile(int f, int n); +extern int filefind(int f, int n); +extern int viewfile(int f, int n); +extern int resetkey(void); +extern int getfile(char *fname, int lockfl); +extern int readin(char *fname, int lockfl); +extern void makename(char *bname, char *fname); +extern void unqname(char *name); +extern int filewrite(int f, int n); +extern int filesave(int f, int n); +extern int writeout(char *fn); +extern int filename(int f, int n); +extern int ifile(char *fname); + +/* fileio.c */ +extern int ffropen(char *fn); +extern int ffwopen(char *fn); +extern int ffclose(void); +extern int ffputline(char *buf, int nbuf); +extern int ffgetline(void); +extern int fexist(char *fname); + +/* exec.c */ +extern int namedcmd(int f, int n); +extern int execcmd(int f, int n); +extern int docmd(char *cline); +extern char *token(char *src, char *tok, int size); +extern int macarg(char *tok); +extern int nextarg(char *prompt, char *buffer, int size, int terminator); +extern int storemac(int f, int n); +extern int storeproc(int f, int n); +extern int execproc(int f, int n); +extern int execbuf(int f, int n); +extern int dobuf(BUFFER *bp); +extern int freewhile(WHBLOCK *wp); +extern int execfile(int f, int n); +extern int dofile(char *fname); +extern int cbuf(int f, int n, int bufnum); +extern int cbuf1(int f, int n); +extern int cbuf2(int f, int n); +extern int cbuf3(int f, int n); +extern int cbuf4(int f, int n); +extern int cbuf5(int f, int n); +extern int cbuf6(int f, int n); +extern int cbuf7(int f, int n); +extern int cbuf8(int f, int n); +extern int cbuf9(int f, int n); +extern int cbuf10(int f, int n); +extern int cbuf11(int f, int n); +extern int cbuf12(int f, int n); +extern int cbuf13(int f, int n); +extern int cbuf14(int f, int n); +extern int cbuf15(int f, int n); +extern int cbuf16(int f, int n); +extern int cbuf17(int f, int n); +extern int cbuf18(int f, int n); +extern int cbuf19(int f, int n); +extern int cbuf20(int f, int n); +extern int cbuf21(int f, int n); +extern int cbuf22(int f, int n); +extern int cbuf23(int f, int n); +extern int cbuf24(int f, int n); +extern int cbuf25(int f, int n); +extern int cbuf26(int f, int n); +extern int cbuf27(int f, int n); +extern int cbuf28(int f, int n); +extern int cbuf29(int f, int n); +extern int cbuf30(int f, int n); +extern int cbuf31(int f, int n); +extern int cbuf32(int f, int n); +extern int cbuf33(int f, int n); +extern int cbuf34(int f, int n); +extern int cbuf35(int f, int n); +extern int cbuf36(int f, int n); +extern int cbuf37(int f, int n); +extern int cbuf38(int f, int n); +extern int cbuf39(int f, int n); +extern int cbuf40(int f, int n); + +/* spawn.c */ +extern int spawncli(int f, int n); +extern void bktoshell(void); +extern void rtfrmshell(void); +extern int spawn(int f, int n); +extern int execprg(int f, int n); +extern int pipecmd(int f, int n); +extern int filter(int f, int n); +extern int sys(char *cmd); +extern int shellprog(char *cmd); +extern int execprog(char *cmd); + +/* search.c */ +extern int forwsearch(int f, int n); +extern int forwhunt(int f, int n); +extern int backsearch(int f, int n); +extern int backhunt(int f, int n); +extern int mcscanner(MC *mcpatrn, int direct, int beg_or_end); +extern int scanner(unsigned char *patrn, int direct, int beg_or_end); +extern int eq(unsigned char bc, unsigned char pc); +extern void savematch(void); +extern void rvstrcpy(char *rvstr, char *str); +extern int sreplace(int f, int n); +extern int qreplace(int f, int n); +extern int delins(int dlength, char *instr, int use_meta); +extern int expandp(char *srcstr, char *deststr, int maxlength); +extern int boundry(LINE *curline, int curoff, int dir); +extern void mcclear(void); +extern void rmcclear(void); + +/* isearch.c */ +extern int risearch(int f, int n); +extern int fisearch(int f, int n); +extern int isearch(int f, int n); +extern int checknext(char chr, char *patrn, int dir); +extern int scanmore(char *patrn, int dir); +extern int match_pat(char *patrn); +extern int promptpattern(char *prompt); +extern int echochar(int c, int col); +extern int get_char(void); +extern int uneat(void); +extern int reeat(int c); + +/* eval.c */ +extern void varinit(void); +extern char *gtfun(char *fname); +extern char *gtusr(char *vname); +extern char *gtenv(char *vname); +extern char *getkill(void); +extern int setvar(int f, int n); +extern void findvar(char *var, VDESC *vd, int size); +extern int svar(VDESC *var, char *value); +extern char *itoa(int i); +extern int gettyp(char *token); +extern char *getval(char *token); +extern int stol(char *val); +extern char *ltos(int val); +extern char *mkupper(char *str); +extern char *mklower(char *str); +extern int abs(int x); +extern int ernd(void); +extern int sindex(char *source, char *pattern); +extern char *xlat(char *source, char *lookup, char *trans); + +/* crypt.c */ +extern int setkey(int f, int n); +extern void crypt(char *bptr, unsigned len); + +/* lock.c */ +extern int lockchk(char *fname); +extern int lockrel(void); +extern int lock(char *fname); +extern int unlock(char *fname); +extern void lckerror(char *errstr); + +/* names.c */ +extern NBIND names[]; diff --git a/estruct.h b/estruct.h index 199725e..9863ad3 100644 --- a/estruct.h +++ b/estruct.h @@ -608,7 +608,7 @@ typedef struct { typedef struct { char *n_name; /* name of function key */ - int (*n_func) (); /* function name is bound to */ + int (*n_func)(int, int);/* function name is bound to */ } NBIND; /* The editor holds deleted text chunks in the KILL buffer. The diff --git a/eval.c b/eval.c index 5a22643..d702f98 100644 --- a/eval.c +++ b/eval.c @@ -9,9 +9,10 @@ #include #include "estruct.h" #include "edef.h" +#include "efunc.h" #include "evar.h" -varinit() +void varinit(void) { /* initialize the user variable list */ register int i; @@ -19,10 +20,12 @@ varinit() uv[i].u_name[0] = 0; } -char *gtfun(fname) - /* evaluate a function */ -char *fname; /* name of function to evaluate */ - +/* + * evaluate a function + * + * char *fname; name of function to evaluate + */ +char *gtfun(char *fname) { register int fnum; /* index to function to eval */ register int status; /* return status */ @@ -164,10 +167,12 @@ char *fname; /* name of function to evaluate */ exit(-11); /* never should get here */ } -char *gtusr(vname) - /* look up a user var's value */ -char *vname; /* name of user variable to fetch */ - +/* + * look up a user var's value + * + * char *vname; name of user variable to fetch + */ +char *gtusr(char *vname) { register int vnum; /* ordinal number of user var */ @@ -184,10 +189,13 @@ char *vname; /* name of user variable to fetch */ return (errorm); } -char *gtenv(vname) - -char *vname; /* name of environment variable to retrieve */ +/* + * gtenv() + * + * char *vname; name of environment variable to retrieve + */ +char *gtenv(char *vname) { register int vnum; /* ordinal number of var refrenced */ char *getkill(); @@ -313,8 +321,11 @@ char *vname; /* name of environment variable to retrieve */ exit(-12); /* again, we should never get here */ } -char *getkill() -{ /* return some of the contents of the kill buffer */ +/* + * return some of the contents of the kill buffer + */ +char *getkill(void) +{ register int size; /* max number of chars to return */ static char value[NSTRING]; /* temp buffer for value */ @@ -334,11 +345,13 @@ char *getkill() return (value); } -int setvar(f, n) - /* set a variable */ -int f; /* default flag */ -int n; /* numeric arg (can overide prompted value) */ - +/* + * set a variable + * + * int f; default flag + * int n; numeric arg (can overide prompted value) + */ +int setvar(int f, int n) { register int status; /* status return */ #if DEBUGM @@ -432,12 +445,14 @@ int n; /* numeric arg (can overide prompted value) */ return (status); } -findvar(var, vd, size) - /* find a variables type and name */ -char *var; /* name of var to get */ -VDESC *vd; /* structure to hold type and ptr */ -int size; /* size of var array */ - +/* + * find a variables type and name + * + * char *var; name of var to get + * VDESC *vd; structure to hold type and ptr + * int size; size of var array + */ +void findvar(char *var, VDESC *vd, int size) { register int vnum; /* subscript in varable arrays */ register int vtype; /* type to return */ @@ -487,11 +502,13 @@ int size; /* size of var array */ return; } -int svar(var, value) - /* set a variable */ -VDESC *var; /* variable to set */ -char *value; /* value to set to */ - +/* + * set a variable + * + * VDESC *var; variable to set + * char *value; value to set to + */ +int svar(VDESC *var, char *value) { register int vnum; /* ordinal number of var refrenced */ register int vtype; /* type of variable to set */ @@ -660,13 +677,14 @@ char *value; /* value to set to */ return (status); } -/* itoa: integer to ascii string.......... This is too - inconsistant to use the system's */ - -char *itoa(i) - -int i; /* integer to translate to a string */ - +/* + * itoa: + * integer to ascii string.......... This is too + * inconsistant to use the system's + * + * int i; integer to translate to a string + */ +char *itoa(int i) { register int digit; /* current digit being used */ register char *sp; /* pointer into result */ @@ -697,10 +715,12 @@ int i; /* integer to translate to a string */ return (sp); } -int gettyp(token) - /* find the type of a passed token */ -char *token; /* token to analyze */ - +/* + * find the type of a passed token + * + * char *token; token to analyze + */ +int gettyp(char *token) { register char c; /* first char in token */ @@ -739,10 +759,12 @@ char *token; /* token to analyze */ } } -char *getval(token) - /* find the value of a token */ -char *token; /* token to evaluate */ - +/* + * find the value of a token + * + * char *token; token to evaluate + */ +char *getval(char *token) { register int status; /* error return */ register BUFFER *bp; /* temp buffer pointer */ @@ -823,10 +845,12 @@ char *token; /* token to evaluate */ } } -int stol(val) - /* convert a string to a numeric logical */ -char *val; /* value to check for stol */ - +/* + * convert a string to a numeric logical + * + * char *val; value to check for stol + */ +int stol(char *val) { /* check for logical values */ if (val[0] == 'F') @@ -838,10 +862,12 @@ char *val; /* value to check for stol */ return ((atoi(val) != 0)); } -char *ltos(val) - /* numeric logical to string logical */ -int val; /* value to translate */ - +/* + * numeric logical to string logical + * + * int val; value to translate + */ +char *ltos(int val) { if (val) return (truem); @@ -849,10 +875,12 @@ int val; /* value to translate */ return (falsem); } -char *mkupper(str) - /* make a string upper case */ -char *str; /* string to upper case */ - +/* + * make a string upper case + * + * char *str; string to upper case + */ +char *mkupper(char *str) { char *sp; @@ -865,10 +893,12 @@ char *str; /* string to upper case */ return (str); } -char *mklower(str) - /* make a string lower case */ -char *str; /* string to lower case */ - +/* + * make a string lower case + * + * char *str; string to lower case + */ +char *mklower(char *str) { char *sp; @@ -881,25 +911,30 @@ char *str; /* string to lower case */ return (str); } -int abs(x) - /* take the absolute value of an integer */ -int x; - +/* + * take the absolute value of an integer + */ +int abs(int x) { return (x < 0 ? -x : x); } -int ernd() -{ /* returns a random integer */ +/* + * returns a random integer + */ +int ernd(void) +{ seed = abs(seed * 1721 + 10007); return (seed); } -int sindex(source, pattern) - /* find pattern within source */ -char *source; /* source string to search */ -char *pattern; /* string to look for */ - +/* + * find pattern within source + * + * char *source; source string to search + * char *pattern; string to look for + */ +int sindex(char *source, char *pattern) { char *sp; /* ptr to current position to scan */ char *csp; /* ptr to source string during comparison */ @@ -928,14 +963,14 @@ char *pattern; /* string to look for */ return (0); } -/* Filter a string through a translation table */ - -char *xlat(source, lookup, trans) - -char *source; /* string to filter */ -char *lookup; /* characters to translate */ -char *trans; /* resulting translated characters */ - +/* + * Filter a string through a translation table + * + * char *source; string to filter + * char *lookup; characters to translate + * char *trans; resulting translated characters + */ +char *xlat(char *source, char *lookup, char *trans) { register char *sp; /* pointer into source table */ register char *lp; /* pointer into lookup table */ diff --git a/exec.c b/exec.c index 9e13f22..17a26c2 100644 --- a/exec.c +++ b/exec.c @@ -10,13 +10,15 @@ #include #include "estruct.h" #include "edef.h" +#include "efunc.h" -/* namedcmd: execute a named command even if it is not bound */ - -namedcmd(f, n) - -int f, n; /* command arguments [passed through to command executed] */ - +/* + * namedcmd: + * execute a named command even if it is not bound + * + * int f, n; command arguments [passed through to command executed] + */ +int namedcmd(int f, int n) { register int (*kfunc) (); /* ptr to the requexted function to bind to */ int (*getname()) (); @@ -35,13 +37,14 @@ int f, n; /* command arguments [passed through to command executed] */ return ((*kfunc) (f, n)); } -/* execcmd: Execute a command line command to be typed in - by the user */ - -execcmd(f, n) - -int f, n; /* default Flag and Numeric argument */ - +/* + * execcmd: + * Execute a command line command to be typed in + * by the user + * + * int f, n; default Flag and Numeric argument + */ +int execcmd(int f, int n) { register int status; /* status return */ char cmdstr[NSTRING]; /* string holding command to execute */ @@ -54,21 +57,20 @@ int f, n; /* default Flag and Numeric argument */ return (docmd(cmdstr)); } -/* docmd: take a passed string as a command line and translate - it to be executed as a command. This function will be - used by execute-command-line and by all source and - startup files. Lastflag/thisflag is also updated. - - format of the command line is: - - {# arg} {} - -*/ - -docmd(cline) - -char *cline; /* command line to execute */ - +/* + * docmd: + * take a passed string as a command line and translate + * it to be executed as a command. This function will be + * used by execute-command-line and by all source and + * startup files. Lastflag/thisflag is also updated. + * + * format of the command line is: + * + * {# arg} {} + * + * char *cline; command line to execute + */ +int docmd(char *cline) { register int f; /* default argument flag */ register int n; /* numeric repeat value */ @@ -127,15 +129,15 @@ char *cline; /* command line to execute */ return (status); } -/* token: chop a token off a string - return a pointer past the token -*/ - -char *token(src, tok, size) - -char *src, *tok; /* source string, destination token string */ -int size; /* maximum size of token */ - +/* + * token: + * chop a token off a string + * return a pointer past the token + * + * char *src, *tok; source string, destination token string + * int size; maximum size of token + */ +char *token(char *src, char *tok, int size) { register int quotef; /* is the current string quoted? */ register char c; /* temporary character */ @@ -202,10 +204,12 @@ int size; /* maximum size of token */ return (src); } -macarg(tok) - /* get a macro line argument */ -char *tok; /* buffer to place argument */ - +/* + * get a macro line argument + * + * char *tok; buffer to place argument + */ +int macarg(char *tok) { int savcle; /* buffer to store original clexec */ int status; @@ -217,15 +221,16 @@ char *tok; /* buffer to place argument */ return (status); } -/* nextarg: get the next argument */ - -nextarg(prompt, buffer, size, terminator) - -char *prompt; /* prompt to use if we must be interactive */ -char *buffer; /* buffer to put token into */ -int size; /* size of the buffer */ -int terminator; /* terminating char to be used on interactive fetch */ - +/* + * nextarg: + * get the next argument + * + * char *prompt; prompt to use if we must be interactive + * char *buffer; buffer to put token into + * int size; size of the buffer + * int terminator; terminating char to be used on interactive fetch + */ +int nextarg(char *prompt, char *buffer, int size, int terminator) { /* if we are interactive, go get it! */ if (clexec == FALSE) @@ -239,14 +244,15 @@ int terminator; /* terminating char to be used on interactive fetch */ return (TRUE); } -/* storemac: Set up a macro buffer and flag to store all - executed command lines there */ - -storemac(f, n) - -int f; /* default flag */ -int n; /* macro number to use */ - +/* + * storemac: + * Set up a macro buffer and flag to store all + * executed command lines there + * + * int f; default flag + * int n; macro number to use + */ +int storemac(int f, int n) { register struct BUFFER *bp; /* pointer to macro buffer */ char bname[NBUFN]; /* name of buffer to use */ @@ -284,14 +290,15 @@ int n; /* macro number to use */ } #if PROC -/* storeproc: Set up a procedure buffer and flag to store all - executed command lines there */ - -storeproc(f, n) - -int f; /* default flag */ -int n; /* macro number to use */ - +/* + * storeproc: + * Set up a procedure buffer and flag to store all + * executed command lines there + * + * int f; default flag + * int n; macro number to use + */ +int storeproc(int f, int n) { register struct BUFFER *bp; /* pointer to macro buffer */ register int status; /* return status */ @@ -325,12 +332,13 @@ int n; /* macro number to use */ return (TRUE); } -/* execproc: Execute a procedure */ - -execproc(f, n) - -int f, n; /* default flag and numeric arg */ - +/* + * execproc: + * Execute a procedure + * + * int f, n; default flag and numeric arg + */ +int execproc(int f, int n) { register BUFFER *bp; /* ptr to buffer to execute */ register int status; /* status return */ @@ -359,12 +367,13 @@ int f, n; /* default flag and numeric arg */ } #endif -/* execbuf: Execute the contents of a buffer of commands */ - -execbuf(f, n) - -int f, n; /* default flag and numeric arg */ - +/* + * execbuf: + * Execute the contents of a buffer of commands + * + * int f, n; default flag and numeric arg + */ +int execbuf(int f, int n) { register BUFFER *bp; /* ptr to buffer to execute */ register int status; /* status return */ @@ -387,30 +396,30 @@ int f, n; /* default flag and numeric arg */ return (TRUE); } -/* dobuf: execute the contents of the buffer pointed to - by the passed BP - - Directives start with a "!" and include: - - !endm End a macro - !if (cond) conditional execution - !else - !endif - !return Return (terminating current macro) - !goto