Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site unmvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!cmcl2!lanl!unm-la!unmvax!wampler From: wampler@unmvax.UUCP Newsgroups: net.sources Subject: TVX: PD Editor (4 of 7) Message-ID: <959@unmvax.UUCP> Date: Mon, 13-Jan-86 16:41:32 EST Article-I.D.: unmvax.959 Posted: Mon Jan 13 16:41:32 1986 Date-Received: Wed, 15-Jan-86 01:33:56 EST Distribution: net Organization: Univ. of New Mexico, Albuquerque Lines: 911 #--------CUT---------CUT---------CUT---------CUT--------# ######################################################### # # # This is a shell archive file. To extract files: # # # # 1) Make a directory (like tvx) for the files. # # 2) Write a file, such as "filen.shar", containing # # this archive file into the directory. # # 3) Type "sh file.shar". Do not use csh. # # # ######################################################### # # echo Extracting tvx_lex.c: sed 's/^X//' >tvx_lex.c <<\SHAR_EOF X/* -------------------------- tvx_lex.c ----------------------------------- */ X#include "tvx_defs.ic" X X/* -------------------------- GLOBALS GO HERE -------------------------------*/ X#define EXTERN X X#include "tvx_glbl.ic" X X char clower(),cupper(); X X/* =============================>>> CHECKOS <<<============================= */ X checkos() X { X /* check if ok operating system */ X#ifdef MSDOS X if ((bdos(0x30,0) & 0xff) < 2) /* !!! cii-86 dependent */ X { X remark("TVX requires MS-DOS 2.0 or later"); X exit(); X } X#endif X } X X/* =============================>>> STARTM <<<============================= */ X startm() X { X prompt("TVX - Full Screen Editor "); X prompt(VERSION); prompt("Terminal: "); X remark(cversn); X remark(""); X remark("? for help"); X remark(""); X } X X/* =============================>>> MEMORY <<<============================= */ X memory() X { /* memory - print memory left */ X X SLOW int nxt,chrsavail; X SLOW unsigned int tmp; X X char value[10],msg[85],*cp,stemp[80]; X X nxt = 0; /* where message goes */ X X stcopy(" Chrs left:",0,stemp,&nxt); /* add ' Chars: ' */ X X#ifdef LASL X tmp = max(nxtsav - nxtchr - BUFFLIMIT,0); X#else X tmp = nxtsav - nxtchr; X#endif X X#ifdef INT16 X if (tmp > 30000) /* handle "neg" size */ X { X stemp[nxt++] = '+'; X tmp -= 30000; X } X#endif X X itoa(tmp,value); X stcopy(value,0,stemp,&nxt); /* the value */ X X stcopy(" Last line:",0,stemp,&nxt); /* add ' Lines: ' */ X itoa(nxtlin-1,value); X stcopy(value,0,stemp,&nxt); /* add the count */ X X#ifdef STATCURLINE X stcopy(" Cur line:",0,stemp,&nxt); /* add ' Cur line: ' */ X itoa(curlin,value); X#endif X#ifdef STATREPEAT X stcopy(" Rpt:",0,stemp,&nxt); /* add ' Rpt: ' */ X itoa(rptuse+1,value); X stcopy(value,0,stemp,&nxt); /* the count */ X X stcopy("/",0,stemp,&nxt); /* add '/' */ X itoa(REPEATBUFS,value); X#endif X stcopy(value,0,stemp,&nxt); X chrsavail=80-strlen(stemp); X nxt=0; /* where message goes */ X cp = (*dest_file ? dest_file : orig_file); X stcopy(cp,max(strlen(cp)-chrsavail,0),msg,&nxt); /* the file name */ X if (strlen(VERSION) <= chrsavail-nxt) X { X stcopy(VERSION,0,msg,&nxt); /* TVX */ X if (strlen(cversn) <= chrsavail-nxt) X stcopy(cversn,0,msg,&nxt); /* terminal type */ X } X stcopy(stemp,0,msg,&nxt); /* rest of string */ X X tverr(msg); /* display line on screen */ X } X X/* =============================>>> SHOSET <<<============================= */ X shoset() X { /* show repeat buffer, help if available */ X X#ifdef HELP X static char rp[2]; X FAST int i; X SLOW char *cp, *msg; X SLOW int fields, oldtty, hnum; X SLOW unsigned tmp; X X#ifdef FULLHELP X struct help_msg X { X char *hmsg; X char Vmsg; X }; X X static struct help_msg cmddes[] = /* messages for help */ X { X {"nApnd to sv buff", VSAPPEND}, X {" Buffer beg ", VTOP}, X {" File beg", VFBEGIN}, X {"nChange chars ", VCHANGE}, X {"nDown line ", VDOWNLINE}, X {"nDown column", VDOWNCOL}, X {" Buffer end ", VBOTTOM}, X {"nEdit rpt buffer", VEDITRPT}, X {"nFind", VSEARCH}, X {" Find cross-buff", VNEXT}, X {" Get save buffer", VGET}, X {" Unkill lastline", VUNKILL}, X {"nHalf page ", VHALFP}, X {"nInsert (to ESC)", VINSERT}, X {" Jump back", VJUMP}, X {"nKill character ", VDELNEXT}, X {"nKill line ", VKILLALL}, X {"nLeft", VLEFT}, X {" Memory status ", VMEMORY}, X {"nNote location ", VNOTELOC}, X {"nReset loc", VRETNOTE}, X {"nOpen line ", VOPENLINE}, X {" Call Opr system", VSYSTEM}, X {"nPage", VFLIP}, X {" Print screen ", VPRINTS}, X {"nRight ", VRIGHT}, X {" Restore rpt buf", VSTORERPT}, X {"nSave lines ", VSAVE}, X {"nTidy, fill text", VTIDY}, X {" Abort", VABORT}, X {"nUp ", VUPLINE}, X {"nUp column ", VUPCOL}, X {" Verify screen", VVERIFY}, X {"nWrite buffer ", VWPAGE}, X {" Exit, end edit ", VQUIT}, X {"nYank file", VYANK}, X {"nDel prev char ", VDELLAST}, X {"nFind again ", VSAGAIN}, X {" Del last", VREMOVE}, X {" Change last ", VRMVINS}, X {" Del to line beg", VKILLPREV}, X {" Del to line end", VKILLREST}, X {" Line begining ", VBEGLINE}, X {" Line end ", VENDLINE}, X {"nWord right", VMVWORD}, X {"nWord left ", VMVBWORD}, X {"nRepeat again ", VXREPEAT}, X {"nk Exec rpt k n times", VEXECRPT}, X {"n p Set param p ", VSETPARS}, X {" Help ", VHELP}, X {" Insert find pat", VINSPAT}, X {"/",0} /* last variable entry */ X }; X#endif X X oldtty = ttymode; X ttymode = FALSE; X if (!oldtty) X tvclr(); X X prompt("Parameter : cur val (1=y, 0=n) Prev 16 cmds:"); X for (hnum = 0,i = old_cindex ; hnum < 16 ; ++hnum) X { X shocout(old_cmds[i]); X i = ++i % 16; X } X X remark(""); X prompt("A-Autoindent: "); wtint(autoin); X prompt(" T-TTY mode: "); wtint(ttymode); X prompt(" E-Expand tabs: "); wtint(tabspc); remark(""); X X prompt("F-Find: ignore case: "); X if (xcases) X tvcout('0'); X else X tvcout('1'); X X prompt(" M-Match wild cards: "); wtint(use_wild); remark(""); X prompt("U-User wild card set: "); remark(user_set); X X prompt("D disp line:"); wtint(dsplin); X prompt(" S-Scroll window:"); wtint(scroll); X prompt(" V-Virtual window:"); wtint(tvlins); X prompt("/"); wtint(tvhardlines); X prompt(" W-Wrap width:"); wtint(wraplm); remark(""); X prompt("O-Output file: "); prompt(dest_file); X prompt(" (input file is: ");prompt(orig_file); remark(")"); X remark(""); X X prompt("Find: |"); X for (cp = sbuff ; *cp ; ++cp) X { X shocout(*cp); X } X remark("|"); X remark(""); X prompt("Max chars: "); X tmp = mxbuff; X#ifdef INT16 X if (tmp > 30000) /* handle "neg" size */ X { X prompt("30000+"); X tmp -= 30000; X } X#endif X wtint(tmp); prompt(" Max lines: "); wtint(mxline); X prompt(" Cur line: "); wtint(curlin); X if (usecz) X prompt(" ^Z for EOF"); X remark(""); X remark(""); X X prompt("R-Repeat buffer: ");wtint(rptuse+1); X remark(" All repeat buffers : :"); X for (i = 0 ; i < REPEATBUFS ; ++ i) X { X fields = 5; X shocout('#') ; shocout(i+'1') ; prompt(": <"); X for (cp = &rptbuf[i][0] ; *cp ; ++cp) X { X shocout(*cp); X ++fields; /* how many letters */ X if (*cp < ' ') X ++fields; X if (fields >= (tvcols - 6)) X { X prompt("+more+"); X break; X } X } X remark(""); X } X X ttymode = oldtty; X memory(); X X#ifdef FULLHELP X tvxy(1,22); X X ask("Press space to exit, anything else for command list ",rp,1); X X if (*rp == ' ') X { X ttymode = oldtty; X verify(1); X return; X } X X if (!oldtty) X tvclr(); X X remark("Commands (n => count allowed):"); X for (hnum = fields = 0 ; ; ++hnum ) X { X prompt(" "); X cp = cmddes[hnum].hmsg; X if (*cp == '/') /* end of variable list */ X break; X else X shocout(*cp); /* show n or blank */ X msg = ++cp; /* where message is, skipping 'n' field */ X while (*cp) /* ship to lex value */ X ++cp; X i = cmddes[hnum].Vmsg; /* get the lexical index */ X shocout(cupper(lexsym[i])); /* show the command */ X if (lexsym[i] >= ' ') X shocout(' '); /* skip space for no '^' */ X X shocout(' '); /* space to separate */ X prompt(msg); /* and show the message */ X if (++fields == 3) /* bump fields, see if need newline */ X { X fields = 0; X remark(""); X } X } X remark(""); X remark(" n<>$$ Rpt loop @ Invoke cmd file $ Escape"); X remark("Wild cards:"); Xremark("^A-alphanumeric ^D-digit ^L-letter ^O-other,(not-^A) ^P-punctuation"); Xremark("^X-any character ^U-user set -- ^W-word of ^.. ^N-not in word of ^.."); X X#endif X X if (!oldtty) X tvxy(1,24); X ask("Press any key to resume ",rp,1); X X ttymode = oldtty; X X verify(1); X#else X tverr(&rptbuf[rptuse][0]); X#endif X } X X/* =============================>>> SHOCOUT <<<============================= */ X shocout(c) X char c; X { X X if (c < ' ') X { X ttwt('^'); ttwt(c + '@'); X } X else X ttwt(c); X } X X/* =============================>>> LEXGET <<<============================= */ X lexget(chr) X char *chr; X { /* lexget - get a character for lex, possibly from repeat buffer */ X X SLOW char tmp; Xl10: X if (rptcnt[rptuse] > 0) /* in a repeat buffer? */ X { X *chr=rptbuf[rptuse][nxtrpt[rptuse]]; /* pick up from repeat buffer */ X if (*chr == SLOOPEND) /* at end of rpt buff */ X { X nxtrpt[rptuse] = 0; /* start <> loop over */ X if (--rptcnt[rptuse] == 0 && !echof) /* all done with loop */ X { X echof = TRUE; /* turn on echo again */ X newscr(); /* update screen after repeat */ X } X goto l10; /* loop again */ X } X ++nxtrpt[rptuse]; /* bump to next char in loop */ X } X else /* not in loop, get from keyboard */ X { X gkbd(&tmp); /* picks up one character from the keyboard */ X *chr = old_cmds[old_cindex] = tmp; X old_cindex = ++old_cindex % 16; X } X } X X/* =============================>>> LEX <<<============================= */ X lex(lexval,lexcnt,lexchr,parsok) X int *lexval,*lexcnt,parsok; X char *lexchr; X { /* ## lex - gets command input from terminal, and scans for X # its lexical value. Returns a count if given. Also handles X # repeat loops. */ X X SLOW int count, lex_default; X FAST int i; X SLOW int neg, newln; X X static char chr,cmdchr,tchr; X X X lex_default = TRUE; X X if (!parsok) /* abort if error in <> */ X { X if (rptcnt[rptuse] > 0) /* in loop? */ X { X newscr(); /* clear screen, send message */ X tverrb("<> not complete "); X } X rptcnt[rptuse]=0; /* abort loop if going */ X nxtrpt[rptuse]=0; X } Xl10: X for (;;) X { /* need this loop to support <> */ X count = 1; /* default count is 1 */ X X lexget(&chr); /* fetch a character */ X if (rptcnt[rptuse]>0 && chr==SLOOPBEG) /* detect nesting */ X { X nxtrpt[rptuse] = 0 ; rptcnt[rptuse] = 0 ; echof=TRUE; X newscr(); /* update anything so far */ X tverrb("?No nesting "); X continue; X } X X if ((chr>='0' && chr<='9') || chr=='-') /* a number */ X { X count = 0; lex_default = FALSE; X neg = FALSE; /* handle negative counts */ X if (chr=='-') X neg=TRUE; X else X count = chr-'0'; /* convert to int value */ X for (;;) X { X if (rptcnt[rptuse] > 0) /* have to handle rptbuf special */ X { X chr=rptbuf[rptuse][nxtrpt[rptuse]]; X ++nxtrpt[rptuse]; X } X else X lexget(&chr); X if (chr>='0' && chr<='9') /* another number? */ X count = count*10+chr-'0'; X else /* done with number */ X break; X } X if (neg) /* fix if it was negative */ X count = min(-count ,-1); X } X cmdchr = clower(chr); /* fold to one case */ X if (cmdchr == SLOOPBEG) /* starting a loop? */ X { X lex_default = TRUE; /* don't let lex count be def */ X rptcnt[rptuse] = (count < 0) ? (-count) : count; /* save count */ X ins_mode = TRUE; /* so ttymode works */ X tvmsg("repeat[",FALSE); /* echo 'repeat[k]: n<' */ X wtint(rptuse+1); prompt("]: "); X wtint(rptcnt[rptuse]); X X tvcout(SLOOPBEG); X nxtrpt[rptuse]=0; /* begin inserting at beginning */ X newln = FALSE; /* no new line echo yet */ X do /* fetch repeat chars until get > */ X { X gkbd(&chr); /* fetch a char */ X if (chr==delkey) /* allow editing */ X { X if (nxtrpt[rptuse] > 0) /* don't go past start */ X { X --nxtrpt[rptuse]; /* wipe out last */ X if ((tchr = rptbuf[rptuse][nxtrpt[rptuse]])==CR) X { X tvcout(CR); /* going to newline */ X#ifdef USELF X tvcout(LF); X#endif X newln = TRUE; /* new line now */ X } X else if (!newln) X { X tvcout(BACKSPACE); /* back over character */ X tvcout(' '); X tvcout(BACKSPACE); X if (tchr < ' ' && tchr != 27) X { X tvcout(BACKSPACE); /* back over char */ X tvcout(' '); X tvcout(BACKSPACE); X } X } X else /* have passed new line start */ X { X ctrlch(rptbuf[rptuse][nxtrpt[rptuse]]); X tvcout('\\'); X } X } X else X tvcout(BELL); /* trying to rubout too much */ X continue; X } X else /* a control character detected */ X ctrlch(chr); /* echo */ X X rptbuf[rptuse][nxtrpt[rptuse]]=chr; /* stuff in current rpt buff. */ X ++nxtrpt[rptuse]; /* bump count */ X if (nxtrpt[rptuse] >= 100) /* only allow 100 chars! */ X { X newscr(); X tverrb("100 chars only"); X nxtrpt[rptuse]=0 ; rptcnt[rptuse]=0; X ins_mode = FALSE; X goto l10; /* bail out */ X } X } X while (!( chr==ESC && rptbuf[rptuse][nxtrpt[rptuse]-2]==ESC && X rptbuf[rptuse][nxtrpt[rptuse]-3]==SLOOPEND)); /* end do loop */ X X ins_mode = FALSE; /* get ttymode right */ X X if (rptcnt[rptuse] > 1 || newln) /* positive count? */ X echof = FALSE; /* turn off echoing */ X else /* 0 count */ X { X fixend(); X tvhdln(); /* get back where we were */ X } X X rptbuf[rptuse][nxtrpt[rptuse]-2]=0; X lstrpt[rptuse]=nxtrpt[rptuse]-3; /* bump back to end of buffer */ X nxtrpt[rptuse]=0; /* back for scan now */ X continue; /* now execute the loop */ X } X#ifdef VB X else if (cmdchr == '@') /*$$$ indirect files! */ X { X opnatf(); X continue; X } X#endif X for (i=0 ; synofr[i]!=0 ; ++i) X if (synofr[i]==cmdchr) X cmdchr=synoto[i]; /* allow synonyms */ X X *lexval = UNKNOWN; /* assume unknown command */ X for (i = 1 ; i<= LEXVALUES ; ++i) /* scan all possible cmds */ X if (cmdchr == lexsym[i]) /* found it */ X { X *lexval = i; X break; X } X *lexcnt = count; /* return good stuff */ X *lexchr = chr; X return (lex_default); /* let know if gave back default */ X } /* end of for(;;) */ X } X/* ------------------------ tvx_lex.c --------------------------------- */ SHAR_EOF echo Extracting tvx_lib.c: sed 's/^X//' >tvx_lib.c <<\SHAR_EOF X/*--------------------------------- tvx_lib.c ------------------------- */ X#include "tvx_defs.ic" X#include "tvx_glbl.ic" X X#ifdef COMPILESTANDARD X#define STANDARD /* the set of standard functions TVX use */ X#endif X X#define LOCAL static /* make locals to this module */ X X/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ X X/* following are some non-standard routines required by TVX */ X X/* =============================>>> STCOPY <<<============================= */ X stcopy(from, i, to, j) X char from[],to[]; X BUFFINDEX i,*j; X { /* ## stcopy string, increment j */ X X BUFFINDEX k1, k2; X X k2 = *j; X for (k1 = i; from[k1] ; ) X { X to[k2++] = from[k1++]; X } X to[k2] = 0; X *j = k2; X } X X/* =============================>>> STrCOPY <<<============================= */ X strcopy(from, i, to, j) X char from[],to[]; X int i,*j; X { /* ## stcopy string, increment j */ X X FAST int k1, k2; X X k2 = *j; X for (k1 = i; from[k1] ; ) X { X to[k2++] = from[k1++]; X } X to[k2] = 0; X *j = k2; X } X X#ifndef GEMDOS X/* =============================>>> MIN <<<============================= */ X min(v1,v2) X int v1,v2; X { X return (v1 > v2 ? v2 : v1); X } X X/* =============================>>> MAX <<<============================= */ X max(v1,v2) X int v1,v2; X { X return (v1 > v2 ? v1 : v2); X } X#endif X X/*=============================>>> CLOWER <<<================================*/ X char clower(ch) X char ch; X { X return ((ch >='A' && ch<='Z') ? ch + ' ' : ch); X } X X/*=============================>>> CUPPER <<<================================*/ X char cupper(ch) X char ch; X { X return ((ch >= 'a' && ch <= 'z') ? ch - ' ' : ch); X } X X/* =========================>>> LOWER <<<==============================*/ X lower(str) X char str[]; X { X FAST int i; X X for (i=0 ; str[i] ; ++i) X str[i]=clower(str[i]); X X } X X/* ===========================>>> PRINTC <<<============================== */ X printc(chr) X char chr; X { /* send one character to the printer */ X X#ifdef MSDOS X bdos(5,chr); /* cp/m, ms-dos version */ X#endif X#ifdef GEMDOS X gemdos(5,chr); /* gemdos version */ X#endif X } X X/*=============================>>> PROMPT <<<================================*/ X prompt(msg) X char msg[]; X { X SLOW int i; X i = strlen(msg); X ttwtln(msg,i); X } X X/*=============================>>> QUIT <<<================================*/ X quit() X { X exit(0); X } X X/*=============================>>> RINDEX <<<================================*/ X rindex(str, c) X char c, str[]; X { /* rindex - find last occurrence character c in string str */ X X FAST int i,j; X X j = -1; X for (i = 0 ; str[i] != 0; i++) X if (str[i] == c) X j = i; X return (j); X } X X/*=============================>>> REMARK <<<================================*/ X remark(msg) X char msg[]; X { X prompt(msg); X ttwt(CR); X#ifdef USELF X ttwt(LF); X#endif X } X X/*=============================>>> UPPER <<<================================*/ X upper(str) X char str[]; X { X static int i; X X for (i=0 ; str[i] ; ++i) X str[i]=cupper(str[i]); X } X X/*=============================>>> WTINT <<<================================*/ X wtint(intg) X int intg; X { X char chrep[10]; X itoa(intg,chrep); X prompt(chrep); X } X X/*=============================>>> LREPLY <<<================================*/ X lreply(msg,maxc) X char msg[]; X int maxc; X { X reply(msg,maxc); X lower(msg); X } X X/*=============================>>> UREPLY <<<================================*/ X ureply(msg,maxc) X char msg[]; X int maxc; X { X reply(msg,maxc); X upper(msg); X } X X/*=============================>>> REPLY <<<================================*/ X reply(msg,maxc) X char msg[]; X int maxc; X { X#define CBS 8 /* Backspace */ X#define CDL1 21 /* ^U */ X#define CDL2 24 /* ^X */ X#define CABORT 3 /* ^C */ X#define CRET 13 /* cr */ X#define BACKSPACE 8 X X static char ch, rp; X static int i; X SLOW int oldtty; X X oldtty = ttymode; X ttymode = FALSE; /* change to regular mode */ X X for (i = 0 ; i < maxc ; ) /* i -> next char */ X { X ch = ttrd_(); /* read the character */ X if (ch == CBS) /* back space */ X { X if (i > 0) /* must be something to delete */ X { X --i; /* wipe out char */ X ttwt(BACKSPACE); ttwt(' '); ttwt(BACKSPACE); X if (msg[i] < ' ') /* double echo ^ chrs */ X { X ttwt(BACKSPACE); ttwt(' '); ttwt(BACKSPACE); X } X } X } X#ifdef USE_WIPE X else if (ch == CDL1 || ch == CDL2) /* wipe whole line */ X { X i = 0; /* set for loop ++ */ X remark("#"); X prompt("Re-enter? "); X } X#endif X else if (ch == CABORT && !ins_mode) X { X remark("^C"); X prompt("Exit to operating system - are you sure? (y/n) "); X rp = ttrd_(); X if (rp == 'y' || rp =='Y') X { X remark("y"); X reset(); /* need to reset things */ X exit(0); X } X remark("n"); X msg[i] = 0; X prompt("Re-enter? "); prompt(msg); /* re-echo */ X } X else if (ch == CRET) /* ret, so done */ X { X remark(""); X msg[i] = 0; X ttymode = oldtty; X return; X } X else X { X msg[i++] = ch; X msg[i] = 0; /* always 0 terminate */ X if (ch < ' ') X { X ch += '@'; X ttwt('^'); X } X ttwt(ch); /* echo char */ X } X } /* end for */ X X ttymode = oldtty; X remark(""); X } X X/* ============================>>> TTRD_ <<<================================ */ X ttrd_() X { X SLOW int tc; X X#ifdef OSCPM X while (!(tc = bdos(6,-1))) /* cp/m implementation */ X ; X#endif X#ifdef MSDOS X tc = bdos(7,-1); /* ms-dos implementation */ X#endif X#ifdef GEMDOS X tc = gemdos(7); /* ms-dos implementation */ X#endif X#ifdef UNIX X tc = ttrd(); X#endif X X return (tc & 0377); X X } X X/*=============================>>> RDINT <<<================================*/ X rdint(val) X int *val; X { X char chrrep[12]; X reply(chrrep,11); X *val = atoi(chrrep); X return; X } X X/* =============================>>> ITOA <<<============================= */ X itoa(intg, str) X int intg; X char str[]; X { /* itoa - convert integer int to char string in str */ X X FAST int i; X int d, intval, j; X char k; X static char digits[] = "0123456789"; X X intval = intg >= 0 ? intg : (-intg); X str[0] = 0; X i = 0; X do X { /* generate digits */ X i++; X d = intval % 10; /* mod 10 */ X str[i] = digits[d]; X intval = intval / 10; X } X while (intval != 0); X if (intg < 0) X { /* then sign */ X str[++i] = '-'; X } X for (j = 0 ; j < i ; j++ ) X { /* then reverse */ X k = str[i]; X str[i--] = str[j]; X str[j] = k; X } X } X X/* ------------------------------------------------------------------------- */ X#ifdef STANDARD X X/* ============================>>> ATOI <<<================================ */ X atoi(in) X char in[]; X { /* atoi - convert string : Ascii machines! */ X X FAST int i; X int d, val, neg; X X for (i=0 ; in[i] == ' ' || in[i] == '\t' ; i++) X ; X if (in[i] == '-') /* look for negative */ X { X i++; X neg=1; X } X else X neg=0; X for (val = 0; in[i] ; i++) X { X if (in[i]<'0' || in[i]>'9') X break; X d = in[i]-'0'; X val = 10 * val + d; X } X if (neg) X val = (-val); X return (val); X } X X#endif X/*--------------------------------- tvx_lib.c ------------------------- */ SHAR_EOF echo ALL DONE! exit 0