read.cxx

Go to the documentation of this file.
00001 // @(#)root/editline:$Id: read.cxx 36326 2010-10-13 08:05:45Z axel $
00002 // Author: Mary-Louise Gill, 2009
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 /*      $NetBSD: read.c,v 1.19 2001/01/10 07:45:41 jdolecek Exp $       */
00013 
00014 /*-
00015  * Copyright (c) 1992, 1993
00016  *      The Regents of the University of California.  All rights reserved.
00017  *
00018  * This code is derived from software contributed to Berkeley by
00019  * Christos Zoulas of Cornell University.
00020  *
00021  * Redistribution and use in source and binary forms, with or without
00022  * modification, are permitted provided that the following conditions
00023  * are met:
00024  * 1. Redistributions of source code must retain the above copyright
00025  *    notice, this list of conditions and the following disclaimer.
00026  * 2. Redistributions in binary form must reproduce the above copyright
00027  *    notice, this list of conditions and the following disclaimer in the
00028  *    documentation and/or other materials provided with the distribution.
00029  * 3. Neither the name of the University nor the names of its contributors
00030  *    may be used to endorse or promote products derived from this software
00031  *    without specific prior written permission.
00032  *
00033  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00034  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00035  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00036  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00037  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00038  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00039  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00040  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00041  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00042  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00043  * SUCH DAMAGE.
00044  */
00045 
00046 #include "compat.h"
00047 
00048 /*
00049  * read.c: Clean this junk up! This is horrible code.
00050  *         Terminal read functions
00051  */
00052 #include "sys.h"
00053 #include <errno.h>
00054 #include <unistd.h>
00055 #include <stdlib.h>
00056 #include "el.h"
00057 #include "enhance.h"
00058 
00059 
00060 #define OKCMD -1
00061 
00062 el_private int read__fixio(int, int);
00063 el_private int read_preread(EditLine_t*);
00064 el_private int read_getcmd(EditLine_t*, ElAction_t*, char*);
00065 el_private int read_char(EditLine_t*, char*);
00066 
00067 #ifdef DEBUG_EDIT
00068 el_private void
00069 read_debug(EditLine_t* el) {
00070    if (el->fLine.fCursor > el->fLine.fLastChar) {
00071       (void) fprintf(el->fErrFile, "cursor > lastchar\r\n");
00072    }
00073 
00074    if (el->fLine.fCursor < el->fLine.fBuffer) {
00075       (void) fprintf(el->fErrFile, "cursor < buffer\r\n");
00076    }
00077 
00078    if (el->fLine.fCursor > el->fLine.fLimit) {
00079       (void) fprintf(el->fErrFile, "cursor > limit\r\n");
00080    }
00081 
00082    if (el->fLine.fLastChar > el->fLine.fLimit) {
00083       (void) fprintf(el->fErrFile, "lastchar > limit\r\n");
00084    }
00085 
00086    if (el->fLine.fLimit != &el->fLine.fBuffer[EL_BUFSIZ - 2]) {
00087       (void) fprintf(el->fErrFile, "limit != &buffer[EL_BUFSIZ-2]\r\n");
00088    }
00089 } // read_debug
00090 
00091 
00092 #endif /* DEBUG_EDIT */
00093 
00094 
00095 /* read__fixio():
00096  *      Try to recover from a read error
00097  */
00098 /* ARGSUSED */
00099 el_private int
00100 read__fixio(int 
00101 # if (defined(F_SETFL) && defined(O_NDELAY)) \
00102      || defined(FIONBIO)
00103             fd
00104 #endif
00105             , int e) {
00106    switch (e) {
00107    case - 1:                    /* Make sure that the code is reachable */
00108 
00109 #ifdef EWOULDBLOCK
00110    case EWOULDBLOCK:
00111 # ifndef TRY_AGAIN
00112 #  define TRY_AGAIN
00113 # endif
00114 #endif /* EWOULDBLOCK */
00115 
00116 #if defined(POSIX) && defined(EAGAIN)
00117 # if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
00118    case EAGAIN:
00119 #  ifndef TRY_AGAIN
00120 #   define TRY_AGAIN
00121 #  endif
00122 # endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */
00123 #endif /* POSIX && EAGAIN */
00124 
00125       e = 0;
00126 #ifdef TRY_AGAIN
00127 # if defined(F_SETFL) && defined(O_NDELAY)
00128 
00129       if ((e = fcntl(fd, F_GETFL, 0)) == -1) {
00130          return -1;
00131       }
00132 
00133       if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1) {
00134          return -1;
00135       } else {
00136          e = 1;
00137       }
00138 # endif /* F_SETFL && O_NDELAY */
00139 
00140 # ifdef FIONBIO
00141       {
00142          int zero = 0;
00143 
00144          if (ioctl(fd, FIONBIO, (ioctl_t) &zero) == -1) {
00145             return -1;
00146          } else {
00147             e = 1;
00148          }
00149       }
00150 # endif /* FIONBIO */
00151 
00152 #endif /* TRY_AGAIN */
00153       return e ? 0 : -1;
00154 
00155    case EINTR:
00156       return 0;
00157 
00158    default:
00159       return -1;
00160    } // switch
00161 } // read__fixio
00162 
00163 
00164 /* read_preread():
00165  *      Try to read the stuff in the input queue;
00166  */
00167 el_private int
00168 read_preread(EditLine_t* el) {
00169    int chrs = 0;
00170 
00171    if (el->fCharEd.fMacro.fNLine) {
00172       el_free((ptr_t) el->fCharEd.fMacro.fNLine);
00173       el->fCharEd.fMacro.fNLine = NULL;
00174    }
00175 
00176    if (el->fTTY.t_mode == ED_IO) {
00177       return 0;
00178    }
00179 
00180 #ifdef FIONREAD
00181    if (!el->fIn) {
00182       (void) ioctl(el->fInFD, FIONREAD, (ioctl_t) &chrs);
00183 
00184       if (chrs > 0) {
00185          char buf[EL_BUFSIZ];
00186 
00187          chrs = read(el->fInFD, buf,
00188                      (size_t) MIN(chrs, EL_BUFSIZ - 1));
00189 
00190          if (chrs > 0) {
00191             buf[chrs] = '\0';
00192             el->fCharEd.fMacro.fNLine = strdup(buf);
00193             el_push(el, el->fCharEd.fMacro.fNLine);
00194          }
00195       }
00196    }
00197 #endif /* FIONREAD */
00198 
00199    return chrs > 0;
00200 } // read_preread
00201 
00202 
00203 /* el_push():
00204  *      Push a macro
00205  */
00206 el_public void
00207 el_push(EditLine_t* el, const char* str) {
00208    CMacro_t* ma = &el->fCharEd.fMacro;
00209 
00210    if (str != NULL && ma->fLevel + 1 < EL_MAXMACRO) {
00211       ma->fLevel++;
00212       /* LINTED const cast */
00213       ma->fMacro[ma->fLevel] = (char*) str;
00214    } else {
00215       term_beep(el);
00216       term__flush();
00217    }
00218 }
00219 
00220 
00221 /* read_getcmd():
00222  *      Return next command from the input stream.
00223  */
00224 el_private int
00225 read_getcmd(EditLine_t* el, ElAction_t* cmdnum, char* ch) {
00226    ElAction_t cmd = ED_UNASSIGNED;
00227    int num;
00228 
00229    while (cmd == ED_UNASSIGNED || cmd == ED_SEQUENCE_LEAD_IN) {
00230       if ((num = el_getc(el, ch)) != 1) {               /* if EOF or error */
00231          return num;
00232       }
00233 
00234 #ifdef  KANJI
00235 
00236       if ((*ch & 0200)) {
00237          el->fState.fMetaNext = 0;
00238          cmd = CcViMap[' '];
00239          break;
00240       } else
00241 #endif /* KANJI */
00242 
00243       if (el->fState.fMetaNext) {
00244          el->fState.fMetaNext = 0;
00245          *ch |= 0200;
00246       }
00247       // Coverity is complaining that the value of ch comes from the user
00248       // and nowhere do we check its value. But that's fine: it's 0<=ch<255,
00249       // and fCurrent has 256 entries.
00250       // coverity[data_index]
00251       // coverity[tainted_data]
00252       cmd = el->fMap.fCurrent[(unsigned char) *ch];
00253 
00254       if (cmd == ED_SEQUENCE_LEAD_IN) {
00255          KeyValue_t val;
00256 
00257          switch (key_get(el, ch, &val)) {
00258          case XK_CMD:
00259             cmd = val.fCmd;
00260             break;
00261          case XK_STR:
00262             el_push(el, val.fStr);
00263             break;
00264 #ifdef notyet
00265          case XK_EXE:
00266             /* XXX: In the future to run a user function */
00267             RunCommand(val.fStr);
00268             break;
00269 #endif
00270          default:
00271             EL_ABORT((el->fErrFile, "Bad XK_ type \n"));
00272             break;
00273          } // switch
00274       }
00275 
00276       if (el->fMap.fAlt == NULL) {
00277          el->fMap.fCurrent = el->fMap.fKey;
00278       }
00279    }
00280    *cmdnum = cmd;
00281    return OKCMD;
00282 } // read_getcmd
00283 
00284 
00285 /* read_char():
00286  *      Read a character from the tty.
00287  *      Initialise the character colour to NULL.
00288  */
00289 el_private int
00290 read_char(EditLine_t* el, char* cp) {
00291    int num_read;
00292    int tried = 0;
00293 
00294    if (!el->fIn) {
00295       while ((num_read = read(el->fInFD, cp, 1)) == -1) {
00296          if (!tried && read__fixio(el->fInFD, errno) == 0) {
00297             tried = 1;
00298          } else {
00299             *cp = '\0';
00300             return -1;
00301          }
00302       }
00303    } else {
00304       if (feof(el->fIn)) {
00305          *cp = 0;
00306          return 0;
00307       }
00308       int chread = fgetc(el->fIn);
00309 #ifdef DEBUG_READ
00310       if (chread < 0 || chread > 255) {
00311          fprintf(el->fErrFile,
00312                  "Read unexpected character value %d\n", chread);
00313       }
00314 #endif
00315       *cp = (char)chread;
00316       num_read = 1;
00317    }
00318    // don't do this - "new" char may be a command char e.g <- or ->
00319    // set the colour of the newly read in char to null
00320    //el->fLine.fBufColor[el->fLine.fCursor - el->fLine.fBuffer] = -1;
00321 
00322    return num_read;
00323 } // read_char
00324 
00325 
00326 /* el_getc():
00327  *      Read a character
00328  */
00329 el_public int
00330 el_getc(EditLine_t* el, char* cp) {
00331    int num_read;
00332    CMacro_t* ma = &el->fCharEd.fMacro;
00333 
00334    term__flush();
00335 
00336    for ( ; ;) {
00337       if (ma->fLevel < 0) {
00338          if (!read_preread(el)) {
00339             break;
00340          }
00341       }
00342 
00343       if (ma->fLevel < 0) {
00344          break;
00345       }
00346 
00347       if (*ma->fMacro[ma->fLevel] == 0) {
00348          ma->fLevel--;
00349          continue;
00350       }
00351       *cp = *ma->fMacro[ma->fLevel]++ & 0377;
00352 
00353       if (*ma->fMacro[ma->fLevel] == 0) {                 /* Needed for QuoteMode
00354                                                          * On */
00355          ma->fLevel--;
00356       }
00357       return 1;
00358    }
00359 
00360 #ifdef DEBUG_READ
00361       (void) fprintf(el->fErrFile, "Turning raw mode on\n");
00362 #endif /* DEBUG_READ */
00363 
00364    if (tty_rawmode(el) < 0) {   /* make sure the tty is set up correctly */
00365       return 0;
00366    }
00367 
00368 #ifdef DEBUG_READ
00369       (void) fprintf(el->fErrFile, "Reading a character\n");
00370 #endif /* DEBUG_READ */
00371    num_read = read_char(el, cp);
00372 #ifdef DEBUG_READ
00373       (void) fprintf(el->fErrFile, "Got it %c\n", *cp);
00374 #endif /* DEBUG_READ */
00375    return num_read;
00376 } // el_getc
00377 
00378 
00379 int
00380 el_chop_at_newline(EditLine_t* el) {
00381    //fprintf( el->fErrFile, "el_chop_at_newline() 1:[%s]\n", el->fLine.fBuffer );
00382    char* str = el->fLine.fBuffer;
00383 
00384    if (str) {
00385       for ( ; str <= el->fLine.fLastChar; ++str) {
00386          if (*str != '\n' && *str != '\r') {
00387             continue;
00388          }
00389          //el->fLine.fLastChar = str; // ??? yes??? no???
00390          *str = '\0';
00391       }
00392    }
00393    //fprintf( el->fErrFile, "el_chop_at_newline() 2:[%s]\n", el->fLine.fBuffer );
00394    return strlen(el->fLine.fBuffer);
00395 }
00396 
00397 
00398 el_public const char*
00399 el_gets(EditLine_t* el, int* nread) {
00400    int retval;
00401    ElAction_t cmdnum = 0;
00402    int num;                     /* how many chars we have read at NL */
00403    char ch;
00404 #ifdef FIONREAD
00405    CMacro_t* ma = &el->fCharEd.fMacro;
00406 #endif /* FIONREAD */
00407 
00408    //fprintf( el->fErrFile, "el_gets()\n" );
00409 
00410    if (el->fFlags & NO_TTY) {
00411       char* cp = el->fLine.fBuffer;
00412       size_t idx;
00413       size_t numRead = 0;
00414 
00415       while ((numRead = read_char(el, cp)) == 1) {
00416          /* make sure there is space for next character */
00417          if (cp + 4 >= el->fLine.fLimit) { // "+4" for "EOF" below
00418             idx = (cp - el->fLine.fBuffer);
00419 
00420             if (!ch_enlargebufs(el, 2)) {
00421                break;
00422             }
00423             cp = &el->fLine.fBuffer[idx];
00424          }
00425          cp++;
00426 
00427          if (cp[-1] == '\r' || cp[-1] == '\n') {
00428             // cp[-1] = '\0';
00429             // ^^^ added by stephan: this returning
00430             // the newline is tedious on clients
00431             // and in contrary to common STL
00432             // usage.
00433             break;
00434          }
00435       }
00436 
00437       if (!numRead) {
00438          // singal EOF by count > 0 but line==""
00439          *cp = 0;
00440          cp++;
00441          strcpy(cp, "EOF");
00442          cp += 3;
00443       }
00444 
00445       el->fLine.fCursor = el->fLine.fLastChar = cp;
00446       *cp = '\0';
00447 
00448       if (nread) {
00449          *nread = el->fLine.fCursor - el->fLine.fBuffer;
00450       }
00451       return el->fLine.fBuffer;
00452    }
00453 
00454    if (el->fFlags & EDIT_DISABLED) {
00455       // fprintf(stderr, "el_gets() EDIT_DISABLED block\n" );
00456       char* cp = el->fLine.fBuffer;
00457       size_t idx;
00458 
00459       term__flush();
00460 
00461       while (read_char(el, cp) == 1) {
00462          /* make sure there is space next character */
00463          if (cp + 1 >= el->fLine.fLimit) {
00464             idx = (cp - el->fLine.fBuffer);
00465 
00466             if (!ch_enlargebufs(el, 2)) {
00467                break;
00468             }
00469             cp = &el->fLine.fBuffer[idx];
00470          }
00471          cp++;
00472 
00473          if (cp[-1] == '\r' || cp[-1] == '\n') {
00474             // cp[-1] = '\0';
00475             // ^^^ added by stephan: this returning
00476             // the newline is tedious on clients
00477             // and in contrary to common STL
00478             // usage.
00479             break;
00480          }
00481       }
00482       *cp = '\0';
00483       el->fLine.fCursor = el->fLine.fLastChar = cp;
00484 
00485       if (nread) {
00486          *nread = el->fLine.fCursor - el->fLine.fBuffer;
00487       }
00488       return el->fLine.fBuffer;
00489    }
00490 
00491    //for (num = OKCMD; num == OKCMD;) { /* while still editing this line */
00492    //num = OKCMD;
00493 
00494 #ifdef DEBUG_EDIT
00495    read_debug(el);
00496 #endif /* DEBUG_EDIT */
00497 
00498    /* if EOF or error */
00499    // See coverity[data_index] in read_getcmd():
00500    // coverity[tainted_data]
00501    if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
00502 #ifdef DEBUG_READ
00503          (void) fprintf(el->fErrFile,
00504                         "Returning from el_gets %d\n", num);
00505 #endif /* DEBUG_READ */
00506       //break;
00507    }
00508 
00509    if ((int) cmdnum >= el->fMap.fNFunc) {              /* BUG CHECK command */
00510 #ifdef DEBUG_EDIT
00511          (void) fprintf(el->fErrFile,
00512                         "ERROR: illegal command from key 0%o\r\n", ch);
00513 #endif /* DEBUG_EDIT */
00514       //continue;       /* try again */
00515    }
00516    /* now do the real command */
00517 #ifdef DEBUG_READ
00518    {
00519       ElBindings_t* b;
00520 
00521       for (b = el->fMap.fHelp; b->fName; b++) {
00522          if (b->fFunc == cmdnum) {
00523             break;
00524          }
00525       }
00526 
00527       if (b->fName) {
00528          (void) fprintf(el->fErrFile,
00529                         "Executing %s\n", b->fName);
00530       } else {
00531          (void) fprintf(el->fErrFile,
00532                         "Error command = %d\n", cmdnum);
00533       }
00534    }
00535 #endif /* DEBUG_READ */
00536    retval = (*el->fMap.fFunc[cmdnum])(el, ch);
00537 
00538    /* save the last command here */
00539    el->fState.fLastCmd = cmdnum;
00540 
00541    if (el->fMap.fFunc[cmdnum] != ed_replay_hist) {
00542       el->fState.fReplayHist = -1;
00543    }
00544    /* use any return value */
00545    switch (retval) {
00546    case CC_CURSOR:
00547       el->fState.fArgument = 1;
00548       el->fState.fDoingArg = 0;
00549       re_refresh_cursor(el);
00550       break;
00551 
00552    case CC_REDISPLAY:
00553       re_clear_lines(el);
00554       re_clear_display(el);
00555    /* FALLTHROUGH */
00556 
00557    case CC_REFRESH:
00558       el->fState.fArgument = 1;
00559       el->fState.fDoingArg = 0;
00560       re_refresh(el);
00561       break;
00562 
00563    case CC_REFRESH_BEEP:
00564       el->fState.fArgument = 1;
00565       el->fState.fDoingArg = 0;
00566       re_refresh(el);
00567       term_beep(el);
00568       break;
00569 
00570    case CC_NORM:                /* normal char */
00571       el->fState.fArgument = 1;
00572       el->fState.fDoingArg = 0;
00573       num = el->fLine.fLastChar - el->fLine.fBuffer;                                  // LOUISE ret val
00574       break;
00575 
00576    case CC_ARGHACK:                     /* Suggested by Rich Salz */
00577       /* <rsalz@pineapple.bbn.com> */
00578       break;                    /* keep going... */
00579 
00580    case CC_EOF:                 /* end of file typed */
00581       num = 0;
00582       break;
00583 
00584    case CC_NEWLINE:                     /* normal end of line */
00585       num = el->fLine.fLastChar - el->fLine.fBuffer;
00586 
00587       if (0 == num) {
00588          // Added by stephan, so that
00589          // the readline compat layer
00590          // can know the difference
00591          // between an empty line
00592          // and EOF.
00593          el->fLine.fLastChar = el->fLine.fBuffer;
00594          *el->fLine.fBuffer = '\0';
00595          num = 1;
00596       }
00597       //printf( "el_gets() CC_NEWLINE! num=%d\n", num );
00598       break;
00599 
00600    case CC_FATAL:               /* fatal error, reset to known state */
00601 #ifdef DEBUG_READ
00602          (void) fprintf(el->fErrFile,
00603                         "*** editor fatal ERROR ***\r\n\n");
00604 #endif /* DEBUG_READ */
00605       /* put (real) cursor in a known place */
00606       re_clear_display(el);                     /* reset the display stuff */
00607       ch_reset(el);                     /* reset the input pointers */
00608       re_refresh(el);                   /* print the prompt again */
00609       el->fState.fArgument = 1;
00610       el->fState.fDoingArg = 0;
00611       break;
00612 
00613    case CC_ERROR:
00614    default:                     /* functions we don't know about */
00615 #ifdef DEBUG_READ
00616          (void) fprintf(el->fErrFile,
00617                         "*** editor ERROR ***\r\n\n");
00618 #endif /* DEBUG_READ */
00619       el->fState.fArgument = 1;
00620       el->fState.fDoingArg = 0;
00621       term_beep(el);
00622       term__flush();
00623       break;
00624 
00625    } // switch
00626      // i think its this one
00627      //}
00628 
00629 /*         printf( "el_gets() num=%d\n", num ); */
00630    /* make sure the tty is set up correctly */
00631    //(void) tty_cookedmode(el);
00632    term__flush();               /* flush any buffered output */
00633 
00634    //if (el->fFlags & HANDLE_SIGNALS)
00635    //   sig_clr(el);
00636    if (nread) {
00637       *nread = num;
00638    }
00639 
00640    if (retval == 1) {    /* enter key pressed - add a newline */
00641       *el->fLine.fLastChar = '\n';
00642       el->fLine.fLastChar++;
00643       *el->fLine.fLastChar = 0;
00644 
00645       return el->fLine.fBuffer;
00646    }
00647 
00648    CMacro_t* ma = &el->fCharEd.fMacro;
00649 
00650    if (retval == CC_REFRESH && ma->fLevel >= 0 && ma->fMacro[ma->fLevel]) {
00651       int subnread;
00652       el_gets(el, &subnread);
00653 
00654       if (nread) {
00655          *nread += subnread;
00656       }
00657    } else {
00658       // this happens for every char - need to add some logic to enhance to make it not check if not a word etc
00659       // [a-zA-Z]+[0-9].
00660       highlightKeywords(el);
00661 
00662       // if the cursor is at some point in the middle of the buffer, check for brackets
00663       if (el->fLine.fCursor <= el->fLine.fLastChar) {
00664          matchParentheses(el);
00665       }
00666 
00667 
00668       /* '\a' indicates entry is not complete */
00669       *el->fLine.fLastChar = '\a';
00670    }
00671 
00672    return num ? el->fLine.fBuffer : NULL;
00673 } // el_gets
00674 
00675 
00676 el_public const char*
00677 el_gets_newline(EditLine_t* el, int* nread) {
00678    if (el->fFlags & HANDLE_SIGNALS) {
00679       sig_set(el);
00680    }
00681    re_clear_display(el);        /* reset the display stuff */
00682 
00683    /* '\a' is used to signal that we re-entered this function without newline being hit. */
00684    if (*el->fLine.fLastChar == '\a') {
00685       // Remove the '\a'
00686       // by letting getc overwrite it!
00687    } else {
00688       // Only reset the buffer if we edit a whole new line
00689       ch_reset(el);
00690       if (el->fState.fReplayHist >= 0) {
00691          el->fHistory.fEventNo = el->fState.fReplayHist;
00692          // load the entry
00693          ed_prev_history(el, 0);
00694       }
00695 
00696    }
00697 
00698    if (!(el->fFlags & NO_TTY)) {
00699       re_refresh(el);                   /* print the prompt */
00700    }
00701    term__flush();
00702 
00703    if (nread) {
00704       *nread = 0;
00705    }
00706    return NULL;
00707 } // el_gets_newline
00708 
00709 
00710 el_public bool
00711 el_eof(EditLine_t* el) {
00712    return !el->fLine.fBuffer[0] && !strcmp(el->fLine.fBuffer + 1, "EOF");
00713 }
00714 
00715 
00716 /**
00717    el_public const char *
00718    el_gets(EditLine_t *el, int *nread)
00719    {
00720         el_gets( el, nread );
00721  *nread = el_chop_at_newline(el);
00722         return el->fLine.fBuffer;
00723    }
00724  */

Generated on Tue Jul 5 14:11:38 2011 for ROOT_528-00b_version by  doxygen 1.5.1