Loading ...
Sorry, an error occurred while loading the content.

g?vim.bat quietly lose arguments

Expand Messages
  • Walter Briscoe
    gvim.bat and vim.bat call gvim and vim respectively with 0 to 9 arguments. They seem to be new since 6.0d. I am unable to find any history on them. You ve
    Message 1 of 5 , Jan 31, 2001
    • 0 Attachment
      gvim.bat and vim.bat call gvim and vim respectively with 0 to 9
      arguments. They seem to be new since 6.0d. I am unable to find any
      history on them. You've guessed it. I want to call vim with more than 9
      arguments.

      (I have a script vgfind.bat which is a port of a UNIX script I wrote
      called vgfind. vgfind is called with two arguments - a string to be
      grepped and a wild card file specification. It identifies files
      containing the grepped string and opens $VISUAL on those strings.
      vgfind.bat is a horrible cludge which does a similar job. Win9X limits
      command lines to ~ 500 bytes. This is usually more than 9 files where
      there is a wide match.)

      I can obviously work around the problem by putting *vim.exe in the
      folder containing *vim.bat. That does not solve the general problem. If
      directed, I should be able to alter dosinst.c once a concept change is
      agreed.

      P.S. I regularly hit the limit when a DLL responds to a right click in
      windows on a set of files. I have not bothered to diagnose what is going
      on as my main usage is through the command line. How fixed is the limit?
      --
      Walter Briscoe
    • Craig Barkhouse
      Well I don t have those batch files handy (I assume the install program creates them, and I ve never used the install program). By your description, I m
      Message 2 of 5 , Jan 31, 2001
      • 0 Attachment
        Well I don't have those batch files handy (I assume the install program creates them, and I've never used the install program). By your description, I'm guessing they do something like this:
        vim.exe %1 %2 %3 %4 %5 %6 % %8 %9
        If you're on NT (cmd.exe), try changing it to this:
        vim.exe %*

        That might not work on 9x (command.com). You might have to contruct an environment variable to hold the args, e.g.
        @echo off
        set VIMARGS=
        :firstarg
        if .%1==. goto start
        set VIMARGS=%VIMARGS% %1
        shift
        goto firstarg
        :start
        vim %VIMARGS%
        set VIMARGS=


        ----- Original Message -----
        From: "Walter Briscoe" <wbriscoe@...>
        To: <vim-dev@...>
        Sent: Wednesday, January 31, 2001 10:33 AM
        Subject: g?vim.bat quietly lose arguments


        > gvim.bat and vim.bat call gvim and vim respectively with 0 to 9
        > arguments. They seem to be new since 6.0d. I am unable to find any
        > history on them. You've guessed it. I want to call vim with more than 9
        > arguments.
        >
        > (I have a script vgfind.bat which is a port of a UNIX script I wrote
        > called vgfind. vgfind is called with two arguments - a string to be
        > grepped and a wild card file specification. It identifies files
        > containing the grepped string and opens $VISUAL on those strings.
        > vgfind.bat is a horrible cludge which does a similar job. Win9X limits
        > command lines to ~ 500 bytes. This is usually more than 9 files where
        > there is a wide match.)
        >
        > I can obviously work around the problem by putting *vim.exe in the
        > folder containing *vim.bat. That does not solve the general problem. If
        > directed, I should be able to alter dosinst.c once a concept change is
        > agreed.
        >
        > P.S. I regularly hit the limit when a DLL responds to a right click in
        > windows on a set of files. I have not bothered to diagnose what is going
        > on as my main usage is through the command line. How fixed is the limit?
        > --
        > Walter Briscoe
        >
      • Bram Moolenaar
        ... Right. ... But it should work on MS-DOS too. That s why a batch script is used. ... Appears to work fine for me. If this works on NT too, then I ll make
        Message 3 of 5 , Jan 31, 2001
        • 0 Attachment
          Craig Barkhouse wrote:

          > Well I don't have those batch files handy (I assume the install program
          > creates them, and I've never used the install program). By your
          > description, I'm guessing they do something like this:
          > vim.exe %1 %2 %3 %4 %5 %6 % %8 %9

          Right.

          > If you're on NT (cmd.exe), try changing it to this:
          > vim.exe %*

          But it should work on MS-DOS too. That's why a batch script is used.

          > That might not work on 9x (command.com). You might have to contruct an
          > environment variable to hold the args, e.g.
          > @echo off
          > set VIMARGS=
          > :firstarg
          > if .%1==. goto start
          > set VIMARGS=%VIMARGS% %1
          > shift
          > goto firstarg
          > :start
          > vim %VIMARGS%
          > set VIMARGS=

          Appears to work fine for me. If this works on NT too, then I'll make the
          install program generate this.

          Thanks Craig, you just solved another item from the todo list.

          --
          From "know your smileys":
          C=}>;*{)) Drunk, devilish chef with a toupee in an updraft,
          a mustache, and a double chin

          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
          ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
          \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
        • J. David Boyd
          ... MS-DOS only supports 9 batch variables directly. Then you have to start using the SHIFT command, like in the script. Dave
          Message 4 of 5 , Jan 31, 2001
          • 0 Attachment
            ----- Original Message ----- >
            > But it should work on MS-DOS too. That's why a batch script is used.
            >

            MS-DOS only supports 9 batch variables directly. Then you have to start
            using the SHIFT command, like in the script.

            Dave
          • Walter Briscoe
            In article of Wed, 31 Jan 2001 15:34:23 in !vim-dev, J. David Boyd writes ... I have
            Message 5 of 5 , Feb 1, 2001
            • 0 Attachment
              In article <001b01c08bc5$32e10600$3800a8c0@...> of Wed, 31
              Jan 2001 15:34:23 in !vim-dev, J. David Boyd <dave@...> writes
              >
              >----- Original Message ----- >
              >> But it should work on MS-DOS too. That's why a batch script is used.
              >>
              >
              >MS-DOS only supports 9 batch variables directly. Then you have to start
              >using the SHIFT command, like in the script.
              >
              >Dave
              >

              I have tested the file from which the enclosed diff was made
              *** dosinst.!c Sat Jan 06 17:41:52 2001
              --- dosinst.c Thu Feb 01 16:39:58 2001
              ***************
              *** 559,564 ****
              --- 559,624 ----
              }

              /*
              + * On input **destination is the path of an executable.
              + * If that executable is in the current directory, look for another one.
              + * *destination is set to NULL or the location of that file.
              + */
              +
              + static void
              + findoldfile(char **destination)
              + {
              + char *exename;
              + char *bp = *destination;
              + size_t indir_l = strlen(installdir);
              + char *cp = bp + indir_l;
              + char *tmpname;
              + char *farname;
              +
              + /*
              + * No action needed if exe not found or not in this directory.
              + */
              + if (bp == NULL
              + || strnicmp(bp, installdir, indir_l) != 0
              + || strchr("/\\", *cp++) == NULL
              + || strchr(cp, '\\') != NULL
              + || strchr(cp, '/') != NULL)
              + return;
              +
              + exename = alloc(strlen(cp)+1);
              + strcpy(exename, cp);
              + tmpname = alloc(strlen(cp)+sizeof(".tmp"));
              + strcpy(tmpname, cp), strcat(tmpname, ".tmp");
              +
              + if (access(tmpname, 0) == 0)
              + {
              + printf("\nERROR: %s and %s clash. remove/move so only %s exists\n",
              + tmpname, exename, exename);
              + exit(1);
              + }
              +
              + if (rename(exename, tmpname) != 0)
              + {
              + printf("\nERROR: failed to rename %s to %s: %s\n",
              + exename, tmpname, strerror(errno));
              + exit(1);
              + }
              +
              + farname = searchpath_save(exename);
              +
              + if (rename(tmpname, exename) != 0)
              + {
              + printf("\nERROR: failed to rename %s back to %s: %s\n",
              + tmpname, exename, strerror(errno));
              + exit(1);
              + }
              +
              + free(*destination);
              + free(exename);
              + free(tmpname);
              + *destination = farname;
              + }
              +
              + /*
              * Find out information about the system.
              */
              static void
              ***************
              *** 605,610 ****
              --- 665,679 ----
              oldvimexe = searchpath_save("vim.exe");
              oldgvimexe = searchpath_save("gvim.exe");
              mch_chdir(installdir);
              +
              + /*
              + * The technique used above to set oldvimexe and oldgvimexe
              + * gives a spurious result for Windows 2000 Professional.
              + * w.briscoe@... 2001-01-20
              + */
              + findoldfile(&oldvimexe);
              + findoldfile(&oldgvimexe);
              +
              if (oldvimexe != NULL || oldgvimexe != NULL)
              {
              printf("Warning: Found a Vim executable in your $PATH:\n");
              ***************
              *** 796,808 ****
              * contains a space. The quotes would be included in the value
              * for MSDOS. */
              fprintf(fd, "set VIM=%s\n", buf);
              !
              ! strcpy(buf, installdir);
              ! add_pathsep(buf);
              ! strcat(buf, exename);
              ! /* Can only handle 9 arguments now. Use "shift" to use more? */
              ! fprintf(fd, "%s %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9\n", buf);
              !
              fclose(fd);
              printf("%s has been %s\n", batname,
              oldname == NULL ? "created" : "overwritten");
              --- 865,879 ----
              * contains a space. The quotes would be included in the value
              * for MSDOS. */
              fprintf(fd, "set VIM=%s\n", buf);
              ! fprintf(fd, "set VIMARGS=\n");
              ! fprintf(fd, ":arg\n");
              ! fprintf(fd, "if .%%1==. goto start\n");
              ! fprintf(fd, "set VIMARGS=%%VIMARGS%% %%1\n");
              ! fprintf(fd, "shift\n");
              ! fprintf(fd, "goto arg\n");
              ! fprintf(fd, ":start\n");
              ! fprintf(fd, "%%VIM%%VIM60T\\%s %%VIMARGS%%\n", exename);
              ! fprintf(fd, "set VIMARGS=\n");
              fclose(fd);
              printf("%s has been %s\n", batname,
              oldname == NULL ? "created" : "overwritten");


              --
              Walter Briscoe
            Your message has been successfully submitted and would be delivered to recipients shortly.