#include "sysdef.h" #define then #define CTRLZ 032 #define CR 015 #define ESC 033 #define LF 012 #define RUB 0177 static CHAR rubout[] = "\010\040\010" ; readmacro() { extern int macsize[],maccurrent ; extern CHAR *mapmacro() ; ceol24() ; macsize[maccurrent] = lgetbin(mapmacro(maccurrent),"Macro text ? ") ; goback() ; return( macsize[maccurrent] ) ; } lgetdef(s,p,d) CHAR *s,*p ; register CHAR *d ; { register int len ; register CHAR *cp ; if ( (len = lgetbin(s,p)) != 0 ) then return(len) ; else { cp = s ; for (len=0; *d != '\0';len++) *cp++ = *d++ ; putbin("\015",1) ; lkill() ; if ( len ) then putbin(s,len) ; return(len) ; } } lgetbin(s,p) CHAR *p ; register CHAR *s; { register CHAR ch ; register int i,j ; CHAR *save ; i = 0 ; save = s ; putbin("\015",1) ; putbin(p,0) ; while ( i < 63 ) { if ( (ch = getc()) == CTRLZ || ch == CR ) then break ; if ( ch == RUB ) then { if (i > 0) then { s-- ; i-- ; if ( *s < CTRLZ ) then putbin(rubout,0) ; putbin(rubout,0) ; } } else { *s++ = ch ; echoch(ch) ; i++ ; } } *s = '\0' ; return(i) ; } static getc() { register CHAR ch ; while ( ( ch = getbin() ) == LF ) ; return(ch) ; } static echoch( ch ) register CHAR ch ; { CHAR tempch ; tempch = ch ; if ( ch == ESC ) then putbin("$",1) ; else if ( ch > CTRLZ ) then putbin(&tempch,1) ; else { putbin("^",1) ; tempch = ch | 0100 ; putbin(&tempch,1) ; } ; }