Error Buddy

Do you have an error message from your application? Then find the answer with Error Buddy. You can search over 40000 source code files and troubleshooting documents using our beta lucene/nutch search interface or if you prefer, search as normal using google. With LXR technology you can drill right down into the line of source code where it came from with full cross-referencing.

If after searching you didn't get your ideal answer, or you are still unclear what the error means, you can choose to post that question to the community forums following the link included in the search results.

corestack/ readline-5.0/ callback.c [1.6]
001 /* callback.c -- functions to use readline as an X `callback' mechanism. */
002 
003 /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
004 
005    This file is part of the GNU Readline Library, a library for
006    reading lines of text with interactive input and history editing.
007 
008    The GNU Readline Library is free software; you can redistribute it
009    and/or modify it under the terms of the GNU General Public License
010    as published by the Free Software Foundation; either version 2, or
011    (at your option) any later version.
012 
013    The GNU Readline Library is distributed in the hope that it will be
014    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
015    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016    GNU General Public License for more details.
017 
018    The GNU General Public License is often shipped with GNU software, and
019    is generally kept in a file called COPYING or LICENSE.  If you do not
020    have a copy of the license, write to the Free Software Foundation,
021    59 Temple Place, Suite 330, Boston, MA 02111 USA. */
022 #define READLINE_LIBRARY
023 
024 #if defined (HAVE_CONFIG_H)
025 #  include <config.h>
026 #endif
027 
028 #include "rlconf.h"
029 
030 #if defined (READLINE_CALLBACKS)
031 
032 #include <sys/types.h>
033 
034 #ifdef HAVE_STDLIB_H
035 #  include <stdlib.h>
036 #else
037 #  include "ansi_stdlib.h"
038 #endif
039 
040 #include <stdio.h>
041 
042 /* System-specific feature definitions and include files. */
043 #include "rldefs.h"
044 #include "readline.h"
045 #include "rlprivate.h"
046 
047 /* **************************************************************** */
048 /*                                                                  */
049 /*                      Callback Readline Functions                 */
050 /*                                                                  */
051 /* **************************************************************** */
052 
053 /* Allow using readline in situations where a program may have multiple
054    things to handle at once, and dispatches them via select().  Call
055    rl_callback_handler_install() with the prompt and a function to call
056    whenever a complete line of input is ready.  The user must then
057    call rl_callback_read_char() every time some input is available, and 
058    rl_callback_read_char() will call the user's function with the complete
059    text read in at each end of line.  The terminal is kept prepped and
060    signals handled all the time, except during calls to the user's function. */
061 
062 rl_vcpfunc_t *rl_linefunc;              /* user callback function */
063 static int in_handler;          /* terminal_prepped and signals set? */
064 
065 /* Make sure the terminal is set up, initialize readline, and prompt. */
066 static void
067 _rl_callback_newline ()
068 {
069   rl_initialize ();
070 
071   if (in_handler == 0)
072     {
073       in_handler = 1;
074 
075       (*rl_prep_term_function) (_rl_meta_flag);
076 
077 #if defined (HANDLE_SIGNALS)
078       rl_set_signals ();
079 #endif
080     }
081 
082   readline_internal_setup ();
083 }
084 
085 /* Install a readline handler, set up the terminal, and issue the prompt. */
086 void
087 rl_callback_handler_install (prompt, linefunc)
088      const char *prompt;
089      rl_vcpfunc_t *linefunc;
090 {
091   rl_set_prompt (prompt);
092   rl_linefunc = linefunc;
093   _rl_callback_newline ();
094 }
095 
096 /* Read one character, and dispatch to the handler if it ends the line. */
097 void
098 rl_callback_read_char ()
099 {
100   char *line;
101   int eof;
102 
103   if (rl_linefunc == NULL)
104     {
105       fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n");
106       abort ();
107     }
108 
109   eof = readline_internal_char ();
110 
111   /* We loop in case some function has pushed input back with rl_execute_next. */
112   for (;;)
113     {
114       if (rl_done)
115         {
116           line = readline_internal_teardown (eof);
117 
118           (*rl_deprep_term_function) ();
119 #if defined (HANDLE_SIGNALS)
120           rl_clear_signals ();
121 #endif
122           in_handler = 0;
123           (*rl_linefunc) (line);
124 
125           /* If the user did not clear out the line, do it for him. */
126           if (rl_line_buffer[0])
127             _rl_init_line_state ();
128 
129           /* Redisplay the prompt if readline_handler_{install,remove}
130              not called. */
131           if (in_handler == 0 && rl_linefunc)
132             _rl_callback_newline ();
133         }
134       if (rl_pending_input || _rl_pushed_input_available ())
135         eof = readline_internal_char ();
136       else
137         break;
138     }
139 }
140 
141 /* Remove the handler, and make sure the terminal is in its normal state. */
142 void
143 rl_callback_handler_remove ()
144 {
145   rl_linefunc = NULL;
146   if (in_handler)
147     {
148       in_handler = 0;
149       (*rl_deprep_term_function) ();
150 #if defined (HANDLE_SIGNALS)
151       rl_clear_signals ();
152 #endif
153     }
154 }
155 
156 #endif

Powered by Lucene and the LXR engine.