home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / amiga / vim46src.lha / vim-4.6 / src / version.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-13  |  34.1 KB  |  744 lines

  1. /* vi:set ts=4 sw=4:
  2.  * vi:set comments=sbl\:*\ -,mb\:*,el\:*\ -,sr\:/\*,mb\:*,el\:*\/,fb\:- :
  3.  *
  4.  * VIM - Vi IMproved        by Bram Moolenaar
  5.  *
  6.  * Do ":help uganda"  in Vim to read copying and usage conditions.
  7.  * Do ":help credits" in Vim to see a list of people who contributed.
  8.  */
  9.  
  10. #include "vim.h"
  11. #include "globals.h"
  12. #include "proto.h"
  13.  
  14. /*
  15.  * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)
  16.  * It has been changed beyond recognition since then.
  17.  *
  18.  * All the remarks about older versions have been removed, they are not very
  19.  * interesting.  Differences between version 3.0 and 4.x can be found in
  20.  * "../doc/vim_40.txt".
  21.  *
  22.  * Changes between version 4.6c BETA and 4.6 RELEASE:
  23.  * - Changed "dirname" to "dname" in memline.c, to avoid a warning for Alpha.
  24.  * - Fixed: Cursor wasn't positioned correctly after ":new|r !ls", and
  25.  *   possibly with other commands.
  26.  * - A couple of changes to get rid of compiler warning messages.
  27.  *
  28.  * Changes between version 4.6b BETA and 4.6c BETA:
  29.  * - Fixed: ":.,/^$/d" would delete more than two lines, when the line under
  30.  *   the cursor is empty.
  31.  * - Fixed: In OS/2 version filtering would not work with 'shell' set to tcsh
  32.  *   or bash.
  33.  * - Fixed: b_p_si undefined when SMARTINDENT disabled.
  34.  * - When writing a new viminfo file in the same directory as the original
  35.  *   doesn't work, try creating it in a temp directory.
  36.  * - Fixed: cindenting could get into an endless loop on a line that starts
  37.  *   with a '}' and contains a set of matching braces.
  38.  * - Fixed: cinindenting didn't work correctly when a line "do {" was found.
  39.  * - Fixed: was not possible to position the cursor with an autocommand when
  40.  *   starting to edit a file.
  41.  * - Fixed: For named file marks, the short filename could be wrong.  E.g., if
  42.  *   the current directory is "/dir" and the filename starts with "/dir1".
  43.  * - Fixed: When using "./tags" in 'tags' option, use short filename when
  44.  *   possbile, avoid long filenames.
  45.  * - Fixed: Could not exit from the "--more--" prompt with ESC.
  46.  * - Fixed: When jumping to tag, could get a buffer where the filename has not
  47.  *   been expanded to a full path.
  48.  * - Atari Mint: Changed "MINT" to "__MINT__", removed -DMINT from makefile.
  49.  * - Fixed: Repeating "r<CR>" with "." didn't work correctly.
  50.  * - Fixed: When an argument like "-f" was included in 'shell', 'shellredir'
  51.  *   and 'shellpipe' would not be set correctly.
  52.  * - Included tools/pltags.pl: create tags file for Perl script.
  53.  *
  54.  * Changes between version 4.6a BETA and 4.6b BETA:
  55.  * - Fixed typo in memline.c: S_IFLINK should be S_IFLNK.
  56.  * - Changed name of tempfile for writing viminfo file, put it in the same
  57.  *   directory as the viminfo file, so it doesn't need to be copied.  Preserve
  58.  *   protection of old viminfo file.  Improved check for permission to
  59.  *   overwrite existing viminfo file.
  60.  * - Fixed: When writing viminfo, file names were expanded.  Besides taking a
  61.  *   lot of time, this caused the floppy drive to be accessed, if you had
  62.  *   previously edited a file on it.
  63.  * - Fixed: Filename expansion found an extra file if shell is "zsh".
  64.  * - Fixed: With some versions of Motif, a window resize would not redraw.
  65.  * - Fixed: ":help" gave BOTTOM-TOP warning message.
  66.  * - Fixed: Gave warning message for guessing tag search, when just ignoring
  67.  *   case while 'ignorecase' set.
  68.  * - Fixed: CTRL-B with a large count, hitting the start of the file, didn't
  69.  *   update the screen.
  70.  * - Fixed: When '$' is included in 'cpoptions', CTRL-X CTRL-F in Replace mode
  71.  *   didn't update correctly.
  72.  * - OS/2: "[" isn't supported by wildcard expansion, removed from
  73.  *   mch_has_wildcards().
  74.  * - Added 'a' and 'A' flags to 'cpoptions', included by default.  Allows
  75.  *   setting of alternate filename by ":read" and ":write" to be disabled.
  76.  * - Fixed: When 'wildchar' was set to <Esc>, and using <Esc> to complete a
  77.  *   filename, hitting <CR> next abandoned the commandline.
  78.  * - Fixed: When running out of memory, a screen resize resulted in an endless
  79.  *   loop, finally crashing Vim.
  80.  * - Fixed: "0^D" in Replace mode didn't put the character back that '0'
  81.  *   replaced.
  82.  * - Fixed: 'cindent' in Replace mode, when inserting a CR and then
  83.  *   backspacing, didn't put the correct number of characters back.
  84.  * - Fixed: ":gui" would crash when the geometry from .Xdefaults has more
  85.  *   lines than the terminal window.
  86.  * - Ignore certain lines in viminfo, allowing for future expansion.
  87.  *
  88.  * Changes between version 4.5 and 4.6a BETA:
  89.  * - Fixed: When using ":gui" with both 'exrc' and 'secure' set, it was
  90.  *   impossible to use "unsecure" commands in gvim!
  91.  * - Fixed: When moving the cursor with the mouse in Insert mode, other
  92.  *   windows on the same buffer were not updated.
  93.  * - Made Win32 version expand environment variables in file names (just like
  94.  *   MS-DOS version already did).
  95.  * - Fixed cindenting for multi-line comment in declaration (Mukhin).
  96.  * - Added support for expanding "${HOME}" type of environment variables for
  97.  *   Unix (Acevedo).  Useful for "gf" when '{' and '}' added to 'isfname'.
  98.  * - Fixed: Would sometimes do smart-indenting, even though 'smartindent'
  99.  *   isn't set.  E.g. with "2cc#".
  100.  * - Fixed: For MS-DOS-like filenames, "\$home" was interpreted as the file
  101.  *   "$home" in the root directory.  Now "\$home" means the file "$home" in
  102.  *   the current directory.
  103.  * - Fixed: File name expansion with "zsh" didn't work if there is an entry
  104.  *   without a match (e.g. when expanding the names for the swap file).
  105.  *   (Acevedo)
  106.  * - Fixed: Number of lines reported for a yank was one too few when yanking
  107.  *   characterwise (Chan).
  108.  * - MS-DOS and Win32: Improved errorformat default for MicroSoft compilers.
  109.  * - Win32: Worked around a bug in Windows NT 4.0 console handler for dead
  110.  *   keys (Reilly).
  111.  * - Fixed: When deleting the last char on a line, the ruler was not adjusted
  112.  *   from ",1" to ",0-1".
  113.  * - Fixed: When the ":version" command was not in your .vimrc, Vim would
  114.  *   report version number 4.0.
  115.  * - Upgraded cproto from version 3.7 to 4.5b (used to generate prototypes).
  116.  * - DJPGG: Use version 2.1 instead of 2.0.  Include CWSDPMI v3 instead of v1.
  117.  * - Added "ex" as an abbreviation for the 'exrc' option (some versions of vi
  118.  *   have it).
  119.  * - Unix: Made use of viminfo file more secure: umask is set to 077 (so
  120.  *   others can't read it) and owner is checked (so you don't overwrite
  121.  *   somebody else's viminfo file).
  122.  * - Win32: Fixed reported bug that on a Novell filesystem the temp files for
  123.  *   renaming are left lying around. (Reilly)
  124.  * - Fixed: When 'smarttab' and 'expandtab' on, "r<Tab>" on the first
  125.  *   non-blank in a line didn't delete that character.
  126.  * - Fixed: When 'smarttab' on and 'expandtab' off, "r<Tab>" didn't insert
  127.  *   the correct amount of blank space.
  128.  * - When 'shellpipe' is empty, don't redirect the output of ":make" into
  129.  *   'errorfile' (for programs that write to 'errorfile' directly).
  130.  * - Allow execution of ":doautocmd" while executing autocommands.
  131.  * - Fixed: Blockwise Visual mode would work on the wrong area when there is a
  132.  *   (big) difference in use of TABs in first and last line.
  133.  * - DJGPP: small changes for version 2.01.  Fixed kbhit() using BIOS function
  134.  *   instead of DOS call, was unable to use terminal on serial port.
  135.  * - Fixed getting a wrong error message when using ":b f" and there is more
  136.  *   than one match.
  137.  * - Fixed: "3[<C-I>" didn't find the same match as "3<C-W><C-I>".
  138.  * - Fixed: OS/2 version now skips directory names when expanding a file name
  139.  *   and only files are wanted.
  140.  * - Fixed: under DJGPP it was not possible to switch off the visual bell.
  141.  * - Fixed: "/[\x]" should match both '\' and 'x', not just 'x'.  In Vi only
  142.  *   ']', '^', '-' and '\' are special after a backslash.
  143.  * - Fixed: "\t" didn't work inside "[]" in regexp patterns.  Added 'l' flag
  144.  *   in 'cpoptions' to switch this off again.
  145.  * - Fixed: "imap <M-Tab>" and ":imap ~I" produced two mappings, the first
  146.  *   one didn't work.  Now any mapping in <C-M-S-key> form is translated into
  147.  *   it's 8-bit ASCII equivalent when possible, instead of using a separate
  148.  *   modifier.  Also makes things like <M-CR> work where <M-^M> worked.
  149.  * - Fixed: filename used after 'r' flag in 'viminfo' would confuse settings
  150.  *   for other flags.
  151.  * - Added 'n' flag to 'viminfo': set name for viminfo filename.
  152.  * - Fixed doc/doctags.c to avoid producing a few bogus tags.
  153.  * - Included new "macros/file_select" from Raul Segura Acevedo.
  154.  * - Fixed: screenalloc() didn't handle out-of-memory situations correctly.
  155.  * - Fixed: "10000ibug<Esc>" could not be interrupted.
  156.  * - Fixed: Emacs tags parsing didn't handle identifier names with digits and
  157.  *   non-white characters before define/typedef names.
  158.  * - Fixed: ":cn" that stays within a file, didn't set '' mark.
  159.  * - Fixed: CTRL-X commands in insert mode that showed a message and delayed
  160.  *   for two seconds now update the screen before the delay.
  161.  * - Adjusted the characters that are recognized as wildcards for OS/2.
  162.  * - When finding a swap file from Vim 3.0 (contains "VIM 3.0"), give a
  163.  *   meaningful error message.
  164.  * - Configure: Also check "/usr/X11* /include" and "/usr/X11* /lib" for Motif
  165.  *   files.
  166.  * - Fixed: Changing 'cmdheight' in an autocommand didn't work properly.
  167.  * - Set 't_ms' for GUI, can move cursor while highlighting.
  168.  * - Fixed: Comment after ":s" was executed as if it were a command.
  169.  * - Don't call mch_breakcheck() for each mapped character.  Speeds up
  170.  *   executing macros quite a bit.
  171.  * - Fixed: When using ":gui" to start the GUI, error messages caused by
  172.  *   .gvimrc were messed up.  Things like "16H" are also gone now.
  173.  * - Fixed: When trying to recover a file and wildcard expansion fails (e.g.
  174.  *   when 'shell' is invalid), could not find the swapfile.  Now try finding a
  175.  *   swapfile by simply adding ".swp" to the file name.
  176.  * - Fixed: When setting 'cmdheight' in .vimrc, messages for loading files
  177.  *   could be printed over each other.
  178.  * - Fixed: ":wall | make" wrote the "make" message after the file message.
  179.  * - Fixed: ":ri" didn't handle TABs in the middle of text correctly.
  180.  * - Fixed: "gvim +help" produced warning messages for scrollbar value.
  181.  * - Fixed: ":source" command didn't ignore a trailing CTRL-Z in textmode.
  182.  * - Changed directory separator for MS-DOS, Win32 and OS/2 to backslash,
  183.  *   because a slash sometimes gives problems (in a command name), and the
  184.  *   backslash was used in most situations already anyway.
  185.  * - Fixed: "vP" would have a wrong end pos when it is a single "}" on a line.
  186.  * - Fixed: "vim -r" in MS-DOS version would put cursor at top of screen.
  187.  *   Moved mch_windinit() down to after "full_screen = FALSE".
  188.  * - Fixed: ":/pat1//pat2/" didn't work.
  189.  * - Fixed: "/\" didn't always work (problem with trailing backslash).
  190.  * - Added a warning message for when a command from a tags file changes a
  191.  *   buffer (this is a security leak!).
  192.  * - Added 'd' flag to 'cpoptions': Using "./tags" in 'tags' option uses tags
  193.  *   file in current directory, instead of relative to current file.
  194.  * - Fixed: Executing the command from a tags file was not done with 'magic'
  195.  *   off.  Removed checking the search pattern, to make this Vi compatible.
  196.  *   The program generating the tags file should only escape backslash
  197.  *   characters and '/'.  Fixed doctags.c to use "*" instead of "\*".
  198.  * - Fixed: 'cindent' was wrong for skipping from an "else" to the matching
  199.  *   "if", when inside {}.
  200.  * - Fixed: ":sp file" was setting '" mark for current buffer.
  201.  * - Fixed: ":sh" doesn't need to wait for return when finished.
  202.  * - Fixed: ":r file" didn't set alternate filename.
  203.  * - Fixed: Redo of "a)<Esc>" would stay in insert mode when 'showmatch' set
  204.  *   and there is no match.  Don't flush input when there is no match.
  205.  * - Makefile for Unix didn't recompile when version.h was changed.
  206.  *
  207.  * Changes between version 4.4 BETA and 4.5:
  208.  * - Ignore CR in line from tags file, also when there is no search command.
  209.  * - Fixed small cindent problem, when using 'cino' with non-zero after '}'.
  210.  * - Corrected error message for security violation for tag file commands.
  211.  * - Fixed bug: When 'shell' set to "sh", "!echo text >x<Tab>" would create
  212.  *   the file "x*".  Now completion of file names starts after a ">", "<" and
  213.  *   following "&" and "!" characters.
  214.  * - Added a few more changes for QNX.
  215.  * - Fixed: when 'showmode' was not set, CTRL-X submode (error) messages would
  216.  *   not be shown correctly.
  217.  * - MSDOS: Fixed computation of mouse area again, didn't work for 50 lines
  218.  *   screen.
  219.  * - Fixed: Cursor was not positioned after ":move" command.
  220.  * - Fixed a few compiler warnings for Athena on Sun OS 5.2.
  221.  * - Added 'w' flag to 'cpoptions', to fix vi incompatibility for "cw" on a
  222.  *   row of blanks.
  223.  * - Fixed making a core dump on certain signals.
  224.  * - Fixed check for Sun OS 4.x.x for xxd.c.
  225.  * - Fixed problem with expanding two-character directory names for Win32
  226.  *   version.
  227.  * - Fixed: highlight mode for completion sub-messages was always 'r', now it
  228.  *   depends on the type of message: 'e' for errors, 'w' for warnings.
  229.  * - Fixed: 'cindentkeys' were not checked when inserting text from a mapping.
  230.  * - Fixed: a ":global" that requires input, could not be broken with CTRL-C.
  231.  * - Fixed: "1H" and "1L" were off by one line.
  232.  * - Included version 1.5 of ctags.
  233.  * Last minute fixes:
  234.  * - Fixed: When using ^X^C in insert mode and then entering insert mode
  235.  *   again, the ^X mode message is shown when it shouldn't.
  236.  * - Fixed: In GUI, when reading the output from an external command, there
  237.  *   was no check for an error, which could result in an endless loop.
  238.  * - Small correction in src/ctags/ctags.c for MS-DOS.
  239.  * - Fixed for Unix: Would never detect a triple signal.
  240.  * - Removed ":mfstat" command, it's for debugging only.
  241.  *
  242.  * Changes between version 4.3 BETA and 4.4 BETA:
  243.  * - Moved outputting newline from getout() to mch_windexit().  Helps when
  244.  *   switching display pages in xterm after an error message for ":!".
  245.  * - Fixed problem: Not executing BufEnter autocommands for first buffer.
  246.  * - Fixed Makefile: "make shadow" didn't make ctags and xxd directories.  Now
  247.  *   passes CC and CFLAGS to ctags and xxd makefiles.
  248.  * - Removed use of #elif, some old compilers don't understand it.
  249.  * - Included version 1.4 of ctags.  New Makefile.bcc, supports wildcards for
  250.  *   16 bit DOS version.
  251.  * - Fixed mouse positioning in wrong column for MSDOS 16 and 32 bit versions.
  252.  * - Fixed: Delay in updating Visual area when using "/pat".
  253.  * - Fixed: With some shells gvim could be killed with CTRL-C in the shell
  254.  *   where it was started.
  255.  * - Fixed: For abbreviations entered with ":noreab" only the first two
  256.  *   characters were not re-mapped instead of all.
  257.  * - Added help tags for search pattern special characters.  Adjusted
  258.  *   doctags.c to insert a backslash before a backslash.
  259.  * - Fixed Vi incompatibility: If the rhs of a mapping starts with the lhs,
  260.  *   remapping is only disabled for the first character, not the whole lhs.
  261.  * - Fixed: Default padding character was a space, which caused trouble on
  262.  *   some systems.  Now it's a NUL.
  263.  * - Fixed: With GUI Athena the scrollbar could get stuck at the bottom.
  264.  * - Fixed: When using :imenu to insert more than one line of text, only the
  265.  *   first line could be undone.
  266.  * - Fixed: Word completion (CTRL-N) in Insert mode, when there was no
  267.  *   matching word, the "Pattern not found" message was not shown.
  268.  * - Fixed: Pattern completion (CTRL-X I) in Insert mode; the file name shown
  269.  *   was overwritten with the mode message.
  270.  * - Added ":if" and ":endif" commands.  Everything in between them is
  271.  *   ingored.  Just to allow for future expansion that is backwards compatible.
  272.  * - Fixed: Starting Vim without a file, then ":e file", ":sp" and ":q"
  273.  *   unloaded the buffer.
  274.  * - Fixed: execution of autocommands could not be interrupted.
  275.  * - Fixed: "ga" on an empty line gave a misleading message, now it prints
  276.  *   "empty line".
  277.  * - Fixed: With 'number' set mouse positioning was wrong when lines wrap, and
  278.  *   in the GUI horizontal scrolling didn't work properly.
  279.  * - Removed "src/tags" from the source distribution; you can generate it
  280.  *   yourself now that ctags is included.
  281.  * - Included "macros/life", macros to run Conway's game of life.
  282.  * - Fixed using "set go=r" in gvimrc problem for Motif GUI.
  283.  * - Fixed problems when using autocommands with ":next" et. al..  Made
  284.  *   "line1", "line2" and "forceit" local variables, instead of global.  Lots
  285.  *   of function have to pass it as an argument, which is required to avoid
  286.  *   the vars to get mixed up with recursive Ex commands.
  287.  * - Removed the use of "want_start" in search.c.  Fixes bug when using a
  288.  *   search string that starts with "^" and contains "\|".
  289.  *
  290.  * Changes between version 4.2 and 4.3 BETA:
  291.  * - Moved ctags, tee and xxd sources from the binary to the source archive.
  292.  * - OS/2: Adjusted ExpandWildCards again, fixed alloc/free error.
  293.  * - Fixed: "Nothing in register ^@", ^@ for buffer 0 is now ""
  294.  * - Fixed: Was outputting CR CR LF instead of CR LF for termios.
  295.  * - Fixed: cindent didn't handle "} else" and "} while (cond);".
  296.  * - Fixed: Was using killpg(0, SIGINT) to interrupt external commands in the
  297.  *   GUI, which isn't documented on all systems.  Use kill(0, SIGINT) instead.
  298.  * - Updated version number that is compared with for the ":version" command.
  299.  * - Fixed: ":0put" inserted text below line 1; now it inserts above line 1.
  300.  * - Fixed: "/t/e" would not find the last character in a line.
  301.  * - Fixed: Unloading the current buffer could load another unloaded buffer.
  302.  *   Use a loaded buffer if there is one.
  303.  * - Improved: ":dis" now shows "^J" at the end of linewise registers.
  304.  * - Fixed: Using ":q" to close a window didn't execute the BufEnter
  305.  *   autocommands for the new current window.
  306.  * - Forbid the reading of a file after *ReadPre autocommands, this could give
  307.  *   unpredictable results.
  308.  * - Fixed: ":sball" didn't work correctly with autocommands that contain a
  309.  *   ":normal" command.
  310.  * - Fixed: was accepting a mapping after CTRL-W count.
  311.  * - Fixed: a '[' in a regexp was special, made "/[z[]/" fail.
  312.  * - Amiga, DICE: included a few patches to amiga.c.
  313.  * - Fixed: Could crash when completing a setting, e.g. ":set <t_K<Tab>"
  314.  * - Fixed: Using "new fname" in a vimrc caused a window with a non-existing
  315.  *   buffer.
  316.  * - Added support for keypad keys <kHome>, <kEnd>, <kPageUp> and <kPageDown>.
  317.  *   They only work when they send a different code from <Home>, etc..
  318.  * - Swapped the arguments to LINKIT in Makefile, was making a link from Vim,
  319.  *   instead of to Vim.
  320.  * - Fixed: Not all parts of the swap file were cleared before using them,
  321.  *   could include any data in the swap file (mostly the password file!).
  322.  * - Fixed: Could get an extra swap file when using ":au BufLeave xx bd xx".
  323.  * - Fixed: ":set comment=n:" didn't give an error message; formatting would
  324.  *   cause a hang.
  325.  * - Use off_t for lseek; FreeBSD and others use long long instead of long.
  326.  * - Fixed: ":/pat" didn't match at first column in the next line.
  327.  * - Fixed: CTRL-F at end of file with 'scrolloff' non-zero would make the
  328.  *   screen jump up and down and didn't beep when no more scrolling was
  329.  *   possible.  When last two lines didn't fit on the screen together, the
  330.  *   last one was never shown.
  331.  * - When Vim is not compiled with AUTOCMD, "<afile>" is not included.
  332.  * - Fixed: ":au BufWritePre xx bunload" caused empty file to be written, now
  333.  *   it gives an error message.
  334.  * - Added "<Bar>", to be used in mappings where a '|' is needed.
  335.  * - Moved "Changing readonly file" message, In insert mode, to after the mode
  336.  *   message, it would otherwise be hidden.
  337.  * - Fixed: Putting a temp file in current directory for MS-DOS causes
  338.  *   problems on readonly devices.  Try several directories to put the temp
  339.  *   file in.
  340.  * - Changed default for Unix 'errorformat' to include a few more compilers.
  341.  * - Fixed: When exiting because of a non-existing file after the "-e"
  342.  *   argument, there was no newline.
  343.  * - When writing part of a buffer to a file, don't add a end-of-line for the
  344.  *   last line, if 'binary' is set and the previous read didn't have an
  345.  *   end-of-line for the same line.  For FileWritePre autocommands that filter
  346.  *   the lines through gzip.
  347.  * - Fixed: When not writing the eol for the last line, this was not visible,
  348.  *   and the line count was one too low.
  349.  * - Fixed: BufNewFile autocommands that do ":r file" sometimes didn't work,
  350.  *   because the cursor was in an invalid line.
  351.  * - Fixed: a *ReadFile autocommand that changed the file to be read didn't
  352.  *   work, because the file was already opened.
  353.  * - Fixed: When doing ":bdel", buf_copy_options() could copy options from
  354.  *   already freed memory.  Would cause any combination of strange settings.
  355.  * - Check for errors while reading the viminfo file.  When there are more
  356.  *   than 10 errors, quit reading it.  When there is any error, don't
  357.  *   overwrite it with a new viminfo file.  Prevents trashing a file when
  358.  *   accidently doing "vim -i file" instead of "vim -v file".
  359.  * - Added "ZQ", alias for ":q!".  Elvis compatible.
  360.  * - Fixed: "vim -g" would crash when .gvimrc contains ":set go=r".
  361.  * - Fixed: ":set go&" didn't work, the default contained an illegal 'A'.
  362.  * - Added 'titlelen' option: percentage of 'columns' to use for the title.
  363.  *   Reduces problems with truncating long path names.
  364.  * - Added "tee" for OS/2.  Very useful for ":make".
  365.  * - Fixed: Setting 'title' in the gvimrc messed up the title of the xterm
  366.  *   where Vim was started when doing ":gui".
  367.  * - Fixed: When expanding "~/file" with CTRL-X CTRL-F in insert mode, the
  368.  *   "~/" would get expanded into a full path.  For "~user/file" the problem
  369.  *   still exists though.
  370.  * - Fixed: ":set path=../b" didn't work as expected, any path starting with a
  371.  *   dot would get expanded to the directory of the current file.
  372.  * - Fixed: Any dir name in 'directory' and 'backupdir' starting with '.' was
  373.  *   considered to be in the current directory, also "..".  Now using "./dir"
  374.  *   means using a directory relative to where the file is.
  375.  * - Fixed: ":all", ":ball" and "-o" command line option would execute
  376.  *   Buf/Win Enter/Leave autocommands for first buffer a few times.  Now
  377.  *   they are only done when really entering a buffer/window.
  378.  * - Fixed: ":all", change in first buffer, ":all" would give an error message
  379.  *   for not writing the file.
  380.  * - Added 'shellcmdflag' and 'shellquote' options, mainly for Win32 when
  381.  *   using different kinds of shell.
  382.  * - Fixed: "unmenu *" in .gvimrc caused a crash on some machines.
  383.  * - Fixed: ":buf" (go to current buffer) should not do anything.  It executed
  384.  *   autocommands and set the previous context mark.
  385.  * - Fixed: "*``" moved the cursor back to the start of the word, instead of
  386.  *   where the cursor was within or before the word.
  387.  * - Fixed: ":e %:p:h" removed the head of the path ("/" for unix, "d:\\" for
  388.  *   DOS, "drive:" for Amiga.
  389.  * - Fixed: for the Win32 version, 'term' must be "win32", don't init it with
  390.  *   $TERM.
  391.  * - Fixed: Filename completion with <Tab>, when there are several matches,
  392.  *   but only one without ignored suffix, next <Tab> obtained second match,
  393.  *   not the one after the previous one.  Now the files without matching
  394.  *   suffix are put in front of the list.
  395.  * - Fixed: DJGPP version of system() was eating file descriptors, after a few
  396.  *   filter commands there would be an "Out of file handles" error.
  397.  * - Fixed: for MS-DOS: ":n doc\*.txt" didn't work, it became "doc*.txt".
  398.  * - Added: MS-DOS and WIN32 now expand $ENV in a filename. ":e $VIM/_vimrc"
  399.  *   works now.
  400.  * - Fixed: MS-DOS: after ":mode 1" mouse didn't move correctly.  Now it
  401.  *   mostly works for the display modes up to 0x13.
  402.  * - Fixed: In Insert mode, the message from  "^O:set tw" would be overwritten
  403.  *   by "--INSERT--".  Now there is a 10 second delay to be able to read the
  404.  *   message.
  405.  *
  406.  * Changes between version 4.1 and 4.2:
  407.  * - Included ctags version 1.3.
  408.  * - Included xxd.c version 1.4 (only one change since 1.3m)
  409.  * - Unix: Adjusted check for child finished again.  Now use != ECHILD
  410.  *   instead of == EINTR.
  411.  * - Fixed: loading compressed files (with autocommands) didn't work when
  412.  *   'textmode' was previously set.
  413.  * - Fixed: When executing a shell, a window resize was not recognized for
  414.  *   Unix.
  415.  * - Fixed: For GUI, when executing an external command, a window resize
  416.  *   caused the buffer to be redrawn.
  417.  * - Fixed: Error message for not being able to open the .viminfo file could
  418.  *   report the wrong filename.
  419.  * - MS-DOS, Win32, OS/2: When $HOME is not set, use "C:/".
  420.  * - OS/2: Improved handling of wildcards again.  Didn't ignore case, didn't
  421.  *   work with backslashes.
  422.  * - Fixed: ":s/pat<Tab>" could cause a core dump or other problems.
  423.  * - Fixed: When entering a hidden buffer with ":e", the BufEnter autocommands
  424.  *   were not executed.
  425.  * - Fixed: Ignoring a CTRL-Z at end-of-file was only done on MS-DOS.  Now it
  426.  *   also works on other systems, but only in textmode.
  427.  * - Fixed: In the GUI special characters were not passed on to external
  428.  *   commands, typeahead was truncated.
  429.  * - Added "gq" as an alias to "Q".  Should be used when "Q" is made to be Vi
  430.  *   compatible: go to Ex mode.
  431.  * - Fixed: "gu" in Visual mode could not be redone with "." correctly.
  432.  * - Fixed: ":normal" command made any typeahead executed right away, causing
  433.  *   unpredictable problems.
  434.  * - Fixed: ":normal atest^[" didn't update the screen.
  435.  * - Fixed: Redoing blockwise visual delete at the end of the file could cause
  436.  *   "invalid line number" errors.
  437.  * - Fixed: vim_rename() didn't open the output file in binary mode, could
  438.  *   cause the .viminfo file to contain CR-LF on OS/2.
  439.  * - Fixed: OS/2 was using /tmp/xxx for temporary file name, would fail if
  440.  *   there is no /tmp directory.  Now use $TMP/xxx, defaulting to c:/ if $TMP
  441.  *   is not set.
  442.  * - Fixed: When USE_TMPNAM was defined, was using the wrong array size for
  443.  *   the viminfo temporary file.
  444.  *
  445.  * Changes between version 4.0 and 4.1:
  446.  *
  447.  * - Included xxd.c version 1.3m.
  448.  * - Included ctags version 1.2.
  449.  * - Included tools/efm_filt.er.
  450.  * - Included changes for port to Atari MiNT, including makefile.mint.
  451.  * - Included a few changes for OS/2: Improved executing external commands,
  452.  *   depending on the shell; Handle resize after executing an external
  453.  *   command; Handle wildcard expansion for more than one argument (e.g.
  454.  *   ":n *.c *.h").
  455.  * - Include a lot of small changes to the docs.
  456.  * - Fixed: GUI version would busy-loop and mappings didn't work.  Was caused
  457.  *   by gui_mch_wait_for_chars() not working properly.  This fix was the main
  458.  *   reason for releasing 4.1.
  459.  * - Fixed: setting 'term' while GUI is active was possible, and caused
  460.  *   problems.
  461.  * - Fixed: When the "to" part of a mapping or menu command was long (more
  462.  *   than 24 chars on 32 bit MS-DOS, 128 chars on other systems), any <> were
  463.  *   not translated and CTRL-Vs not removed.
  464.  * - Fixed: 'modified' option was included for ":mkvimrc", it shouldn't.
  465.  * - Included a few changes for that Atari MiNT port (vt52 builtin term
  466.  *   entry).
  467.  * - Fixed: on MS-DOS a file name pattern for an autocommand that contains
  468.  *   "\*" or "\?" didn't work.
  469.  * - On MS-DOS and Amiga, ignore case when matching the file name pattern for
  470.  *   autocommands.
  471.  * - Fixed: using :set to show the value of two options gave an error message
  472.  *   (e.g. ":set so sj").
  473.  * - Fixed: Non-printable characters in a file name caused trouble when
  474.  *   displayed in a status line.
  475.  * - Pack the MS-DOS zip files with Infozip, under Unix.  Preserves the long
  476.  *   filenames and case.  Files with two dots don't work though, the first dot
  477.  *   is replaced with an underscore.
  478.  * - Fixed: Pasting more than one line with the mouse in insert mode, didn't
  479.  *   put the cursor after the last pasted character.
  480.  * - When pasting linewise text, put the '] mark on the last character of the
  481.  *   last line, instead of the first character of the last line.
  482.  * - Fixed: on some Unix systems, when resizing the window while in a external
  483.  *   command (e.g., ":!cat"), Vim would stop waiting for the child, causing
  484.  *   trouble, because the child is still running.
  485.  * - Fixed: resizing the window while executing an external command, and
  486.  *   't_ti' and 't_te' are defined to swap display buffers, Vim would redraw
  487.  *   in the wrong display buffer after the "hit RETURN" message.
  488.  * - Fixed: "va", "vA", "Vp", "VP", "Vs" and "VS" didn't set the cursor
  489.  *   position used for up/down movements (e.g., when using "j" after them).
  490.  * - Fixed: in GUI version, after using "cw" visual selection by dragging the
  491.  *   mouse didn't work.
  492.  * - Fixed: setting 'ttyscroll' to 0 caused scrolling of message to stop
  493.  *   working.
  494.  * - Fixed: the "WARNING: file changed" message caused buffers to be flushed
  495.  *   and subsequent commands not to be executed.
  496.  * - Fixed: in Insert mode, the message from "^O^G" would be
  497.  *   overwritten by the mode message if 'showmode' set.
  498.  * - Fixed: Using ":bdel" when there is only one buffer with two windows,
  499.  *   could cause a crash.
  500.  * - Changed: the '<' flag in 'cpoptions' now only switches off the
  501.  *   recognizing of the <> form of key codes.  The 'k' flag is now used for
  502.  *   the recognizing of raw key codes.
  503.  * - Fixed: Typing ':' at the --more-- prompt, when displaying autocommands,
  504.  *   caused extra linefeeds to be produced.
  505.  * - Fixed: Using 'tagrelative' and ":set tags=./../tags", filenames would
  506.  *   contain "../" as many times as CTRL-] would be used.  These are removed
  507.  *   now.
  508.  * - Fixed: Extremely long error message could cause a crash (e.g., when
  509.  *   using ":help ^A<CR>").
  510.  * - Added check for negative value of 'textwidth'.
  511.  * - Fixed: On MS-DOS, getting the value of $HOME would cause the current
  512.  *   directory for the drive to be changed.
  513.  */
  514.  
  515. /*
  516.  * Version[] is copied into the swap file (max. length is 6 chars).
  517.  * longVersion[] is used for the ":version" command and "Vim -h".
  518.  * Don't forget to update the numbers in version.h for Win32!!!
  519.  */
  520.  
  521. #include "version.h"
  522.  
  523. char           *Version = "4.6";
  524. #ifdef HAVE_DATE_TIME
  525. char           *longVersion = "VIM - Vi IMproved 4.6 (1997 Mar 13, compiled " __DATE__ " " __TIME__ ")";
  526. #else
  527. char           *longVersion = "VIM - Vi IMproved 4.6 (1997 Mar 13)";
  528. #endif
  529.  
  530. static void version_msg __ARGS((char *s));
  531.  
  532.     void
  533. do_version(arg)
  534.     char_u    *arg;
  535. {
  536.     long        n;
  537.  
  538.     if (*arg != NUL)
  539.     {
  540.         found_version = getdigits(&arg) * 100;
  541.         if (*arg == '.' && isdigit(arg[1]))
  542.         {
  543.             /* "4.1"  -> 401, "4.10" -> 410 */
  544.             n = arg[1] - '0';
  545.             if (isdigit(arg[2]))
  546.                 found_version += (arg[2] - '0') + n * 10;
  547.             else
  548.                 found_version += n;
  549.         }
  550.         if (found_version > VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR)
  551.         {
  552.             MSG("Warning: Found newer version command");
  553.             if (sourcing_name != NULL)
  554.             {
  555.                 MSG_OUTSTR(" in: \"");
  556.                 msg_outstr(sourcing_name);
  557.                 MSG_OUTSTR("\" line: ");
  558.                 msg_outnum((long)sourcing_lnum);
  559.             }
  560.         }
  561.     }
  562.     else
  563.     {
  564.         msg_outchar('\n');
  565.         MSG(longVersion);
  566. #ifdef WIN32
  567.         MSG_OUTSTR("\nWindows NT / Windows 95 version");
  568. #endif
  569. #ifdef MSDOS
  570. # ifdef DJGPP
  571.         MSG_OUTSTR("\n32 bit MS-DOS version");
  572. # else
  573.         MSG_OUTSTR("\n16 bit MS-DOS version");
  574. # endif
  575. #endif
  576.         MSG_OUTSTR("\nCompiled with (+) or without (-):\n");
  577. #ifdef AMIGA            /* only for Amiga systems */
  578. # ifdef NO_ARP
  579.         version_msg("-ARP ");
  580. # else
  581.         version_msg("+ARP ");
  582. # endif
  583. #endif
  584. #ifdef AUTOCMD
  585.         version_msg("+autocmd ");
  586. #else
  587.         version_msg("-autocmd ");
  588. #endif
  589. #ifdef NO_BUILTIN_TCAPS
  590.         version_msg("-builtin_terms ");
  591. #endif
  592. #ifdef SOME_BUILTIN_TCAPS
  593.         version_msg("+builtin_terms ");
  594. #endif
  595. #ifdef ALL_BUILTIN_TCAPS
  596.         version_msg("++builtin_terms ");
  597. #endif
  598. #ifdef CINDENT
  599.         version_msg("+cindent ");
  600. #else
  601.         version_msg("-cindent ");
  602. #endif
  603. #ifdef COMPATIBLE
  604.         version_msg("+compatible ");
  605. #else
  606.         version_msg("-compatible ");
  607. #endif
  608. #ifdef DEBUG
  609.         version_msg("+debug ");
  610. #endif
  611. #ifdef DIGRAPHS
  612.         version_msg("+digraphs ");
  613. #else
  614.         version_msg("-digraphs ");
  615. #endif
  616. #ifdef EMACS_TAGS
  617.         version_msg("+emacs_tags ");
  618. #else
  619.         version_msg("-emacs_tags ");
  620. #endif
  621.             /* only interesting on Unix systems */
  622. #if !defined(USE_SYSTEM) && defined(UNIX)
  623.         version_msg("+fork() ");
  624. #endif
  625. #ifdef UNIX
  626. # ifdef USE_GUI_MOTIF
  627.         version_msg("+GUI_Motif ");
  628. # else
  629. #  ifdef USE_GUI_ATHENA
  630.         version_msg("+GUI_Athena ");
  631. #  else
  632.         version_msg("-GUI ");
  633. #  endif
  634. # endif
  635. #endif
  636. #ifdef INSERT_EXPAND
  637.         version_msg("+insert_expand ");
  638. #else
  639.         version_msg("-insert_expand ");
  640. #endif
  641. #ifdef HAVE_LANGMAP
  642.         version_msg("+langmap ");
  643. #else
  644.         version_msg("-langmap ");
  645. #endif
  646. #ifdef LISPINDENT
  647.         version_msg("+lispindent ");
  648. #else
  649.         version_msg("-lispindent ");
  650. #endif
  651. #ifdef RIGHTLEFT
  652.         version_msg("+rightleft ");
  653. #else
  654.         version_msg("-rightleft ");
  655. #endif
  656. #ifdef SMARTINDENT
  657.         version_msg("+smartindent ");
  658. #else
  659.         version_msg("-smartindent ");
  660. #endif
  661.             /* only interesting on Unix systems */
  662. #if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
  663.         version_msg("+system() ");
  664. #endif
  665. #if defined(UNIX) || defined(__EMX__)
  666. /* only unix (or OS/2 with EMX!) can have terminfo instead of termcap */
  667. # ifdef TERMINFO
  668.         version_msg("+terminfo ");
  669. # else
  670.         version_msg("-terminfo ");
  671. # endif
  672. #else                /* unix always includes termcap support */
  673. # ifdef HAVE_TGETENT
  674.         version_msg("+tgetent ");
  675. # else
  676.         version_msg("-tgetent ");
  677. # endif
  678. #endif
  679. #ifdef VIMINFO
  680.         version_msg("+viminfo ");
  681. #else
  682.         version_msg("-viminfo ");
  683. #endif
  684. #ifdef WRITEBACKUP
  685.         version_msg("+writebackup ");
  686. #else
  687.         version_msg("-writebackup ");
  688. #endif
  689. #ifdef UNIX
  690. # if defined(WANT_X11) && defined(HAVE_X11)
  691.         version_msg("+X11 ");
  692. # else
  693.         version_msg("-X11 ");
  694. # endif
  695. #endif
  696.         msg_outchar('\n');
  697. #ifdef USR_VIMRC_FILE
  698.         version_msg("user vimrc file: \"");
  699.         version_msg(USR_VIMRC_FILE);
  700.         version_msg("\" ");
  701. #endif
  702. #ifdef USR_EXRC_FILE
  703.         version_msg("user exrc file: \"");
  704.         version_msg(USR_EXRC_FILE);
  705.         version_msg("\" ");
  706. #endif
  707. #ifdef USE_GUI
  708.         version_msg("user gvimrc file: \"");
  709.         version_msg(USR_GVIMRC_FILE);
  710.         version_msg("\" ");
  711. #endif
  712. #if defined(HAVE_CONFIG_H) || defined(OS2)
  713.         msg_outchar('\n');
  714.         version_msg("system vimrc file: \"");
  715.         version_msg((char *)sys_vimrc_fname);
  716.         version_msg("\"");
  717. # ifdef USE_GUI
  718.         msg_outchar('\n');
  719.         version_msg("system gvimrc file: \"");
  720.         version_msg((char *)sys_gvimrc_fname);
  721.         MSG_OUTSTR("\"");
  722. # endif
  723.         msg_outchar('\n');
  724.         version_msg("Compilation: ");
  725.         version_msg((char *)all_cflags);
  726. #endif
  727.     }
  728. }
  729.  
  730. /*
  731.  * Output a string for the version message.  If it's going to wrap, output a
  732.  * newline, unless the message is too long to fit on the screen anyway.
  733.  */
  734.     static void
  735. version_msg(s)
  736.     char        *s;
  737. {
  738.     int        len = strlen(s);
  739.  
  740.     if (len < (int)Columns && msg_col + len >= (int)Columns)
  741.         msg_outchar('\n');
  742.     MSG_OUTSTR(s);
  743. }
  744.