o Support for '--' to cancel options list processing.

PR:		bin/32433
Prodded by:	Zak Johnson <zakj-freebsd-hackers@nox.cx>
Obtained from:	easyedit-1.4.6
MFC after:	2 weeks
This commit is contained in:
maxim 2003-06-30 11:49:00 +00:00
parent 9935e85775
commit 132358e7bf

View File

@ -2041,6 +2041,7 @@ char *arguments[];
struct files *temp_names = NULL; struct files *temp_names = NULL;
char *name; char *name;
char *ptr; char *ptr;
int no_more_opts = FALSE;
/* /*
| see if editor was invoked as 'ree' (restricted mode) | see if editor was invoked as 'ree' (restricted mode)
@ -2057,7 +2058,7 @@ char *arguments[];
input_file = FALSE; input_file = FALSE;
recv_file = FALSE; recv_file = FALSE;
count = 1; count = 1;
while (count < numargs) while ((count < numargs) && (!no_more_opts))
{ {
buff = arguments[count]; buff = arguments[count];
if (!strcmp("-i", buff)) if (!strcmp("-i", buff))
@ -2086,9 +2087,18 @@ char *arguments[];
buff++; buff++;
start_at_line = buff; start_at_line = buff;
} }
else if (!(strcmp("--", buff)))
no_more_opts = TRUE;
else else
{ {
count--;
no_more_opts = TRUE;
}
count++;
}
while (count < numargs)
{
buff = arguments[count];
if (top_of_stack == NULL) if (top_of_stack == NULL)
{ {
temp_names = top_of_stack = name_alloc(); temp_names = top_of_stack = name_alloc();
@ -2109,7 +2119,6 @@ char *arguments[];
temp_names->next_name = NULL; temp_names->next_name = NULL;
input_file = TRUE; input_file = TRUE;
recv_file = TRUE; recv_file = TRUE;
}
count++; count++;
} }
} }