xref: /vim-8.2.3635/src/version.c (revision f4cd3e80)
1 /* vi:set ts=8 sts=4 sw=4:
2  *
3  * VIM - Vi IMproved		by Bram Moolenaar
4  *
5  * Do ":help uganda"  in Vim to read copying and usage conditions.
6  * Do ":help credits" in Vim to see a list of people who contributed.
7  * See README.txt for an overview of the Vim source code.
8  */
9 
10 #include "vim.h"
11 
12 #ifdef AMIGA
13 # include <time.h>	/* for time() */
14 #endif
15 
16 /*
17  * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)
18  * It has been changed beyond recognition since then.
19  *
20  * Differences between version 6.x and 7.x can be found with ":help version7".
21  * Differences between version 5.x and 6.x can be found with ":help version6".
22  * Differences between version 4.x and 5.x can be found with ":help version5".
23  * Differences between version 3.0 and 4.x can be found with ":help version4".
24  * All the remarks about older versions have been removed, they are not very
25  * interesting.
26  */
27 
28 #include "version.h"
29 
30 char		*Version = VIM_VERSION_SHORT;
31 static char	*mediumVersion = VIM_VERSION_MEDIUM;
32 
33 #if defined(HAVE_DATE_TIME) || defined(PROTO)
34 # if (defined(VMS) && defined(VAXC)) || defined(PROTO)
35 char	longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)
36 						      + sizeof(__TIME__) + 3];
37     void
38 make_version()
39 {
40     /*
41      * Construct the long version string.  Necessary because
42      * VAX C can't catenate strings in the preprocessor.
43      */
44     strcpy(longVersion, VIM_VERSION_LONG_DATE);
45     strcat(longVersion, __DATE__);
46     strcat(longVersion, " ");
47     strcat(longVersion, __TIME__);
48     strcat(longVersion, ")");
49 }
50 # else
51 char	*longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")";
52 # endif
53 #else
54 char	*longVersion = VIM_VERSION_LONG;
55 #endif
56 
57 static void version_msg __ARGS((char *s));
58 
59 static char *(features[]) =
60 {
61 #ifdef AMIGA		/* only for Amiga systems */
62 # ifdef FEAT_ARP
63 	"+ARP",
64 # else
65 	"-ARP",
66 # endif
67 #endif
68 #ifdef FEAT_ARABIC
69 	"+arabic",
70 #else
71 	"-arabic",
72 #endif
73 #ifdef FEAT_AUTOCMD
74 	"+autocmd",
75 #else
76 	"-autocmd",
77 #endif
78 #ifdef FEAT_BEVAL
79 	"+balloon_eval",
80 #else
81 	"-balloon_eval",
82 #endif
83 #ifdef FEAT_BROWSE
84 	"+browse",
85 #else
86 	"-browse",
87 #endif
88 #ifdef NO_BUILTIN_TCAPS
89 	"-builtin_terms",
90 #endif
91 #ifdef SOME_BUILTIN_TCAPS
92 	"+builtin_terms",
93 #endif
94 #ifdef ALL_BUILTIN_TCAPS
95 	"++builtin_terms",
96 #endif
97 #ifdef FEAT_BYTEOFF
98 	"+byte_offset",
99 #else
100 	"-byte_offset",
101 #endif
102 #ifdef FEAT_CINDENT
103 	"+cindent",
104 #else
105 	"-cindent",
106 #endif
107 #ifdef FEAT_CLIENTSERVER
108 	"+clientserver",
109 #else
110 	"-clientserver",
111 #endif
112 #ifdef FEAT_CLIPBOARD
113 	"+clipboard",
114 #else
115 	"-clipboard",
116 #endif
117 #ifdef FEAT_CMDL_COMPL
118 	"+cmdline_compl",
119 #else
120 	"-cmdline_compl",
121 #endif
122 #ifdef FEAT_CMDHIST
123 	"+cmdline_hist",
124 #else
125 	"-cmdline_hist",
126 #endif
127 #ifdef FEAT_CMDL_INFO
128 	"+cmdline_info",
129 #else
130 	"-cmdline_info",
131 #endif
132 #ifdef FEAT_COMMENTS
133 	"+comments",
134 #else
135 	"-comments",
136 #endif
137 #ifdef FEAT_CRYPT
138 	"+cryptv",
139 #else
140 	"-cryptv",
141 #endif
142 #ifdef FEAT_CSCOPE
143 	"+cscope",
144 #else
145 	"-cscope",
146 #endif
147 #if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
148 	"+dialog_con_gui",
149 #else
150 # if defined(FEAT_CON_DIALOG)
151 	"+dialog_con",
152 # else
153 #  if defined(FEAT_GUI_DIALOG)
154 	"+dialog_gui",
155 #  else
156 	"-dialog",
157 #  endif
158 # endif
159 #endif
160 #ifdef FEAT_DIFF
161 	"+diff",
162 #else
163 	"-diff",
164 #endif
165 #ifdef FEAT_DIGRAPHS
166 	"+digraphs",
167 #else
168 	"-digraphs",
169 #endif
170 #ifdef FEAT_DND
171 	"+dnd",
172 #else
173 	"-dnd",
174 #endif
175 #ifdef EBCDIC
176 	"+ebcdic",
177 #else
178 	"-ebcdic",
179 #endif
180 #ifdef FEAT_EMACS_TAGS
181 	"+emacs_tags",
182 #else
183 	"-emacs_tags",
184 #endif
185 #ifdef FEAT_EVAL
186 	"+eval",
187 #else
188 	"-eval",
189 #endif
190 #ifdef FEAT_EX_EXTRA
191 	"+ex_extra",
192 #else
193 	"-ex_extra",
194 #endif
195 #ifdef FEAT_SEARCH_EXTRA
196 	"+extra_search",
197 #else
198 	"-extra_search",
199 #endif
200 #ifdef FEAT_FKMAP
201 	"+farsi",
202 #else
203 	"-farsi",
204 #endif
205 #ifdef FEAT_SEARCHPATH
206 	"+file_in_path",
207 #else
208 	"-file_in_path",
209 #endif
210 #ifdef FEAT_FIND_ID
211 	"+find_in_path",
212 #else
213 	"-find_in_path",
214 #endif
215 #ifdef FEAT_FOLDING
216 	"+folding",
217 #else
218 	"-folding",
219 #endif
220 #ifdef FEAT_FOOTER
221 	"+footer",
222 #else
223 	"-footer",
224 #endif
225 	    /* only interesting on Unix systems */
226 #if !defined(USE_SYSTEM) && defined(UNIX)
227 	"+fork()",
228 #endif
229 #ifdef FEAT_GETTEXT
230 # ifdef DYNAMIC_GETTEXT
231 	"+gettext/dyn",
232 # else
233 	"+gettext",
234 # endif
235 #else
236 	"-gettext",
237 #endif
238 #ifdef FEAT_HANGULIN
239 	"+hangul_input",
240 #else
241 	"-hangul_input",
242 #endif
243 #if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
244 # ifdef DYNAMIC_ICONV
245 	"+iconv/dyn",
246 # else
247 	"+iconv",
248 # endif
249 #else
250 	"-iconv",
251 #endif
252 #ifdef FEAT_INS_EXPAND
253 	"+insert_expand",
254 #else
255 	"-insert_expand",
256 #endif
257 #ifdef FEAT_JUMPLIST
258 	"+jumplist",
259 #else
260 	"-jumplist",
261 #endif
262 #ifdef FEAT_KEYMAP
263 	"+keymap",
264 #else
265 	"-keymap",
266 #endif
267 #ifdef FEAT_LANGMAP
268 	"+langmap",
269 #else
270 	"-langmap",
271 #endif
272 #ifdef FEAT_LIBCALL
273 	"+libcall",
274 #else
275 	"-libcall",
276 #endif
277 #ifdef FEAT_LINEBREAK
278 	"+linebreak",
279 #else
280 	"-linebreak",
281 #endif
282 #ifdef FEAT_LISP
283 	"+lispindent",
284 #else
285 	"-lispindent",
286 #endif
287 #ifdef FEAT_LISTCMDS
288 	"+listcmds",
289 #else
290 	"-listcmds",
291 #endif
292 #ifdef FEAT_LOCALMAP
293 	"+localmap",
294 #else
295 	"-localmap",
296 #endif
297 #ifdef FEAT_MENU
298 	"+menu",
299 #else
300 	"-menu",
301 #endif
302 #ifdef FEAT_SESSION
303 	"+mksession",
304 #else
305 	"-mksession",
306 #endif
307 #ifdef FEAT_MODIFY_FNAME
308 	"+modify_fname",
309 #else
310 	"-modify_fname",
311 #endif
312 #ifdef FEAT_MOUSE
313 	"+mouse",
314 #  ifdef FEAT_MOUSESHAPE
315 	"+mouseshape",
316 #  else
317 	"-mouseshape",
318 #  endif
319 # else
320 	"-mouse",
321 #endif
322 #if defined(UNIX) || defined(VMS)
323 # ifdef FEAT_MOUSE_DEC
324 	"+mouse_dec",
325 # else
326 	"-mouse_dec",
327 # endif
328 # ifdef FEAT_MOUSE_GPM
329 	"+mouse_gpm",
330 # else
331 	"-mouse_gpm",
332 # endif
333 # ifdef FEAT_MOUSE_JSB
334 	"+mouse_jsbterm",
335 # else
336 	"-mouse_jsbterm",
337 # endif
338 # ifdef FEAT_MOUSE_NET
339 	"+mouse_netterm",
340 # else
341 	"-mouse_netterm",
342 # endif
343 # ifdef FEAT_MOUSE_XTERM
344 	"+mouse_xterm",
345 # else
346 	"-mouse_xterm",
347 # endif
348 #endif
349 #ifdef __QNX__
350 # ifdef FEAT_MOUSE_PTERM
351 	"+mouse_pterm",
352 # else
353 	"-mouse_pterm",
354 # endif
355 #endif
356 #ifdef FEAT_MBYTE_IME
357 # ifdef DYNAMIC_IME
358 	"+multi_byte_ime/dyn",
359 # else
360 	"+multi_byte_ime",
361 # endif
362 #else
363 # ifdef FEAT_MBYTE
364 	"+multi_byte",
365 # else
366 	"-multi_byte",
367 # endif
368 #endif
369 #ifdef FEAT_MULTI_LANG
370 	"+multi_lang",
371 #else
372 	"-multi_lang",
373 #endif
374 #ifdef FEAT_MZSCHEME
375 # ifdef DYNAMIC_MZSCHEME
376 	"+mzscheme/dyn",
377 # else
378 	"+mzscheme",
379 # endif
380 #else
381 	"-mzscheme",
382 #endif
383 #ifdef FEAT_NETBEANS_INTG
384 	"+netbeans_intg",
385 #else
386 	"-netbeans_intg",
387 #endif
388 #ifdef FEAT_GUI_W32
389 # ifdef FEAT_OLE
390 	"+ole",
391 # else
392 	"-ole",
393 # endif
394 #endif
395 #ifdef FEAT_OSFILETYPE
396 	"+osfiletype",
397 #else
398 	"-osfiletype",
399 #endif
400 #ifdef FEAT_PATH_EXTRA
401 	"+path_extra",
402 #else
403 	"-path_extra",
404 #endif
405 #ifdef FEAT_PERL
406 # ifdef DYNAMIC_PERL
407 	"+perl/dyn",
408 # else
409 	"+perl",
410 # endif
411 #else
412 	"-perl",
413 #endif
414 #ifdef FEAT_PRINTER
415 # ifdef FEAT_POSTSCRIPT
416 	"+postscript",
417 # else
418 	"-postscript",
419 # endif
420 	"+printer",
421 #else
422 	"-printer",
423 #endif
424 #ifdef FEAT_PROFILE
425 	"+profile",
426 #else
427 	"-profile",
428 #endif
429 #ifdef FEAT_PYTHON
430 # ifdef DYNAMIC_PYTHON
431 	"+python/dyn",
432 # else
433 	"+python",
434 # endif
435 #else
436 	"-python",
437 #endif
438 #ifdef FEAT_QUICKFIX
439 	"+quickfix",
440 #else
441 	"-quickfix",
442 #endif
443 #ifdef FEAT_RIGHTLEFT
444 	"+rightleft",
445 #else
446 	"-rightleft",
447 #endif
448 #ifdef FEAT_RUBY
449 # ifdef DYNAMIC_RUBY
450 	"+ruby/dyn",
451 # else
452 	"+ruby",
453 # endif
454 #else
455 	"-ruby",
456 #endif
457 #ifdef FEAT_SCROLLBIND
458 	"+scrollbind",
459 #else
460 	"-scrollbind",
461 #endif
462 #ifdef FEAT_SIGNS
463 	"+signs",
464 #else
465 	"-signs",
466 #endif
467 #ifdef FEAT_SMARTINDENT
468 	"+smartindent",
469 #else
470 	"-smartindent",
471 #endif
472 #ifdef FEAT_SNIFF
473 	"+sniff",
474 #else
475 	"-sniff",
476 #endif
477 #ifdef FEAT_STL_OPT
478 	"+statusline",
479 #else
480 	"-statusline",
481 #endif
482 #ifdef FEAT_SUN_WORKSHOP
483 	"+sun_workshop",
484 #else
485 	"-sun_workshop",
486 #endif
487 #ifdef FEAT_SYN_HL
488 	"+syntax",
489 #else
490 	"-syntax",
491 #endif
492 	    /* only interesting on Unix systems */
493 #if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
494 	"+system()",
495 #endif
496 #ifdef FEAT_TAG_BINS
497 	"+tag_binary",
498 #else
499 	"-tag_binary",
500 #endif
501 #ifdef FEAT_TAG_OLDSTATIC
502 	"+tag_old_static",
503 #else
504 	"-tag_old_static",
505 #endif
506 #ifdef FEAT_TAG_ANYWHITE
507 	"+tag_any_white",
508 #else
509 	"-tag_any_white",
510 #endif
511 #ifdef FEAT_TCL
512 # ifdef DYNAMIC_TCL
513 	"+tcl/dyn",
514 # else
515 	"+tcl",
516 # endif
517 #else
518 	"-tcl",
519 #endif
520 #if defined(UNIX) || defined(__EMX__)
521 /* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */
522 # ifdef TERMINFO
523 	"+terminfo",
524 # else
525 	"-terminfo",
526 # endif
527 #else		    /* unix always includes termcap support */
528 # ifdef HAVE_TGETENT
529 	"+tgetent",
530 # else
531 	"-tgetent",
532 # endif
533 #endif
534 #ifdef FEAT_TERMRESPONSE
535 	"+termresponse",
536 #else
537 	"-termresponse",
538 #endif
539 #ifdef FEAT_TEXTOBJ
540 	"+textobjects",
541 #else
542 	"-textobjects",
543 #endif
544 #ifdef FEAT_TITLE
545 	"+title",
546 #else
547 	"-title",
548 #endif
549 #ifdef FEAT_TOOLBAR
550 	"+toolbar",
551 #else
552 	"-toolbar",
553 #endif
554 #ifdef FEAT_USR_CMDS
555 	"+user_commands",
556 #else
557 	"-user_commands",
558 #endif
559 #ifdef FEAT_VERTSPLIT
560 	"+vertsplit",
561 #else
562 	"-vertsplit",
563 #endif
564 #ifdef FEAT_VIRTUALEDIT
565 	"+virtualedit",
566 #else
567 	"-virtualedit",
568 #endif
569 #ifdef FEAT_VISUAL
570 	"+visual",
571 # ifdef FEAT_VISUALEXTRA
572 	"+visualextra",
573 # else
574 	"-visualextra",
575 # endif
576 #else
577 	"-visual",
578 #endif
579 #ifdef FEAT_VIMINFO
580 	"+viminfo",
581 #else
582 	"-viminfo",
583 #endif
584 #ifdef FEAT_VREPLACE
585 	"+vreplace",
586 #else
587 	"-vreplace",
588 #endif
589 #ifdef FEAT_WILDIGN
590 	"+wildignore",
591 #else
592 	"-wildignore",
593 #endif
594 #ifdef FEAT_WILDMENU
595 	"+wildmenu",
596 #else
597 	"-wildmenu",
598 #endif
599 #ifdef FEAT_WINDOWS
600 	"+windows",
601 #else
602 	"-windows",
603 #endif
604 #ifdef FEAT_WRITEBACKUP
605 	"+writebackup",
606 #else
607 	"-writebackup",
608 #endif
609 #if defined(UNIX) || defined(VMS)
610 # ifdef FEAT_X11
611 	"+X11",
612 # else
613 	"-X11",
614 # endif
615 #endif
616 #ifdef FEAT_XFONTSET
617 	"+xfontset",
618 #else
619 	"-xfontset",
620 #endif
621 #ifdef FEAT_XIM
622 	"+xim",
623 #else
624 	"-xim",
625 #endif
626 #if defined(UNIX) || defined(VMS)
627 # ifdef USE_XSMP_INTERACT
628 	"+xsmp_interact",
629 # else
630 #  ifdef USE_XSMP
631 	"+xsmp",
632 #  else
633 	"-xsmp",
634 #  endif
635 # endif
636 # ifdef FEAT_XCLIPBOARD
637 	"+xterm_clipboard",
638 # else
639 	"-xterm_clipboard",
640 # endif
641 #endif
642 #ifdef FEAT_XTERM_SAVE
643 	"+xterm_save",
644 #else
645 	"-xterm_save",
646 #endif
647 #ifdef WIN3264
648 # ifdef FEAT_XPM_W32
649 	"+xpm_w32",
650 # else
651 	"-xpm_w32",
652 # endif
653 #endif
654 	NULL
655 };
656 
657 static int included_patches[] =
658 {   /* Add new patch number below this line */
659 /**/
660     0
661 };
662 
663     int
664 highest_patch()
665 {
666     int		i;
667     int		h = 0;
668 
669     for (i = 0; included_patches[i] != 0; ++i)
670 	if (included_patches[i] > h)
671 	    h = included_patches[i];
672     return h;
673 }
674 
675 #if defined(FEAT_EVAL) || defined(PROTO)
676 /*
677  * Return TRUE if patch "n" has been included.
678  */
679     int
680 has_patch(n)
681     int		n;
682 {
683     int		i;
684 
685     for (i = 0; included_patches[i] != 0; ++i)
686 	if (included_patches[i] == n)
687 	    return TRUE;
688     return FALSE;
689 }
690 #endif
691 
692     void
693 ex_version(eap)
694     exarg_T	*eap;
695 {
696     /*
697      * Ignore a ":version 9.99" command.
698      */
699     if (*eap->arg == NUL)
700     {
701 	msg_putchar('\n');
702 	list_version();
703     }
704 }
705 
706     void
707 list_version()
708 {
709     int		i;
710     int		first;
711     char	*s = "";
712 
713     /*
714      * When adding features here, don't forget to update the list of
715      * internal variables in eval.c!
716      */
717     MSG(longVersion);
718 #ifdef WIN3264
719 # ifdef FEAT_GUI_W32
720 #  if defined(_MSC_VER) && (_MSC_VER <= 1010)
721     /* Only MS VC 4.1 and earlier can do Win32s */
722     MSG_PUTS(_("\nMS-Windows 16/32 bit GUI version"));
723 #  else
724     MSG_PUTS(_("\nMS-Windows 32 bit GUI version"));
725 #  endif
726     if (gui_is_win32s())
727 	MSG_PUTS(_(" in Win32s mode"));
728 # ifdef FEAT_OLE
729     MSG_PUTS(_(" with OLE support"));
730 # endif
731 # else
732     MSG_PUTS(_("\nMS-Windows 32 bit console version"));
733 # endif
734 #endif
735 #ifdef WIN16
736     MSG_PUTS(_("\nMS-Windows 16 bit version"));
737 #endif
738 #ifdef MSDOS
739 # ifdef DJGPP
740     MSG_PUTS(_("\n32 bit MS-DOS version"));
741 # else
742     MSG_PUTS(_("\n16 bit MS-DOS version"));
743 # endif
744 #endif
745 #ifdef MACOS
746 # ifdef MACOS_X
747 #  ifdef MACOS_X_UNIX
748     MSG_PUTS(_("\nMacOS X (unix) version"));
749 #  else
750     MSG_PUTS(_("\nMacOS X version"));
751 #  endif
752 #else
753     MSG_PUTS(_("\nMacOS version"));
754 # endif
755 #endif
756 
757 #ifdef RISCOS
758     MSG_PUTS(_("\nRISC OS version"));
759 #endif
760 #ifdef VMS
761     MSG_PUTS("\nOpenVMS version");
762 #endif
763 
764     /* Print the list of patch numbers if there is at least one. */
765     /* Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" */
766     if (included_patches[0] != 0)
767     {
768 	MSG_PUTS(_("\nIncluded patches: "));
769 	first = -1;
770 	/* find last one */
771 	for (i = 0; included_patches[i] != 0; ++i)
772 	    ;
773 	while (--i >= 0)
774 	{
775 	    if (first < 0)
776 		first = included_patches[i];
777 	    if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
778 	    {
779 		MSG_PUTS(s);
780 		s = ", ";
781 		msg_outnum((long)first);
782 		if (first != included_patches[i])
783 		{
784 		    MSG_PUTS("-");
785 		    msg_outnum((long)included_patches[i]);
786 		}
787 		first = -1;
788 	    }
789 	}
790     }
791 
792 #ifdef MODIFIED_BY
793     MSG_PUTS("\n");
794     MSG_PUTS(_("Modified by "));
795     MSG_PUTS(MODIFIED_BY);
796 #endif
797 
798 #ifdef HAVE_PATHDEF
799     if (*compiled_user != NUL || *compiled_sys != NUL)
800     {
801 	MSG_PUTS(_("\nCompiled "));
802 	if (*compiled_user != NUL)
803 	{
804 	    MSG_PUTS(_("by "));
805 	    MSG_PUTS(compiled_user);
806 	}
807 	if (*compiled_sys != NUL)
808 	{
809 	    MSG_PUTS("@");
810 	    MSG_PUTS(compiled_sys);
811 	}
812     }
813 #endif
814 
815 #ifdef FEAT_HUGE
816     MSG_PUTS(_("\nHuge version "));
817 #else
818 # ifdef FEAT_BIG
819     MSG_PUTS(_("\nBig version "));
820 # else
821 #  ifdef FEAT_NORMAL
822     MSG_PUTS(_("\nNormal version "));
823 #  else
824 #   ifdef FEAT_SMALL
825     MSG_PUTS(_("\nSmall version "));
826 #   else
827     MSG_PUTS(_("\nTiny version "));
828 #   endif
829 #  endif
830 # endif
831 #endif
832 #ifndef FEAT_GUI
833     MSG_PUTS(_("without GUI."));
834 #else
835 # ifdef FEAT_GUI_GTK
836 #  ifdef FEAT_GUI_GNOME
837 #   ifdef HAVE_GTK2
838     MSG_PUTS(_("with GTK2-GNOME GUI."));
839 #   else
840     MSG_PUTS(_("with GTK-GNOME GUI."));
841 #   endif
842 #  else
843 #   ifdef HAVE_GTK2
844     MSG_PUTS(_("with GTK2 GUI."));
845 #   else
846     MSG_PUTS(_("with GTK GUI."));
847 #   endif
848 #  endif
849 # else
850 #  ifdef FEAT_GUI_MOTIF
851     MSG_PUTS(_("with X11-Motif GUI."));
852 #  else
853 #   ifdef FEAT_GUI_ATHENA
854 #    ifdef FEAT_GUI_NEXTAW
855     MSG_PUTS(_("with X11-neXtaw GUI."));
856 #    else
857     MSG_PUTS(_("with X11-Athena GUI."));
858 #    endif
859 #   else
860 #     ifdef FEAT_GUI_PHOTON
861     MSG_PUTS(_("with Photon GUI."));
862 #     else
863 #      if defined(MSWIN)
864     MSG_PUTS(_("with GUI."));
865 #      else
866 #	if defined (TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
867     MSG_PUTS(_("with Carbon GUI."));
868 #	else
869 #	 if defined (TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
870     MSG_PUTS(_("with Cocoa GUI."));
871 #	 else
872 #	  if defined (MACOS)
873     MSG_PUTS(_("with (classic) GUI."));
874 #	  endif
875 #	 endif
876 #	endif
877 #      endif
878 #    endif
879 #   endif
880 #  endif
881 # endif
882 #endif
883     version_msg(_("  Features included (+) or not (-):\n"));
884 
885     /* print all the features */
886     for (i = 0; features[i] != NULL; ++i)
887     {
888 	version_msg(features[i]);
889 	if (msg_col > 0)
890 	    version_msg(" ");
891     }
892 
893     version_msg("\n");
894 #ifdef SYS_VIMRC_FILE
895     version_msg(_("   system vimrc file: \""));
896     version_msg(SYS_VIMRC_FILE);
897     version_msg("\"\n");
898 #endif
899 #ifdef USR_VIMRC_FILE
900     version_msg(_("     user vimrc file: \""));
901     version_msg(USR_VIMRC_FILE);
902     version_msg("\"\n");
903 #endif
904 #ifdef USR_VIMRC_FILE2
905     version_msg(_(" 2nd user vimrc file: \""));
906     version_msg(USR_VIMRC_FILE2);
907     version_msg("\"\n");
908 #endif
909 #ifdef USR_VIMRC_FILE3
910     version_msg(_(" 3rd user vimrc file: \""));
911     version_msg(USR_VIMRC_FILE3);
912     version_msg("\"\n");
913 #endif
914 #ifdef USR_EXRC_FILE
915     version_msg(_("      user exrc file: \""));
916     version_msg(USR_EXRC_FILE);
917     version_msg("\"\n");
918 #endif
919 #ifdef USR_EXRC_FILE2
920     version_msg(_("  2nd user exrc file: \""));
921     version_msg(USR_EXRC_FILE2);
922     version_msg("\"\n");
923 #endif
924 #ifdef FEAT_GUI
925 # ifdef SYS_GVIMRC_FILE
926     version_msg(_("  system gvimrc file: \""));
927     version_msg(SYS_GVIMRC_FILE);
928     version_msg("\"\n");
929 # endif
930     version_msg(_("    user gvimrc file: \""));
931     version_msg(USR_GVIMRC_FILE);
932     version_msg("\"\n");
933 # ifdef USR_GVIMRC_FILE2
934     version_msg(_("2nd user gvimrc file: \""));
935     version_msg(USR_GVIMRC_FILE2);
936     version_msg("\"\n");
937 # endif
938 # ifdef USR_GVIMRC_FILE3
939     version_msg(_("3rd user gvimrc file: \""));
940     version_msg(USR_GVIMRC_FILE3);
941     version_msg("\"\n");
942 # endif
943 #endif
944 #ifdef FEAT_GUI
945 # ifdef SYS_MENU_FILE
946     version_msg(_("    system menu file: \""));
947     version_msg(SYS_MENU_FILE);
948     version_msg("\"\n");
949 # endif
950 #endif
951 #ifdef HAVE_PATHDEF
952     if (*default_vim_dir != NUL)
953     {
954 	version_msg(_("  fall-back for $VIM: \""));
955 	version_msg((char *)default_vim_dir);
956 	version_msg("\"\n");
957     }
958     if (*default_vimruntime_dir != NUL)
959     {
960 	version_msg(_(" f-b for $VIMRUNTIME: \""));
961 	version_msg((char *)default_vimruntime_dir);
962 	version_msg("\"\n");
963     }
964     version_msg(_("Compilation: "));
965     version_msg((char *)all_cflags);
966     version_msg("\n");
967 #ifdef VMS
968     if (*compiler_version != NUL)
969     {
970 	version_msg(_("Compiler: "));
971 	version_msg((char *)compiler_version);
972 	version_msg("\n");
973     }
974 #endif
975     version_msg(_("Linking: "));
976     version_msg((char *)all_lflags);
977 #endif
978 #ifdef DEBUG
979     version_msg("\n");
980     version_msg(_("  DEBUG BUILD"));
981 #endif
982 }
983 
984 /*
985  * Output a string for the version message.  If it's going to wrap, output a
986  * newline, unless the message is too long to fit on the screen anyway.
987  */
988     static void
989 version_msg(s)
990     char	*s;
991 {
992     int		len = (int)STRLEN(s);
993 
994     if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
995 								&& *s != '\n')
996 	msg_putchar('\n');
997     if (!got_int)
998 	MSG_PUTS(s);
999 }
1000 
1001 static void do_intro_line __ARGS((int row, char_u *mesg, int add_version, int attr));
1002 
1003 /*
1004  * Give an introductory message about Vim.
1005  * Only used when starting Vim on an empty file, without a file name.
1006  * Or with the ":intro" command (for Sven :-).
1007  */
1008     void
1009 intro_message(colon)
1010     int		colon;		/* TRUE for ":intro" */
1011 {
1012     int		i;
1013     int		row;
1014     int		blanklines;
1015     int		sponsor;
1016     char	*p;
1017     static char	*(lines[]) =
1018     {
1019 	N_("VIM - Vi IMproved"),
1020 	"",
1021 	N_("version "),
1022 	N_("by Bram Moolenaar et al."),
1023 #ifdef MODIFIED_BY
1024 	" ",
1025 #endif
1026 	N_("Vim is open source and freely distributable"),
1027 	"",
1028 	N_("Help poor children in Uganda!"),
1029 	N_("type  :help iccf<Enter>       for information "),
1030 	"",
1031 	N_("type  :q<Enter>               to exit         "),
1032 	N_("type  :help<Enter>  or  <F1>  for on-line help"),
1033 	N_("type  :help version7<Enter>   for version info"),
1034 	NULL,
1035 	"",
1036 	N_("Running in Vi compatible mode"),
1037 	N_("type  :set nocp<Enter>        for Vim defaults"),
1038 	N_("type  :help cp-default<Enter> for info on this"),
1039     };
1040 #ifdef FEAT_GUI
1041     static char	*(gui_lines[]) =
1042     {
1043 	NULL,
1044 	NULL,
1045 	NULL,
1046 	NULL,
1047 #ifdef MODIFIED_BY
1048 	NULL,
1049 #endif
1050 	NULL,
1051 	NULL,
1052 	NULL,
1053 	N_("menu  Help->Orphans           for information    "),
1054 	NULL,
1055 	N_("Running modeless, typed text is inserted"),
1056 	N_("menu  Edit->Global Settings->Toggle Insert Mode  "),
1057 	N_("                              for two modes      "),
1058 	NULL,
1059 	NULL,
1060 	NULL,
1061 	N_("menu  Edit->Global Settings->Toggle Vi Compatible"),
1062 	N_("                              for Vim defaults   "),
1063     };
1064 #endif
1065 
1066     /* blanklines = screen height - # message lines */
1067     blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1068     if (!p_cp)
1069 	blanklines += 4;  /* add 4 for not showing "Vi compatible" message */
1070 #if defined(WIN3264) && !defined(FEAT_GUI_W32)
1071     if (mch_windows95())
1072 	blanklines -= 3;  /* subtract 3 for showing "Windows 95" message */
1073 #endif
1074 
1075 #ifdef FEAT_WINDOWS
1076     /* Don't overwrite a statusline.  Depends on 'cmdheight'. */
1077     if (p_ls > 1)
1078 	blanklines -= Rows - topframe->fr_height;
1079 #endif
1080     if (blanklines < 0)
1081 	blanklines = 0;
1082 
1083     /* Show the sponsor and register message one out of four times, the Uganda
1084      * message two out of four times. */
1085     sponsor = (int)time(NULL);
1086     sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1087 
1088     /* start displaying the message lines after half of the blank lines */
1089     row = blanklines / 2;
1090     if ((row >= 2 && Columns >= 50) || colon)
1091     {
1092 	for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1093 	{
1094 	    p = lines[i];
1095 #ifdef FEAT_GUI
1096 	    if (p_im && gui.in_use && gui_lines[i] != NULL)
1097 		p = gui_lines[i];
1098 #endif
1099 	    if (p == NULL)
1100 	    {
1101 		if (!p_cp)
1102 		    break;
1103 		continue;
1104 	    }
1105 	    if (sponsor != 0)
1106 	    {
1107 		if (strstr(p, "children") != NULL)
1108 		    p = sponsor < 0
1109 			? N_("Sponsor Vim development!")
1110 			: N_("Become a registered Vim user!");
1111 		else if (strstr(p, "iccf") != NULL)
1112 		    p = sponsor < 0
1113 			? N_("type  :help sponsor<Enter>    for information ")
1114 			: N_("type  :help register<Enter>   for information ");
1115 		else if (strstr(p, "Orphans") != NULL)
1116 		    p = N_("menu  Help->Sponsor/Register  for information    ");
1117 	    }
1118 	    if (*p != NUL)
1119 		do_intro_line(row, (char_u *)_(p), i == 2, 0);
1120 	    ++row;
1121 	}
1122 #if defined(WIN3264) && !defined(FEAT_GUI_W32)
1123 	if (mch_windows95())
1124 	{
1125 	    do_intro_line(++row,
1126 		    (char_u *)_("WARNING: Windows 95/98/ME detected"),
1127 							FALSE, hl_attr(HLF_E));
1128 	    do_intro_line(++row,
1129 		(char_u *)_("type  :help windows95<Enter>  for info on this"),
1130 								    FALSE, 0);
1131 	}
1132 #endif
1133     }
1134 
1135     /* Make the wait-return message appear just below the text. */
1136     if (colon)
1137 	msg_row = row;
1138 }
1139 
1140     static void
1141 do_intro_line(row, mesg, add_version, attr)
1142     int		row;
1143     char_u	*mesg;
1144     int		add_version;
1145     int		attr;
1146 {
1147     char_u	vers[20];
1148     int		col;
1149     char_u	*p;
1150     int		l;
1151     int		clen;
1152 #ifdef MODIFIED_BY
1153 # define MODBY_LEN 150
1154     char_u	modby[MODBY_LEN];
1155 
1156     if (*mesg == ' ')
1157     {
1158 	vim_strncpy(modby, _("Modified by "), MODBY_LEN - 1);
1159 	l = STRLEN(modby);
1160 	vim_strncpy(modby + l, MODIFIED_BY, MODBY_LEN - l - 1);
1161 	mesg = modby;
1162     }
1163 #endif
1164 
1165     /* Center the message horizontally. */
1166     col = vim_strsize(mesg);
1167     if (add_version)
1168     {
1169 	STRCPY(vers, mediumVersion);
1170 	if (highest_patch())
1171 	{
1172 	    /* Check for 9.9x or 9.9xx, alpha/beta version */
1173 	    if (isalpha((int)mediumVersion[3]))
1174 	    {
1175 		if (isalpha((int)mediumVersion[4]))
1176 		    sprintf((char *)vers + 5, ".%d%s", highest_patch(),
1177 							   mediumVersion + 5);
1178 		else
1179 		    sprintf((char *)vers + 4, ".%d%s", highest_patch(),
1180 							   mediumVersion + 4);
1181 	    }
1182 	    else
1183 		sprintf((char *)vers + 3, ".%d", highest_patch());
1184 	}
1185 	col += (int)STRLEN(vers);
1186     }
1187     col = (Columns - col) / 2;
1188     if (col < 0)
1189 	col = 0;
1190 
1191     /* Split up in parts to highlight <> items differently. */
1192     for (p = mesg; *p != NUL; p += l)
1193     {
1194 	clen = 0;
1195 	for (l = 0; p[l] != NUL
1196 			 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1197 	{
1198 #ifdef FEAT_MBYTE
1199 	    if (has_mbyte)
1200 	    {
1201 		clen += ptr2cells(p + l);
1202 		l += (*mb_ptr2len)(p + l) - 1;
1203 	    }
1204 	    else
1205 #endif
1206 		clen += byte2cells(p[l]);
1207 	}
1208 	screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr);
1209 	col += clen;
1210     }
1211 
1212     /* Add the version number to the version line. */
1213     if (add_version)
1214 	screen_puts(vers, row, col, 0);
1215 }
1216 
1217 /*
1218  * ":intro": clear screen, display intro screen and wait for return.
1219  */
1220 /*ARGSUSED*/
1221     void
1222 ex_intro(eap)
1223     exarg_T	*eap;
1224 {
1225     screenclear();
1226     intro_message(TRUE);
1227     wait_return(TRUE);
1228 }
1229