Annotation of src/usr.bin/vim/version.c, Revision 1.1
1.1 ! downsj 1: /* $OpenBSD$ */
! 2: /* vi:set ts=4 sw=4:
! 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.0 can be found in
! 20: * "../doc/vim_40.txt".
! 21: *
! 22: * Changes between version 4.1 and 4.2:
! 23: * - Included ctags version 1.3.
! 24: * - Included xxd.c version 1.4 (only one change since 1.3m)
! 25: * - Unix: Adjusted check for child finished again. Now use != ECHILD
! 26: * instead of == EINTR.
! 27: * - Fixed: loading compressed files (with autocommands) didn't work when
! 28: * 'textmode' was previously set.
! 29: * - Fixed: When executing a shell, a window resize was not recognized for
! 30: * Unix.
! 31: * - Fixed: For GUI, when executing an external command, a window resize
! 32: * caused the buffer to be redrawn.
! 33: * - Fixed: Error message for not being able to open the .viminfo file could
! 34: * report the wrong filename.
! 35: * - MS-DOS, Win32, OS/2: When $HOME is not set, use "C:/".
! 36: * - OS/2: Improved handling of wildcards again. Didn't ignore case, didn't
! 37: * work with backslashes.
! 38: * - Fixed: ":s/pat<Tab>" could cause a core dump or other problems.
! 39: * - Fixed: When entering a hidden buffer with ":e", the BufEnter autocommands
! 40: * were not executed.
! 41: * - Fixed: Ignoring a CTRL-Z at end-of-file was only done on MS-DOS. Now it
! 42: * also works on other systems, but only in textmode.
! 43: * - Fixed: In the GUI special characters were not passed on to external
! 44: * commands, typeahead was truncated.
! 45: * - Added "gq" as an alias to "Q". Should be used when "Q" is made to be Vi
! 46: * compatible: go to Ex mode.
! 47: * - Fixed: "gu" in Visual mode could not be redone with "." correctly.
! 48: * - Fixed: ":normal" command made any typeahead executed right away, causing
! 49: * unpredictable problems.
! 50: * - Fixed: ":normal atest^[" didn't update the screen.
! 51: * - Fixed: Redoing blockwise visual delete at the end of the file could cause
! 52: * "invalid line number" errors.
! 53: * - Fixed: vim_rename() didn't open the output file in binary mode, could
! 54: * cause the .viminfo file to contain CR-LF on OS/2.
! 55: * - Fixed: OS/2 was using /tmp/xxx for temporary file name, would fail if
! 56: * there is no /tmp directory. Now use $TMP/xxx, defaulting to c:/ if $TMP
! 57: * is not set.
! 58: * - Fixed: When USE_TMPNAM was defined, was using the wrong array size for
! 59: * the viminfo temporary file.
! 60: *
! 61: * Changes between version 4.0 and 4.1:
! 62: *
! 63: * - Included xxd.c version 1.3m.
! 64: * - Included ctags version 1.2.
! 65: * - Included tools/efm_filt.er.
! 66: * - Included changes for port to Atari MiNT, including makefile.mint.
! 67: * - Included a few changes for OS/2: Improved executing external commands,
! 68: * depending on the shell; Handle resize after executing an external
! 69: * command; Handle wildcard expansion for more than one argument (e.g.
! 70: * ":n *.c *.h").
! 71: * - Include a lot of small changes to the docs.
! 72: * - Fixed: GUI version would busy-loop and mappings didn't work. Was caused
! 73: * by gui_mch_wait_for_chars() not working properly. This fix was the main
! 74: * reason for releasing 4.1.
! 75: * - Fixed: setting 'term' while GUI is active was possible, and caused
! 76: * problems.
! 77: * - Fixed: When the "to" part of a mapping or menu command was long (more
! 78: * than 24 chars on 32 bit MS-DOS, 128 chars on other systems), any <> were
! 79: * not translated and CTRL-Vs not removed.
! 80: * - Fixed: 'modified' option was included for ":mkvimrc", it shouldn't.
! 81: * - Included a few changes for that Atari MiNT port (vt52 builtin term
! 82: * entry).
! 83: * - Fixed: on MS-DOS a file name pattern for an autocommand that contains
! 84: * "\*" or "\?" didn't work.
! 85: * - On MS-DOS and Amiga, ignore case when matching the file name pattern for
! 86: * autocommands.
! 87: * - Fixed: using :set to show the value of two options gave an error message
! 88: * (e.g. ":set so sj").
! 89: * - Fixed: Non-printable characters in a file name caused trouble when
! 90: * displayed in a status line.
! 91: * - Pack the MS-DOS zip files with Infozip, under Unix. Preserves the long
! 92: * filenames and case. Files with two dots don't work though, the first dot
! 93: * is replaced with an underscore.
! 94: * - Fixed: Pasting more than one line with the mouse in insert mode, didn't
! 95: * put the cursor after the last pasted character.
! 96: * - When pasting linewise text, put the '] mark on the last character of the
! 97: * last line, instead of the first character of the last line.
! 98: * - Fixed: on some Unix systems, when resizing the window while in a external
! 99: * command (e.g., ":!cat"), Vim would stop waiting for the child, causing
! 100: * trouble, because the child is still running.
! 101: * - Fixed: resizing the window while executing an external command, and
! 102: * 't_ti' and 't_te' are defined to swap display buffers, Vim would redraw
! 103: * in the wrong display buffer after the "hit RETURN" message.
! 104: * - Fixed: "va", "vA", "Vp", "VP", "Vs" and "VS" didn't set the cursor
! 105: * position used for up/down movements (e.g., when using "j" after them).
! 106: * - Fixed: in GUI version, after using "cw" visual selection by dragging the
! 107: * mouse didn't work.
! 108: * - Fixed: setting 'ttyscroll' to 0 caused scrolling of message to stop
! 109: * working.
! 110: * - Fixed: the "WARNING: file changed" message caused buffers to be flushed
! 111: * and subsequent commands not to be executed.
! 112: * - Fixed: in Insert mode, the message from "^O^G" would be
! 113: * overwritten by the mode message if 'showmode' set.
! 114: * - Fixed: Using ":bdel" when there is only one buffer with two windows,
! 115: * could cause a crash.
! 116: * - Changed: the '<' flag in 'cpoptions' now only switches off the
! 117: * recognizing of the <> form of key codes. The 'k' flag is now used for
! 118: * the recognizing of raw key codes.
! 119: * - Fixed: Typing ':' at the --more-- prompt, when displaying autocommands,
! 120: * caused extra linefeeds to be produced.
! 121: * - Fixed: Using 'tagrelative' and ":set tags=./../tags", filenames would
! 122: * contain "../" as many times as CTRL-] would be used. These are removed
! 123: * now.
! 124: * - Fixed: Extremely long error message could cause a crash (e.g., when
! 125: * using ":help ^A<CR>").
! 126: * - Added check for negative value of 'textwidth'.
! 127: * - Fixed: On MS-DOS, getting the value of $HOME would cause the current
! 128: * directory for the drive to be changed.
! 129: */
! 130:
! 131: /*
! 132: * Version[] is copied into the swap file (max. length is 10 chars).
! 133: * longVersion[] is used for the ":version" command and "Vim -h".
! 134: * Don't forget to update the numbers in version.h for Win32!!!
! 135: */
! 136:
! 137: char *Version = "VIM 4.2";
! 138: #ifdef HAVE_DATE_TIME
! 139: char *longVersion = "VIM - Vi IMproved 4.2 (1996 June 17, compiled " __DATE__ " " __TIME__ ")";
! 140: #else
! 141: char *longVersion = "VIM - Vi IMproved 4.2 (1996 June 17)";
! 142: #endif
! 143:
! 144: static void version_msg __ARGS((char *s));
! 145:
! 146: void
! 147: do_version(arg)
! 148: char_u *arg;
! 149: {
! 150: long n;
! 151:
! 152: if (*arg != NUL)
! 153: {
! 154: found_version = getdigits(&arg) * 100;
! 155: if (*arg == '.' && isdigit(arg[1]))
! 156: {
! 157: /* "4.1" -> 401, "4.10" -> 410 */
! 158: n = arg[1] - '0';
! 159: if (isdigit(arg[2]))
! 160: found_version += (arg[2] - '0') + n * 10;
! 161: else
! 162: found_version += n;
! 163: }
! 164: if (found_version > 400)
! 165: {
! 166: MSG("Warning: Found newer version command");
! 167: if (sourcing_name != NULL)
! 168: {
! 169: MSG_OUTSTR(" in: \"");
! 170: msg_outstr(sourcing_name);
! 171: MSG_OUTSTR("\" line: ");
! 172: msg_outnum((long)sourcing_lnum);
! 173: }
! 174: }
! 175: }
! 176: else
! 177: {
! 178: msg_outchar('\n');
! 179: MSG(longVersion);
! 180: #ifdef WIN32
! 181: MSG_OUTSTR("\nWindows NT / Windows 95 version");
! 182: #endif
! 183: #ifdef MSDOS
! 184: # ifdef DJGPP
! 185: MSG_OUTSTR("\n32 bit MS-DOS version");
! 186: # else
! 187: MSG_OUTSTR("\n16 bit MS-DOS version");
! 188: # endif
! 189: #endif
! 190: MSG_OUTSTR("\nCompiled with (+) or without (-):\n");
! 191: #ifdef AMIGA /* only for Amiga systems */
! 192: # ifdef NO_ARP
! 193: version_msg("-ARP ");
! 194: # else
! 195: version_msg("+ARP ");
! 196: # endif
! 197: #endif
! 198: #ifdef AUTOCMD
! 199: version_msg("+autocmd ");
! 200: #else
! 201: version_msg("-autocmd ");
! 202: #endif
! 203: #ifdef NO_BUILTIN_TCAPS
! 204: version_msg("-builtin_terms ");
! 205: #endif
! 206: #ifdef SOME_BUILTIN_TCAPS
! 207: version_msg("+builtin_terms ");
! 208: #endif
! 209: #ifdef ALL_BUILTIN_TCAPS
! 210: version_msg("++builtin_terms ");
! 211: #endif
! 212: #ifdef CINDENT
! 213: version_msg("+cindent ");
! 214: #else
! 215: version_msg("-cindent ");
! 216: #endif
! 217: #ifdef COMPATIBLE
! 218: version_msg("+compatible ");
! 219: #else
! 220: version_msg("-compatible ");
! 221: #endif
! 222: #ifdef DEBUG
! 223: version_msg("+debug ");
! 224: #endif
! 225: #ifdef DIGRAPHS
! 226: version_msg("+digraphs ");
! 227: #else
! 228: version_msg("-digraphs ");
! 229: #endif
! 230: #ifdef EMACS_TAGS
! 231: version_msg("+emacs_tags ");
! 232: #else
! 233: version_msg("-emacs_tags ");
! 234: #endif
! 235: /* only interesting on Unix systems */
! 236: #if !defined(USE_SYSTEM) && defined(UNIX)
! 237: version_msg("+fork() ");
! 238: #endif
! 239: #ifdef UNIX
! 240: # ifdef USE_GUI_MOTIF
! 241: version_msg("+GUI_Motif ");
! 242: # else
! 243: # ifdef USE_GUI_ATHENA
! 244: version_msg("+GUI_Athena ");
! 245: # else
! 246: version_msg("-GUI ");
! 247: # endif
! 248: # endif
! 249: #endif
! 250: #ifdef INSERT_EXPAND
! 251: version_msg("+insert_expand ");
! 252: #else
! 253: version_msg("-insert_expand ");
! 254: #endif
! 255: #ifdef HAVE_LANGMAP
! 256: version_msg("+langmap ");
! 257: #else
! 258: version_msg("-langmap ");
! 259: #endif
! 260: #ifdef LISPINDENT
! 261: version_msg("+lispindent ");
! 262: #else
! 263: version_msg("-lispindent ");
! 264: #endif
! 265: #ifdef RIGHTLEFT
! 266: version_msg("+rightleft ");
! 267: #else
! 268: version_msg("-rightleft ");
! 269: #endif
! 270: #ifdef SMARTINDENT
! 271: version_msg("+smartindent ");
! 272: #else
! 273: version_msg("-smartindent ");
! 274: #endif
! 275: /* only interesting on Unix systems */
! 276: #if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
! 277: version_msg("+system() ");
! 278: #endif
! 279: #if defined(UNIX) || defined(__EMX__)
! 280: /* only unix (or OS/2 with EMX!) can have terminfo instead of termcap */
! 281: # ifdef TERMINFO
! 282: version_msg("+terminfo ");
! 283: # else
! 284: version_msg("-terminfo ");
! 285: # endif
! 286: #else /* unix always includes termcap support */
! 287: # ifdef HAVE_TGETENT
! 288: version_msg("+tgetent ");
! 289: # else
! 290: version_msg("-tgetent ");
! 291: # endif
! 292: #endif
! 293: #ifdef VIMINFO
! 294: version_msg("+viminfo ");
! 295: #else
! 296: version_msg("-viminfo ");
! 297: #endif
! 298: #ifdef WRITEBACKUP
! 299: version_msg("+writebackup ");
! 300: #else
! 301: version_msg("-writebackup ");
! 302: #endif
! 303: #ifdef UNIX
! 304: # if defined(WANT_X11) && defined(HAVE_X11)
! 305: version_msg("+X11 ");
! 306: # else
! 307: version_msg("-X11 ");
! 308: # endif
! 309: #endif
! 310: msg_outchar('\n');
! 311: #ifdef USR_VIMRC_FILE
! 312: version_msg("user vimrc file: \"");
! 313: version_msg(USR_VIMRC_FILE);
! 314: version_msg("\" ");
! 315: #endif
! 316: #ifdef USR_EXRC_FILE
! 317: version_msg("user exrc file: \"");
! 318: version_msg(USR_EXRC_FILE);
! 319: version_msg("\" ");
! 320: #endif
! 321: #ifdef USE_GUI
! 322: version_msg("user gvimrc file: \"");
! 323: version_msg(USR_GVIMRC_FILE);
! 324: version_msg("\" ");
! 325: #endif
! 326: #if defined(HAVE_CONFIG_H) || defined(OS2)
! 327: msg_outchar('\n');
! 328: version_msg("system vimrc file: \"");
! 329: version_msg((char *)sys_vimrc_fname);
! 330: version_msg("\"");
! 331: msg_outchar('\n');
! 332: version_msg("system compatrc file: \"");
! 333: version_msg((char *)sys_compatrc_fname);
! 334: version_msg("\"");
! 335: # ifdef USE_GUI
! 336: msg_outchar('\n');
! 337: version_msg("system gvimrc file: \"");
! 338: version_msg((char *)sys_gvimrc_fname);
! 339: MSG_OUTSTR("\"");
! 340: # endif
! 341: msg_outchar('\n');
! 342: version_msg("Compilation: ");
! 343: version_msg((char *)all_cflags);
! 344: #endif
! 345: }
! 346: }
! 347:
! 348: /*
! 349: * Output a string for the version message. If it's going to wrap, output a
! 350: * newline, unless the message is too long to fit on the screen anyway.
! 351: */
! 352: static void
! 353: version_msg(s)
! 354: char *s;
! 355: {
! 356: int len = strlen(s);
! 357:
! 358: if (len < (int)Columns && msg_col + len >= (int)Columns)
! 359: msg_outchar('\n');
! 360: MSG_OUTSTR(s);
! 361: }