summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2017-11-20 06:53:49 +0000
committerXin LI <delphij@FreeBSD.org>2017-11-20 06:53:49 +0000
commitee3dcfe98fdc32918e3476f437b9603983d6d0be (patch)
tree62ec9b28431130ee7fc5037091ea243b4304955f /main.c
parent6f90225e8378d85045013553763bd7483670441c (diff)
Diffstat (limited to 'main.c')
-rw-r--r--main.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/main.c b/main.c
index b44d88a506fe..179bd78c4331 100644
--- a/main.c
+++ b/main.c
@@ -112,8 +112,9 @@ main(argc, argv)
* Command line arguments override environment arguments.
*/
is_tty = isatty(1);
- get_term();
init_cmds();
+ get_term();
+ expand_cmd_tables();
init_charset();
init_line();
init_cmdhist();
@@ -181,7 +182,6 @@ main(argc, argv)
ifile = get_ifile(FAKE_HELPFILE, ifile);
while (argc-- > 0)
{
- char *filename;
#if (MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC)
/*
* Because the "shell" doesn't expand filename patterns,
@@ -190,25 +190,24 @@ main(argc, argv)
* Expand the pattern and iterate over the expanded list.
*/
struct textlist tlist;
+ char *filename;
char *gfilename;
+ char *qfilename;
gfilename = lglob(*argv++);
init_textlist(&tlist, gfilename);
filename = NULL;
while ((filename = forw_textlist(&tlist, filename)) != NULL)
{
- (void) get_ifile(filename, ifile);
+ qfilename = shell_unquote(filename);
+ (void) get_ifile(qfilename, ifile);
+ free(qfilename);
ifile = prev_ifile(NULL_IFILE);
}
free(gfilename);
#else
- filename = shell_quote(*argv);
- if (filename == NULL)
- filename = *argv;
- argv++;
- (void) get_ifile(filename, ifile);
+ (void) get_ifile(*argv++, ifile);
ifile = prev_ifile(NULL_IFILE);
- free(filename);
#endif
}
/*
@@ -281,17 +280,11 @@ main(argc, argv)
{
if (edit_first()) /* Edit first valid file in cmd line */
quit(QUIT_ERROR);
- /*
- * In case that we have only one file and -F, have to get a line
- * count fot init(). If the line count is less then a height of a term,
- * the content of the file is printed out and then less quits. Otherwise
- * -F can not be used
- */
if (quit_if_one_screen)
{
if (nifile() == 1)
line_count = get_line_count();
- else /* In case more than one file, -F can not be used */
+ else /* If more than one file, -F can not be used */
quit_if_one_screen = FALSE;
}
}