Imported from ../bash-2.05.tar.gz.
This commit is contained in:
parent
bb70624e96
commit
28ef6c316f
251 changed files with 22319 additions and 12413 deletions
|
|
@ -153,6 +153,8 @@ process_line(char *line)
|
|||
} else {
|
||||
fprintf(stderr, "|%s|\n", line);
|
||||
}
|
||||
|
||||
free (line);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -41,15 +41,22 @@
|
|||
extern char *xmalloc ();
|
||||
|
||||
/* The names of functions that actually do the manipulation. */
|
||||
int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
|
||||
int com_delete (), com_help (), com_cd (), com_quit ();
|
||||
int com_list __P((char *));
|
||||
int com_view __P((char *));
|
||||
int com_rename __P((char *));
|
||||
int com_stat __P((char *));
|
||||
int com_pwd __P((char *));
|
||||
int com_delete __P((char *));
|
||||
int com_help __P((char *));
|
||||
int com_cd __P((char *));
|
||||
int com_quit __P((char *));
|
||||
|
||||
/* A structure which contains information on the commands this program
|
||||
can understand. */
|
||||
|
||||
typedef struct {
|
||||
char *name; /* User printable name of the function. */
|
||||
Function *func; /* Function to call to do the job. */
|
||||
rl_icpfunc_t *func; /* Function to call to do the job. */
|
||||
char *doc; /* Documentation for this function. */
|
||||
} COMMAND;
|
||||
|
||||
|
|
@ -65,7 +72,7 @@ COMMAND commands[] = {
|
|||
{ "rename", com_rename, "Rename FILE to NEWNAME" },
|
||||
{ "stat", com_stat, "Print out statistics on FILE" },
|
||||
{ "view", com_view, "View the contents of FILE" },
|
||||
{ (char *)NULL, (Function *)NULL, (char *)NULL }
|
||||
{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL }
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
|
|
@ -205,8 +212,8 @@ stripwhite (string)
|
|||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
char *command_generator ();
|
||||
char **fileman_completion ();
|
||||
char *command_generator __P((const char *, int));
|
||||
char **fileman_completion __P((const char *, int, int));
|
||||
|
||||
/* Tell the GNU Readline library how to complete. We want to try to complete
|
||||
on command names if this is the first word in the line, or on filenames
|
||||
|
|
@ -217,7 +224,7 @@ initialize_readline ()
|
|||
rl_readline_name = "FileMan";
|
||||
|
||||
/* Tell the completer that we want a crack first. */
|
||||
rl_attempted_completion_function = (CPPFunction *)fileman_completion;
|
||||
rl_attempted_completion_function = fileman_completion;
|
||||
}
|
||||
|
||||
/* Attempt to complete on the contents of TEXT. START and END bound the
|
||||
|
|
@ -227,7 +234,7 @@ initialize_readline ()
|
|||
or NULL if there aren't any. */
|
||||
char **
|
||||
fileman_completion (text, start, end)
|
||||
char *text;
|
||||
const char *text;
|
||||
int start, end;
|
||||
{
|
||||
char **matches;
|
||||
|
|
@ -238,7 +245,7 @@ fileman_completion (text, start, end)
|
|||
to complete. Otherwise it is the name of a file in the current
|
||||
directory. */
|
||||
if (start == 0)
|
||||
matches = completion_matches (text, command_generator);
|
||||
matches = rl_completion_matches (text, command_generator);
|
||||
|
||||
return (matches);
|
||||
}
|
||||
|
|
@ -248,7 +255,7 @@ fileman_completion (text, start, end)
|
|||
start at the top of the list. */
|
||||
char *
|
||||
command_generator (text, state)
|
||||
char *text;
|
||||
const char *text;
|
||||
int state;
|
||||
{
|
||||
static int list_index, len;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
main ()
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
# include "history.h"
|
||||
#else
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char line[1024], *t;
|
||||
int len, done = 0;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@
|
|||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
* How to Emulate gets () */
|
||||
/* How to Emulate gets () */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
|
|
@ -82,13 +81,12 @@ invert_case_line (count, key)
|
|||
|
||||
for (; start != end; start += direction)
|
||||
{
|
||||
if (uppercase_p (rl_line_buffer[start]))
|
||||
rl_line_buffer[start] = to_lower (rl_line_buffer[start]);
|
||||
else if (lowercase_p (rl_line_buffer[start]))
|
||||
rl_line_buffer[start] = to_upper (rl_line_buffer[start]);
|
||||
if (_rl_uppercase_p (rl_line_buffer[start]))
|
||||
rl_line_buffer[start] = _rl_to_lower (rl_line_buffer[start]);
|
||||
else if (_rl_lowercase_p (rl_line_buffer[start]))
|
||||
rl_line_buffer[start] = _rl_to_upper (rl_line_buffer[start]);
|
||||
}
|
||||
|
||||
/* Move point to on top of the last character changed. */
|
||||
rl_point = end - direction;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ set_deftext ()
|
|||
{
|
||||
rl_insert_text (deftext);
|
||||
deftext = (char *)NULL;
|
||||
rl_startup_hook = (Function *)NULL;
|
||||
rl_startup_hook = (rl_hook_func_t *)NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -126,6 +126,6 @@ main (argc, argv)
|
|||
if (temp == 0)
|
||||
exit (1);
|
||||
|
||||
puts (temp);
|
||||
printf ("%s\n", temp);
|
||||
exit (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue