https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c13 --- Comment #13 from Dr. Werner Fink <werner@suse.com> 2011-11-21 15:23:51 UTC --- (In reply to comment #11) Something like this #if !defined (savestring) #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x)) #endif /* !savestring */ int rl_filename_completion_desired = 0; char * rl_username_completion_function (const char *text, int state) { static char *username = (char *)NULL; static struct passwd *entry; static int namelen, first_char, first_char_loc; char *value; if (state == 0) { if (username) { free (username); username = (char *)NULL; } first_char = *text; first_char_loc = first_char == '~'; username = savestring (&text[first_char_loc]); namelen = strlen (username); setpwent (); } while ((entry = getpwent ())) { if (strncmp (username, entry->pw_name, namelen) == 0) break; } if (entry == 0) { endpwent (); return ((char *)NULL); } else { value = (char *)xmalloc (2 + strlen (entry->pw_name)); *value = *text; strcpy (value + first_char_loc, entry->pw_name); if (first_char == '~') rl_filename_completion_desired = 1; endpwent (); return (value); } } -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.