1 /*
2 ** readlinestuff.c elfsh
3 **
4 ** Started on  Tue Feb 18 06:24:42 2003 emsi
5 ** Last update Tue Jun 24 06:23:02 2003 mayhem
6 */
7 #include "elfsh.h"
8 
9 
10 
11 /* Completion fonction for the command list */
command_generator(const char * text,int state)12 char *command_generator(const char* text, int state)
13 {
14   static int i, len;
15   char *name;
16 
17   if (!state)
18     {
19       i = 0;
20       len = strlen (text);
21     }
22 
23   /* Return the next name which partially matches from the
24      command list. */
25   while (world.cmds[i]!=NULL)
26     {
27       name=world.cmds[i];
28       i++;
29 
30       if (strncmp (name, text, len) == 0)
31 	return (strdup(name));
32     }
33 
34   /* If no names matched, then return NULL. */
35   return ((char *)NULL);
36 }
37 
38 
39 
40 #if defined(USE_READLN)
coustom_completion(const char * text,int start,int end)41 char** coustom_completion(const char* text, int start, int end)
42 {
43   char** matches=(char**) NULL;
44 
45   if (start == 0)
46     matches = (char **)completion_matches (text, command_generator);
47 
48   return (matches);
49 }
50 #endif
51 
52 
53