aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2007-01-07 00:24:30 +1000
committerGravatar axel <axel@liljencrantz.se>2007-01-07 00:24:30 +1000
commit3b4bacb5ba98d1b512d8b9ce5f1d5497405db793 (patch)
tree300dc58150168a6e8552b61910e8172105f4edc6 /builtin.c
parent7e350dab662b7e9299056cb5d760eb197b1e95bf (diff)
Allow the user to specify name of history file to use with the read builtin
darcs-hash:20070106142430-ac50b-32ad52077e11438799b17911dc83e57f89e02f2b.gz
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/builtin.c b/builtin.c
index 7ffa6c9a..f338d47b 100644
--- a/builtin.c
+++ b/builtin.c
@@ -357,7 +357,8 @@ static void builtin_print_help( wchar_t *cmd, string_buffer_t *b )
Several other builtins, including jobs, ulimit and set are so big
that they have been given their own file. These files are all named
- 'builtin_NAME.c', where NAME is the name of the builtin.
+ 'builtin_NAME.c', where NAME is the name of the builtin. These files
+ are included directly below.
*/
@@ -1507,6 +1508,7 @@ static int builtin_read( wchar_t **argv )
wchar_t *prompt = DEFAULT_READ_PROMPT;
wchar_t *commandline = L"";
int exit_res=0;
+ wchar_t *mode_name = READ_MODE_NAME;
woptind=0;
@@ -1544,6 +1546,10 @@ static int builtin_read( wchar_t **argv )
}
,
{
+ L"mode-name", required_argument, 0, 'm'
+ }
+ ,
+ {
L"help", no_argument, 0, 'h'
}
,
@@ -1557,7 +1563,7 @@ static int builtin_read( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
- L"xglUup:c:h",
+ L"xglUup:c:hm:",
long_options,
&opt_index );
if( opt == -1 )
@@ -1579,25 +1585,35 @@ static int builtin_read( wchar_t **argv )
case L'x':
place |= ENV_EXPORT;
break;
+
case L'g':
place |= ENV_GLOBAL;
break;
+
case L'l':
place |= ENV_LOCAL;
break;
+
case L'U':
place |= ENV_UNIVERSAL;
break;
+
case L'u':
place |= ENV_UNEXPORT;
break;
+
case L'p':
prompt = woptarg;
break;
+
case L'c':
commandline = woptarg;
break;
+ case L'm':
+ mode_name = woptarg;
+ break;
+
case 'h':
builtin_print_help( argv[0], sb_out );
return STATUS_BUILTIN_OK;
@@ -1668,7 +1684,7 @@ static int builtin_read( wchar_t **argv )
*/
if( isatty(0) && builtin_stdin == 0 )
{
- reader_push( READ_MODE_NAME );
+ reader_push( mode_name );
reader_set_prompt( prompt );
reader_set_buffer( commandline, wcslen( commandline ) );