/* Text input routine by Russell Wallace 1987. Feel free to copy it and use it * in your own programs. Requires linkage to my set of console routines, * console.o. Backspace and cursor keys can be used. DEL key puts * linefeed character in string, RETURN key ends input. Selection of menu * item or closewindow gadget will break off input and return -ve number, * otherwise length of typed-in string returned. */ long checkinput (); long input (string,length) unsigned char *string; /* Address of buffer to put text */ long length; /* Length of buffer */ { short c; /* Key pressed */ short x; /* Position in buffer */ long actlen=0; /* Actual length of typed-in string */ register short i; resetscroll (); x=0; for (;;) { do c=checkinput (); while (!c); if (actlen7) /* Up=back 8 spaces */ { x-=8; for (i=0;i<8;i++) { writechar ((long)155); writechar ((long)68); } } if (c==66 && x31 && c<128 && actlenx;i--) string[i]=string[i-1]; string[++actlen]='\0'; string[x++]=c; nprint ((long)(string+x-1)); for (i=x;i