On Sun, Nov 06, 2016 at 01:48:57PM -0500, Wayne Cuddy wrote:
>It now makes the assumption that all editors accept '--' as the option
>list terminator. Really quite annoying.
>
>This causes vile to output it's usage message.

vile should probably support this.

A proposed patch is attached.

--bod
diff --git a/main.c b/main.c
index c4c8ff9..f0ccc47 100644
--- a/main.c
+++ b/main.c
@@ -348,6 +348,7 @@ MainProgram(int argc, char *argv[])
     int tt_opened;
     BUFFER *bp;
     int carg;			/* current arg to scan */
+    int literal = FALSE;	/* force args to be interpreted as filenames */
     char *vileinit = NULL;	/* the startup file or VILEINIT var */
     int startstat = TRUE;	/* result of running startup */
     BUFFER *havebp = NULL;	/* initial buffer to read */
@@ -556,8 +557,13 @@ MainProgram(int argc, char *argv[])
 	char *param = argv[carg];
 
 	/* evaluate switches */
-	if (*param == '-') {
+	if (*param == '-' && !literal) {
 	    ++param;
+	    /* all arguments following -- are interpreted as filenames */
+	    if (!strcmp(param, "-")) {
+		literal = TRUE;
+		continue;
+	    }
 #if DISP_BORLAND || SYS_VMS
 	    /* if it's a digit, it's probably a screen
 	       resolution */
@@ -686,10 +692,9 @@ MainProgram(int argc, char *argv[])
 		default:	/* unknown switch */
 		    print_usage(GOODEXIT);
 		}
-
-	} else if (*param == '+') {	/* alternate form of -g */
+	} else if (*param == '+' && !literal) {	/* alternate form of -g */
 	    setup_command(opts_bp, GetArgVal(param));
-	} else if (*param == '@') {
+	} else if (*param == '@' && !literal) {
 	    vileinit = ++param;
 	    add_cmdarg(init_bp, "source %s\n", param);
 	} else if (*param != EOS) {
_______________________________________________
vile mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/vile

Reply via email to