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

Re: 6.0ar 'printexpr' error & segfault [patch]

Expand Messages
  • Bram Moolenaar
    ... Well, there are two problems. First of all, that default shouldn t be there. And then the code that did set the right default was in the wrong place.
    Message 1 of 2 , Aug 13, 2001
    • 0 Attachment
      Christian J. Robinson wrote:

      > The default for 'printexpr' has an error in it that causes Vim to
      > segfault, it works fine when set to what the help file claims is the
      > default.
      >
      > system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' '
      > . v:fname_in . ') . delete(v:fname_in)
      > ^^^
      > Shouldn't be there, but it probably shouldn't crash Vim either.

      Well, there are two problems. First of all, that default shouldn't be there.
      And then the code that did set the right default was in the wrong place. This
      patch will fix it:

      *** ../vim-6.0ar/src/option.c Sun Aug 12 22:34:38 2001
      --- src/option.c Mon Aug 13 11:16:35 2001
      ***************
      *** 1518,1524 ****
      {"printexpr", "pexpr", P_STRING|P_VI_DEF,
      #ifdef FEAT_POSTSCRIPT
      (char_u *)&p_pexpr, PV_NONE,
      ! {(char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in . ') . delete(v:fname_in)", (char_u *)0L}
      #else
      (char_u *)NULL, PV_NONE,
      {(char_u *)NULL, (char_u *)0L}
      --- 1518,1524 ----
      {"printexpr", "pexpr", P_STRING|P_VI_DEF,
      #ifdef FEAT_POSTSCRIPT
      (char_u *)&p_pexpr, PV_NONE,
      ! {(char_u *)"", (char_u *)0L}
      #else
      (char_u *)NULL, PV_NONE,
      {(char_u *)NULL, (char_u *)0L}
      ***************
      *** 2494,2499 ****
      --- 2494,2505 ----
      }
      #endif

      + #ifdef FEAT_POSTSCRIPT
      + /* 'printexpr' must be allocated to be able to evaluate it. */
      + set_string_default("pexpr",
      + (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in)");
      + #endif
      +
      /*
      * Set all the options (except the terminal options) to their default
      * value. Also set the global value for local options.
      ***************
      *** 2519,2530 ****
      * initialize the table for 'breakat'.
      */
      fill_breakat_flags();
      - #endif
      -
      - #ifdef FEAT_POSTSCRIPT
      - /* 'printexpr' must be allocated to be able to evaluate it. */
      - set_string_default("pexpr",
      - (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in)");
      #endif

      /*
      --- 2525,2530 ----

      --
      ARTHUR: Ni!
      BEDEVERE: Nu!
      ARTHUR: No. Ni! More like this. "Ni"!
      BEDEVERE: Ni, ni, ni!
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    Your message has been successfully submitted and would be delivered to recipients shortly.