[BACK]Return to readline.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libedit

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libedit/readline.c between version 1.49.2.1 and 1.52

version 1.49.2.1, 2005/05/28 14:02:27 version 1.52, 2005/04/19 03:29:18
Line 1378  history_search_pos(const char *str,
Line 1378  history_search_pos(const char *str,
 char *  char *
 tilde_expand(char *txt)  tilde_expand(char *txt)
 {  {
         struct passwd *pass;          struct passwd pwres, *pass;
         char *temp;          char *temp;
         size_t len = 0;          size_t len = 0;
           char pwbuf[1024];
   
         if (txt[0] != '~')          if (txt[0] != '~')
                 return (strdup(txt));                  return (strdup(txt));
Line 1398  tilde_expand(char *txt)
Line 1399  tilde_expand(char *txt)
                 (void)strncpy(temp, txt + 1, len - 2);                  (void)strncpy(temp, txt + 1, len - 2);
                 temp[len - 2] = '\0';                  temp[len - 2] = '\0';
         }          }
         pass = getpwnam(temp);          if (getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf), &pass) != 0)
                   pass = NULL;
         free(temp);             /* value no more needed */          free(temp);             /* value no more needed */
         if (pass == NULL)          if (pass == NULL)
                 return (strdup(txt));                  return (strdup(txt));
Line 1550  filename_completion_function(const char 
Line 1552  filename_completion_function(const char 
 char *  char *
 username_completion_function(const char *text, int state)  username_completion_function(const char *text, int state)
 {  {
         struct passwd *pwd;          struct passwd *pwd, pwres;
           char pwbuf[1024];
   
         if (text[0] == '\0')          if (text[0] == '\0')
                 return (NULL);                  return (NULL);
Line 1561  username_completion_function(const char 
Line 1564  username_completion_function(const char 
         if (state == 0)          if (state == 0)
                 setpwent();                  setpwent();
   
         while ((pwd = getpwent()) && text[0] == pwd->pw_name[0]          while (getpwent_r(&pwres, pwbuf, sizeof(pwbuf), &pwd) == 0
               && pwd != NULL && text[0] == pwd->pw_name[0]
             && strcmp(text, pwd->pw_name) == 0);              && strcmp(text, pwd->pw_name) == 0);
   
         if (pwd == NULL) {          if (pwd == NULL) {
Line 1760  _rl_complete_internal(int what_to_do)
Line 1764  _rl_complete_internal(int what_to_do)
                     (end - len), end);                      (end - len), end);
         } else          } else
                 matches = 0;                  matches = 0;
         if (!rl_attempted_completion_function || !matches)          if (!rl_attempted_completion_function ||
                (!rl_attempted_completion_over && !matches))
                 matches = completion_matches(temp, (CPFunction *)complet_func);                  matches = completion_matches(temp, (CPFunction *)complet_func);
   
           if (rl_attempted_completion_over)
                   rl_attempted_completion_over = 0;
   
         if (matches) {          if (matches) {
                 int i, retval = CC_REFRESH;                  int i, retval = CC_REFRESH;
                 int matches_num, maxlen, match_len, match_display=1;                  int matches_num, maxlen, match_len, match_display=1;
Line 2023  rl_callback_read_char()
Line 2031  rl_callback_read_char()
 }  }
   
 void  void
 rl_callback_handler_install (const char *prompt, VCPFunction *linefunc)  rl_callback_handler_install (const char *prompt, VFunction *linefunc)
 {  {
         if (e == NULL) {          if (e == NULL) {
                 rl_initialize();                  rl_initialize();
Line 2094  rl_parse_and_bind(const char *line)
Line 2102  rl_parse_and_bind(const char *line)
         return (argc ? 1 : 0);          return (argc ? 1 : 0);
 }  }
   
   int
   rl_variable_bind(const char *var, const char *value)
   {
           /*
            * The proper return value is undocument, but this is what the
            * readline source seems to do.
            */
           return ((el_set(e, EL_BIND, "", var, value) == -1) ? 1 : 0);
   }
   
 void  void
 rl_stuff_char(int c)  rl_stuff_char(int c)
 {  {

Legend:
Removed from v.1.49.2.1  
changed lines
  Added in v.1.52

CVSweb <webmaster@jp.NetBSD.org>