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

Patch 6.1.311 (extra)

Expand Messages
  • Bram Moolenaar
    Patch 6.1.311 (extra) Problem: VMS: path in window title doesn t include necessary separator. file version doesn t always work properly with Unix. Crashes
    Message 1 of 1 , Jan 29, 2003
      Patch 6.1.311 (extra)
      Problem: VMS: path in window title doesn't include necessary separator.
      file version doesn't always work properly with Unix.
      Crashes because of memory overwrite in GUI.
      Didn't always handle files with lowercase and correct path.
      Solution: Fix the problems. Remove unnessary file name translations.
      (Zoltan Arpadffy)
      Files: src/buffer.c, src/ex_cmds2.c, src/fileio.c, src/memline.c,
      src/misc1.c, src/misc2.c, src/os_unix.c, src/os_vms.c, src/tag.c


      *** ../vim61.310/src/buffer.c Fri Jan 10 10:04:44 2003
      --- src/buffer.c Fri Jan 24 22:34:57 2003
      ***************
      *** 2712,2717 ****
      --- 2712,2721 ----
      {
      while (p > buf + off + 1 && vim_ispathsep(p[-1]))
      --p;
      + #ifdef VMS
      + /* path separator is part of the path */
      + ++p;
      + #endif
      *p = NUL;
      }
      /* translate unprintable chars */
      *** ../vim61.310/src/ex_cmds2.c Sun Jan 5 22:14:46 2003
      --- src/ex_cmds2.c Mon Jan 27 23:01:33 2003
      ***************
      *** 1716,1724 ****
      if (p_verbose > 2)
      smsg((char_u *)_("Searching for \"%s\""), (char *)buf);
      /* Expand wildcards and source each match. */
      - #ifdef VMS
      - strcpy((char *)buf, vms_fixfilename(buf));
      - #endif

      if (gen_expand_wildcards(1, &buf, &num_files, &files,
      EW_FILE) == OK)
      --- 1722,1727 ----
      *** ../vim61.310/src/fileio.c Sun Jan 19 19:54:41 2003
      --- src/fileio.c Fri Jan 24 22:43:49 2003
      ***************
      *** 2333,2341 ****
      #if defined(UNIX) || defined(__EMX__XX) /*XXX fix me sometime? */
      int made_writable = FALSE; /* 'w' bit has been set */
      #endif
      - #ifdef VMS
      - char_u nfname[MAXPATHL];
      - #endif
      /* writing everything */
      int whole = (start == 1 && end == buf->b_ml.ml_line_count);
      #ifdef FEAT_AUTOCMD
      --- 2333,2338 ----
      ***************
      *** 3184,3192 ****
      #endif

      #ifdef VMS
      ! STRCPY(nfname, fname);
      ! vms_remove_version(nfname); /* remove version */
      ! fname = nfname;
      #endif
      /* Default: write the the file directly. May write to a temp file for
      * multi-byte conversion. */
      --- 3181,3187 ----
      #endif

      #ifdef VMS
      ! vms_remove_version(fname); /* remove version */
      #endif
      /* Default: write the the file directly. May write to a temp file for
      * multi-byte conversion. */
      ***************
      *** 3722,3735 ****
      lnum -= start; /* compute number of written lines */
      --no_wait_return; /* may wait for return now */

      ! #ifndef UNIX
      ! # ifdef VMS
      ! STRCPY(nfname, sfname);
      ! vms_remove_version(nfname); /* remove version */
      ! fname = nfname;
      ! # else
      fname = sfname; /* use shortname now, for the messages */
      - # endif
      #endif
      if (!filtering)
      {
      --- 3717,3724 ----
      lnum -= start; /* compute number of written lines */
      --no_wait_return; /* may wait for return now */

      ! #if !(defined(UNIX) || defined(VMS))
      fname = sfname; /* use shortname now, for the messages */
      #endif
      if (!filtering)
      {
      ***************
      *** 4799,4805 ****
      STRCPY(retval, fname);
      #ifdef VMS
      vms_remove_version(retval); /* we do not need versions here */
      - fnamelen = STRLEN(retval); /* it can be shorter*/
      #endif
      }

      --- 4788,4793 ----
      *** ../vim61.310/src/memline.c Sun Jan 19 16:53:13 2003
      --- src/memline.c Fri Jan 24 22:46:19 2003
      ***************
      *** 900,924 ****
      }

      home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, TRUE);
      ! smsg((char_u *)_("Using swap file \"%s\""),
      ! #ifdef VMS
      ! vms_fixfilename(NameBuff)
      ! #else
      ! NameBuff
      ! #endif
      ! );

      if (buf_spname(curbuf) != NULL)
      STRCPY(NameBuff, buf_spname(curbuf));
      else
      home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
      ! smsg((char_u *)_("Original file \"%s\""),
      ! #ifdef VMS
      ! vms_fixfilename(NameBuff)
      ! #else
      ! NameBuff
      ! #endif
      ! );
      msg_putchar('\n');

      /*
      --- 900,912 ----
      }

      home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, TRUE);
      ! smsg((char_u *)_("Using swap file \"%s\""), NameBuff);

      if (buf_spname(curbuf) != NULL)
      STRCPY(NameBuff, buf_spname(curbuf));
      else
      home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
      ! smsg((char_u *)_("Original file \"%s\""), NameBuff);
      msg_putchar('\n');

      /*
      ***************
      *** 1512,1524 ****
      if (b0.b0_fname[0] == NUL)
      MSG_PUTS(_("[No File]"));
      else
      ! msg_outtrans(
      ! #ifdef VMS
      ! vms_fixfilename(b0.b0_fname)
      ! #else
      ! b0.b0_fname
      ! #endif
      ! );

      MSG_PUTS(_("\n modified: "));
      MSG_PUTS(b0.b0_dirty ? _("YES") : _("no"));
      --- 1500,1506 ----
      if (b0.b0_fname[0] == NUL)
      MSG_PUTS(_("[No File]"));
      else
      ! msg_outtrans(b0.b0_fname);

      MSG_PUTS(_("\n modified: "));
      MSG_PUTS(b0.b0_dirty ? _("YES") : _("no"));
      *** ../vim61.310/src/misc1.c Sun Oct 13 20:08:14 2002
      --- src/misc1.c Fri Jan 24 22:47:00 2003
      ***************
      *** 6443,6451 ****
      ffname = FullName_save((*file)[i], FALSE);
      if (ffname == NULL) /* out of memory */
      break;
      - #ifdef VMS
      - vms_remove_version(ffname);
      - #endif
      if (match_file_list(p_wig, (*file)[i], ffname))
      {
      /* remove this matching file from the list */
      --- 6443,6448 ----
      *** ../vim61.310/src/misc2.c Sun Oct 13 20:08:14 2002
      --- src/misc2.c Fri Jan 24 22:47:27 2003
      ***************
      *** 4883,4892 ****
      file_name = NULL;
      goto theend;
      }
      - #ifdef VMS
      - if (vim_isAbsName(file_to_find))
      - file_to_find = vms_fixfilename(file_to_find);
      - #endif
      }

      rel_to_curdir = (file_to_find[0] == '.'
      --- 4883,4888 ----
      *** ../vim61.310/src/os_unix.c Mon Sep 23 21:19:48 2002
      --- src/os_unix.c Mon Jan 27 20:09:54 2003
      ***************
      *** 1970,1975 ****
      --- 1974,1983 ----
      char_u *p;
      int retval = OK;

      + #ifdef VMS
      + fname = vms_fixfilename(fname);
      + #endif
      +
      /* expand it if forced or not an absolute path */
      if (force || !mch_isFullName(fname))
      {
      ***************
      *** 2088,2098 ****
      if (retval == FAIL || STRLEN(buf) + STRLEN(fname) >= len)
      return FAIL;

      - #ifdef VMS
      - STRCAT(buf, vms_fixfilename(fname));
      - #else
      STRCAT(buf, fname);
      - #endif

      return OK;
      }
      --- 2096,2102 ----
      ***************
      *** 2108,2116 ****
      return _fnisabs(fname);
      #else
      # ifdef VMS
      ! return ( fname[0] == '/' || fname[0] == '.' || strchr((char *)fname, ':') ||
      ! strchr((char *)fname,'[') || strchr((char *)fname,']') ||
      ! strchr((char *)fname,'<') || strchr((char *)fname,'>') );
      # else
      return (*fname == '/' || *fname == '~');
      # endif
      --- 2112,2121 ----
      return _fnisabs(fname);
      #else
      # ifdef VMS
      ! return ( fname[0] == '/' || fname[0] == '.' ||
      ! strchr((char *)fname,':') || strchr((char *)fname,'"') ||
      ! (strchr((char *)fname,'[') && strchr((char *)fname,']'))||
      ! (strchr((char *)fname,'<') && strchr((char *)fname,'>')) );
      # else
      return (*fname == '/' || *fname == '~');
      # endif
      ***************
      *** 2127,2133 ****
      {
      struct stat statb;

      ! if (stat((char *)name, &statb))
      return -1;
      return statb.st_mode;
      }
      --- 2132,2144 ----
      {
      struct stat statb;

      ! if (stat((char *)
      ! #ifdef VMS
      ! vms_fixfilename(name),
      ! #else
      ! name,
      ! #endif
      ! &statb))
      return -1;
      return statb.st_mode;
      }
      ***************
      *** 2142,2148 ****
      char_u *name;
      long perm;
      {
      ! return (chmod((char *)name, (mode_t)perm) == 0 ? OK : FAIL);
      }

      #if defined(HAVE_ACL) || defined(PROTO)
      --- 2153,2165 ----
      char_u *name;
      long perm;
      {
      ! return (chmod((char *)
      ! #ifdef VMS
      ! vms_fixfilename(name),
      ! #else
      ! name,
      ! #endif
      ! (mode_t)perm) == 0 ? OK : FAIL);
      }

      #if defined(HAVE_ACL) || defined(PROTO)
      *** ../vim61.310/src/os_vms.c Mon Aug 27 17:29:41 2001
      --- src/os_vms.c Fri Jan 24 23:00:25 2003
      ***************
      *** 368,377 ****
      *
      */
      static int
      ! vms_wproc( char *name )
      {
      - char xname[MAXPATHL];
      int i;

      if (vms_match_num == 0) {
      /* first time through, setup some things */
      --- 368,380 ----
      *
      */
      static int
      ! vms_wproc(char *name, int val)
      {
      int i;
      + int nlen;
      +
      + if (val != DECC$K_FILE) /* Directories and foreing non VMS files are not counting */
      + return 1;

      if (vms_match_num == 0) {
      /* first time through, setup some things */
      ***************
      *** 388,399 ****
      }
      }

      ! strcpy(xname,vms_fixfilename(name));
      ! vms_remove_version(xname);

      /* if name already exists, don't add it */
      for (i = 0; i<vms_match_num; i++) {
      ! if (0 == STRCMP((char_u *)xname,vms_fmatch[i]))
      return 1;
      }
      if (--vms_match_free == 0) {
      --- 391,406 ----
      }
      }

      ! vms_remove_version(name);
      !
      ! /* convert filename to lowercase */
      ! nlen = strlen(name);
      ! for (i = 0; i < nlen; i++)
      ! name[i] = TOLOWER_ASC(name[i]);

      /* if name already exists, don't add it */
      for (i = 0; i<vms_match_num; i++) {
      ! if (0 == STRCMP((char_u *)name,vms_fmatch[i]))
      return 1;
      }
      if (--vms_match_free == 0) {
      ***************
      *** 405,423 ****
      return 0;
      vms_match_free = EXPL_ALLOC_INC;
      }
      ! #ifdef APPEND_DIR_SLASH
      ! if (type == DECC$K_DIRECTORY) {
      ! STRCAT(xname,"/");
      ! vms_fmatch[vms_match_num] = vim_strsave((char_u *)xname);
      ! }
      ! else {
      ! vms_fmatch[vms_match_num] =
      ! vim_strsave((char_u *)xname);
      ! }
      ! #else
      ! vms_fmatch[vms_match_num] =
      ! vim_strsave((char_u *)xname);
      ! #endif
      ++vms_match_num;
      return 1;
      }
      --- 412,419 ----
      return 0;
      vms_match_free = EXPL_ALLOC_INC;
      }
      ! vms_fmatch[vms_match_num] = vim_strsave((char_u *)name);
      !
      ++vms_match_num;
      return 1;
      }
      ***************
      *** 462,468 ****
      STRCPY(buf,pat[i]);

      vms_match_num = 0; /* reset collection counter */
      ! cnt = decc$from_vms( vms_fixfilename(buf), vms_wproc, 1);
      if (cnt > 0)
      cnt = vms_match_num;

      --- 458,465 ----
      STRCPY(buf,pat[i]);

      vms_match_num = 0; /* reset collection counter */
      ! cnt = decc$to_vms(decc$translate_vms(vms_fixfilename(buf)), vms_wproc, 1, 0);
      ! /* allow wild, no dir */
      if (cnt > 0)
      cnt = vms_match_num;

      ***************
      *** 506,512 ****
      char *cp;
      vms_match_num = 0;

      ! cnt = decc$from_vms(vms_fixfilename(path), vms_wproc, 1 );
      if (cnt > 0)
      cnt = vms_match_num;
      for (i = 0; i < cnt; i++)
      --- 503,510 ----
      char *cp;
      vms_match_num = 0;

      ! cnt = decc$to_vms(decc$translate_vms(vms_fixfilename(path)), vms_wproc, 1, 0);
      ! /* allow wild, no dir */
      if (cnt > 0)
      cnt = vms_match_num;
      for (i = 0; i < cnt; i++)
      ***************
      *** 620,626 ****
      }

      /*
      ! * change '/' to '.' (or ']' for the last one)
      */
      void *
      vms_fixfilename(void *instring)
      --- 618,624 ----
      }

      /*
      ! * change unix and mixed filenames to VMS
      */
      void *
      vms_fixfilename(void *instring)
      ***************
      *** 646,665 ****
      strcpy(tmpbuf, instring);
      #endif

      - /* if this already is a vms file specification, copy it
      - * else if VMS understands how to translate the file spec, let it do so
      - * else translate mixed unix-vms file specs to pure vms
      - */
      -
      Fspec_Rms = buf; /* for decc$to_vms */
      ! if (strchr(instring,'/') == NULL)
      ! strcpy(buf, instring); /* already a vms file spec */
      ! else if (strchr(instring,'"') == NULL){ /* regular file */
      ! if (decc$to_vms(instring, vms_fspec_proc, 0, 0) <= 0)
      vms_unix_mixed_filespec(instring, buf);
      }
      else
      ! vms_unix_mixed_filespec(instring, buf); /* we have a passwd in the path */

      return buf;
      }
      --- 644,665 ----
      strcpy(tmpbuf, instring);
      #endif

      Fspec_Rms = buf; /* for decc$to_vms */
      !
      ! if ( strchr(instring,'/') == NULL )
      ! /* It is already a VMS file spec */
      ! strcpy(buf, instring);
      ! else if ( strchr(instring,'"') == NULL ){ /* password in the path ? */
      ! /* Seems it is a regular file, let guess that it is pure Unix fspec */
      ! if ( decc$to_vms(instring, vms_fspec_proc, 0, 0) <= 0 )
      ! /* No... it must be mixed */
      vms_unix_mixed_filespec(instring, buf);
      }
      else
      ! /* we have a password in the path */
      ! /* decc$ functions can not handle */
      ! /* this is our only hope to resolv */
      ! vms_unix_mixed_filespec(instring, buf);

      return buf;
      }
      ***************
      *** 672,680 ****
      vms_remove_version(void * fname)
      {
      char_u *cp;

      if ((cp = vim_strchr( fname, ';')) != NULL) /* remove version */
      *cp = '\0';
      ! vms_fixfilename(fname);
      return fname;
      }
      --- 672,691 ----
      vms_remove_version(void * fname)
      {
      char_u *cp;
      + char_u *fp;

      if ((cp = vim_strchr( fname, ';')) != NULL) /* remove version */
      *cp = '\0';
      ! else if ((cp = vim_strrchr( fname, '.')) != NULL )
      ! {
      ! if ((fp = vim_strrchr( fname, ']')) != NULL ) {;}
      ! else if ((fp = vim_strrchr( fname, '>')) != NULL ) {;}
      ! else fp = fname;
      !
      ! while ( *fp != '\0' && fp < cp )
      ! if ( *fp++ == '.' )
      ! *cp = '\0';
      ! }
      !
      return fname;
      }
      *** ../vim61.310/src/tag.c Sat Sep 7 15:05:56 2002
      --- src/tag.c Fri Jan 24 23:00:46 2003
      ***************
      *** 2744,2752 ****
      retval = vim_strsave(fname);

      vim_free(expanded_fname);
      ! #ifdef VMS
      ! retval = vms_fixfilename(retval);
      ! #endif
      return retval;
      }

      --- 2744,2750 ----
      retval = vim_strsave(fname);

      vim_free(expanded_fname);
      !
      return retval;
      }

      *** ../vim61.310/src/version.c Wed Jan 29 10:14:44 2003
      --- src/version.c Wed Jan 29 21:51:45 2003
      ***************
      *** 608,609 ****
      --- 608,611 ----
      { /* Add new patch number below this line */
      + /**/
      + 311,
      /**/

      --
      From "know your smileys":
      :-) Funny
      |-) Funny Oriental
      (-: Funny Australian

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.