xref: /vim-8.2.3635/src/version.c (revision 8024f936)
1 /* vi:set ts=8 sts=4 sw=4 noet:
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 7.4 and 8.x can be found with ":help version8".
21  * Differences between version 6.4 and 7.x can be found with ":help version7".
22  * Differences between version 5.8 and 6.x can be found with ":help version6".
23  * Differences between version 4.x and 5.x can be found with ":help version5".
24  * Differences between version 3.0 and 4.x can be found with ":help version4".
25  * All the remarks about older versions have been removed, they are not very
26  * interesting.
27  */
28 
29 #include "version.h"
30 
31 char		*Version = VIM_VERSION_SHORT;
32 static char	*mediumVersion = VIM_VERSION_MEDIUM;
33 
34 #if defined(HAVE_DATE_TIME) || defined(PROTO)
35 # if (defined(VMS) && defined(VAXC)) || defined(PROTO)
36 char	longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)
37 						      + sizeof(__TIME__) + 3];
38 
39     void
40 init_longVersion(void)
41 {
42     /*
43      * Construct the long version string.  Necessary because
44      * VAX C can't concatenate strings in the preprocessor.
45      */
46     strcpy(longVersion, VIM_VERSION_LONG_DATE);
47     strcat(longVersion, __DATE__);
48     strcat(longVersion, " ");
49     strcat(longVersion, __TIME__);
50     strcat(longVersion, ")");
51 }
52 
53 # else
54     void
55 init_longVersion(void)
56 {
57     char *date_time = __DATE__ " " __TIME__;
58     char *msg = _("%s (%s, compiled %s)");
59     size_t len = strlen(msg)
60 		+ strlen(VIM_VERSION_LONG_ONLY)
61 		+ strlen(VIM_VERSION_DATE_ONLY)
62 		+ strlen(date_time);
63 
64     longVersion = alloc(len);
65     if (longVersion == NULL)
66 	longVersion = VIM_VERSION_LONG;
67     else
68 	vim_snprintf(longVersion, len, msg,
69 		      VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);
70 }
71 # endif
72 #else
73 char	*longVersion = VIM_VERSION_LONG;
74 
75     void
76 init_longVersion(void)
77 {
78     // nothing to do
79 }
80 #endif
81 
82 static char *(features[]) =
83 {
84 #ifdef HAVE_ACL
85 	"+acl",
86 #else
87 	"-acl",
88 #endif
89 #ifdef AMIGA		// only for Amiga systems
90 # ifdef FEAT_ARP
91 	"+ARP",
92 # else
93 	"-ARP",
94 # endif
95 #endif
96 #ifdef FEAT_ARABIC
97 	"+arabic",
98 #else
99 	"-arabic",
100 #endif
101 	"+autocmd",
102 #ifdef FEAT_AUTOCHDIR
103        "+autochdir",
104 #else
105        "-autochdir",
106 #endif
107 #ifdef FEAT_AUTOSERVERNAME
108 	"+autoservername",
109 #else
110 	"-autoservername",
111 #endif
112 #ifdef FEAT_BEVAL_GUI
113 	"+balloon_eval",
114 #else
115 	"-balloon_eval",
116 #endif
117 #ifdef FEAT_BEVAL_TERM
118 	"+balloon_eval_term",
119 #else
120 	"-balloon_eval_term",
121 #endif
122 #ifdef FEAT_BROWSE
123 	"+browse",
124 #else
125 	"-browse",
126 #endif
127 #ifdef NO_BUILTIN_TCAPS
128 	"-builtin_terms",
129 #endif
130 #ifdef SOME_BUILTIN_TCAPS
131 	"+builtin_terms",
132 #endif
133 #ifdef ALL_BUILTIN_TCAPS
134 	"++builtin_terms",
135 #endif
136 #ifdef FEAT_BYTEOFF
137 	"+byte_offset",
138 #else
139 	"-byte_offset",
140 #endif
141 #ifdef FEAT_JOB_CHANNEL
142 	"+channel",
143 #else
144 	"-channel",
145 #endif
146 #ifdef FEAT_CINDENT
147 	"+cindent",
148 #else
149 	"-cindent",
150 #endif
151 #ifdef FEAT_CLIENTSERVER
152 	"+clientserver",
153 #else
154 	"-clientserver",
155 #endif
156 #ifdef FEAT_CLIPBOARD
157 	"+clipboard",
158 #else
159 	"-clipboard",
160 #endif
161 	"+cmdline_compl",
162 	"+cmdline_hist",
163 #ifdef FEAT_CMDL_INFO
164 	"+cmdline_info",
165 #else
166 	"-cmdline_info",
167 #endif
168 	"+comments",
169 #ifdef FEAT_CONCEAL
170 	"+conceal",
171 #else
172 	"-conceal",
173 #endif
174 #ifdef FEAT_CRYPT
175 	"+cryptv",
176 #else
177 	"-cryptv",
178 #endif
179 #ifdef FEAT_CSCOPE
180 	"+cscope",
181 #else
182 	"-cscope",
183 #endif
184 	"+cursorbind",
185 #ifdef CURSOR_SHAPE
186 	"+cursorshape",
187 #else
188 	"-cursorshape",
189 #endif
190 #if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
191 	"+dialog_con_gui",
192 #else
193 # if defined(FEAT_CON_DIALOG)
194 	"+dialog_con",
195 # else
196 #  if defined(FEAT_GUI_DIALOG)
197 	"+dialog_gui",
198 #  else
199 	"-dialog",
200 #  endif
201 # endif
202 #endif
203 #ifdef FEAT_DIFF
204 	"+diff",
205 #else
206 	"-diff",
207 #endif
208 #ifdef FEAT_DIGRAPHS
209 	"+digraphs",
210 #else
211 	"-digraphs",
212 #endif
213 #ifdef FEAT_GUI_MSWIN
214 # ifdef FEAT_DIRECTX
215 	"+directx",
216 # else
217 	"-directx",
218 # endif
219 #endif
220 #ifdef FEAT_DND
221 	"+dnd",
222 #else
223 	"-dnd",
224 #endif
225 #ifdef EBCDIC
226 	"+ebcdic",
227 #else
228 	"-ebcdic",
229 #endif
230 #ifdef FEAT_EMACS_TAGS
231 	"+emacs_tags",
232 #else
233 	"-emacs_tags",
234 #endif
235 #ifdef FEAT_EVAL
236 	"+eval",
237 #else
238 	"-eval",
239 #endif
240 	"+ex_extra",
241 #ifdef FEAT_SEARCH_EXTRA
242 	"+extra_search",
243 #else
244 	"-extra_search",
245 #endif
246 	"-farsi",
247 #ifdef FEAT_SEARCHPATH
248 	"+file_in_path",
249 #else
250 	"-file_in_path",
251 #endif
252 #ifdef FEAT_FIND_ID
253 	"+find_in_path",
254 #else
255 	"-find_in_path",
256 #endif
257 #ifdef FEAT_FLOAT
258 	"+float",
259 #else
260 	"-float",
261 #endif
262 #ifdef FEAT_FOLDING
263 	"+folding",
264 #else
265 	"-folding",
266 #endif
267 #ifdef FEAT_FOOTER
268 	"+footer",
269 #else
270 	"-footer",
271 #endif
272 	    // only interesting on Unix systems
273 #if !defined(USE_SYSTEM) && defined(UNIX)
274 	"+fork()",
275 #endif
276 #ifdef FEAT_GETTEXT
277 # ifdef DYNAMIC_GETTEXT
278 	"+gettext/dyn",
279 # else
280 	"+gettext",
281 # endif
282 #else
283 	"-gettext",
284 #endif
285 	"-hangul_input",
286 #if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
287 # ifdef DYNAMIC_ICONV
288 	"+iconv/dyn",
289 # else
290 	"+iconv",
291 # endif
292 #else
293 	"-iconv",
294 #endif
295 	"+insert_expand",
296 #ifdef FEAT_JOB_CHANNEL
297 	"+job",
298 #else
299 	"-job",
300 #endif
301 #ifdef FEAT_JUMPLIST
302 	"+jumplist",
303 #else
304 	"-jumplist",
305 #endif
306 #ifdef FEAT_KEYMAP
307 	"+keymap",
308 #else
309 	"-keymap",
310 #endif
311 #ifdef FEAT_EVAL
312 	"+lambda",
313 #else
314 	"-lambda",
315 #endif
316 #ifdef FEAT_LANGMAP
317 	"+langmap",
318 #else
319 	"-langmap",
320 #endif
321 #ifdef FEAT_LIBCALL
322 	"+libcall",
323 #else
324 	"-libcall",
325 #endif
326 #ifdef FEAT_LINEBREAK
327 	"+linebreak",
328 #else
329 	"-linebreak",
330 #endif
331 #ifdef FEAT_LISP
332 	"+lispindent",
333 #else
334 	"-lispindent",
335 #endif
336 	"+listcmds",
337 	"+localmap",
338 #ifdef FEAT_LUA
339 # ifdef DYNAMIC_LUA
340 	"+lua/dyn",
341 # else
342 	"+lua",
343 # endif
344 #else
345 	"-lua",
346 #endif
347 #ifdef FEAT_MENU
348 	"+menu",
349 #else
350 	"-menu",
351 #endif
352 #ifdef FEAT_SESSION
353 	"+mksession",
354 #else
355 	"-mksession",
356 #endif
357 	"+modify_fname",
358 	"+mouse",
359 #ifdef FEAT_MOUSESHAPE
360 	"+mouseshape",
361 #else
362 	"-mouseshape",
363 #endif
364 
365 #if defined(UNIX) || defined(VMS)
366 # ifdef FEAT_MOUSE_DEC
367 	"+mouse_dec",
368 # else
369 	"-mouse_dec",
370 # endif
371 # ifdef FEAT_MOUSE_GPM
372 	"+mouse_gpm",
373 # else
374 	"-mouse_gpm",
375 # endif
376 # ifdef FEAT_MOUSE_JSB
377 	"+mouse_jsbterm",
378 # else
379 	"-mouse_jsbterm",
380 # endif
381 # ifdef FEAT_MOUSE_NET
382 	"+mouse_netterm",
383 # else
384 	"-mouse_netterm",
385 # endif
386 #endif
387 
388 #ifdef __QNX__
389 # ifdef FEAT_MOUSE_PTERM
390 	"+mouse_pterm",
391 # else
392 	"-mouse_pterm",
393 # endif
394 #endif
395 
396 #if defined(UNIX) || defined(VMS)
397 	"+mouse_sgr",
398 # ifdef FEAT_SYSMOUSE
399 	"+mouse_sysmouse",
400 # else
401 	"-mouse_sysmouse",
402 # endif
403 # ifdef FEAT_MOUSE_URXVT
404 	"+mouse_urxvt",
405 # else
406 	"-mouse_urxvt",
407 # endif
408 	"+mouse_xterm",
409 #endif
410 
411 #ifdef FEAT_MBYTE_IME
412 # ifdef DYNAMIC_IME
413 	"+multi_byte_ime/dyn",
414 # else
415 	"+multi_byte_ime",
416 # endif
417 #else
418 	"+multi_byte",
419 #endif
420 #ifdef FEAT_MULTI_LANG
421 	"+multi_lang",
422 #else
423 	"-multi_lang",
424 #endif
425 #ifdef FEAT_MZSCHEME
426 # ifdef DYNAMIC_MZSCHEME
427 	"+mzscheme/dyn",
428 # else
429 	"+mzscheme",
430 # endif
431 #else
432 	"-mzscheme",
433 #endif
434 #ifdef FEAT_NETBEANS_INTG
435 	"+netbeans_intg",
436 #else
437 	"-netbeans_intg",
438 #endif
439 #ifdef FEAT_NUM64
440 	"+num64",
441 #else
442 	"-num64",
443 #endif
444 #ifdef FEAT_GUI_MSWIN
445 # ifdef FEAT_OLE
446 	"+ole",
447 # else
448 	"-ole",
449 # endif
450 #endif
451 #ifdef FEAT_EVAL
452 	"+packages",
453 #else
454 	"-packages",
455 #endif
456 #ifdef FEAT_PATH_EXTRA
457 	"+path_extra",
458 #else
459 	"-path_extra",
460 #endif
461 #ifdef FEAT_PERL
462 # ifdef DYNAMIC_PERL
463 	"+perl/dyn",
464 # else
465 	"+perl",
466 # endif
467 #else
468 	"-perl",
469 #endif
470 #ifdef FEAT_PERSISTENT_UNDO
471 	"+persistent_undo",
472 #else
473 	"-persistent_undo",
474 #endif
475 #ifdef FEAT_PROP_POPUP
476 	"+popupwin",
477 #else
478 	"-popupwin",
479 #endif
480 #ifdef FEAT_PRINTER
481 # ifdef FEAT_POSTSCRIPT
482 	"+postscript",
483 # else
484 	"-postscript",
485 # endif
486 	"+printer",
487 #else
488 	"-printer",
489 #endif
490 #ifdef FEAT_PROFILE
491 	"+profile",
492 #else
493 	"-profile",
494 #endif
495 #ifdef FEAT_PYTHON
496 # ifdef DYNAMIC_PYTHON
497 	"+python/dyn",
498 # else
499 	"+python",
500 # endif
501 #else
502 	"-python",
503 #endif
504 #ifdef FEAT_PYTHON3
505 # ifdef DYNAMIC_PYTHON3
506 	"+python3/dyn",
507 # else
508 	"+python3",
509 # endif
510 #else
511 	"-python3",
512 #endif
513 #ifdef FEAT_QUICKFIX
514 	"+quickfix",
515 #else
516 	"-quickfix",
517 #endif
518 #ifdef FEAT_RELTIME
519 	"+reltime",
520 #else
521 	"-reltime",
522 #endif
523 #ifdef FEAT_RIGHTLEFT
524 	"+rightleft",
525 #else
526 	"-rightleft",
527 #endif
528 #ifdef FEAT_RUBY
529 # ifdef DYNAMIC_RUBY
530 	"+ruby/dyn",
531 # else
532 	"+ruby",
533 # endif
534 #else
535 	"-ruby",
536 #endif
537 	"+scrollbind",
538 #ifdef FEAT_SIGNS
539 	"+signs",
540 #else
541 	"-signs",
542 #endif
543 #ifdef FEAT_SMARTINDENT
544 	"+smartindent",
545 #else
546 	"-smartindent",
547 #endif
548 #ifdef FEAT_SOUND
549 	"+sound",
550 #else
551 	"-sound",
552 #endif
553 #ifdef FEAT_SPELL
554 	"+spell",
555 #else
556 	"-spell",
557 #endif
558 #ifdef STARTUPTIME
559 	"+startuptime",
560 #else
561 	"-startuptime",
562 #endif
563 #ifdef FEAT_STL_OPT
564 	"+statusline",
565 #else
566 	"-statusline",
567 #endif
568 	"-sun_workshop",
569 #ifdef FEAT_SYN_HL
570 	"+syntax",
571 #else
572 	"-syntax",
573 #endif
574 	    // only interesting on Unix systems
575 #if defined(USE_SYSTEM) && defined(UNIX)
576 	"+system()",
577 #endif
578 #ifdef FEAT_TAG_BINS
579 	"+tag_binary",
580 #else
581 	"-tag_binary",
582 #endif
583 	"-tag_old_static",
584 	"-tag_any_white",
585 #ifdef FEAT_TCL
586 # ifdef DYNAMIC_TCL
587 	"+tcl/dyn",
588 # else
589 	"+tcl",
590 # endif
591 #else
592 	"-tcl",
593 #endif
594 #ifdef FEAT_TERMGUICOLORS
595 	"+termguicolors",
596 #else
597 	"-termguicolors",
598 #endif
599 #ifdef FEAT_TERMINAL
600 	"+terminal",
601 #else
602 	"-terminal",
603 #endif
604 #if defined(UNIX)
605 // only Unix can have terminfo instead of termcap
606 # ifdef TERMINFO
607 	"+terminfo",
608 # else
609 	"-terminfo",
610 # endif
611 #endif
612 #ifdef FEAT_TERMRESPONSE
613 	"+termresponse",
614 #else
615 	"-termresponse",
616 #endif
617 #ifdef FEAT_TEXTOBJ
618 	"+textobjects",
619 #else
620 	"-textobjects",
621 #endif
622 #ifdef FEAT_PROP_POPUP
623 	"+textprop",
624 #else
625 	"-textprop",
626 #endif
627 #if !defined(UNIX)
628 // unix always includes termcap support
629 # ifdef HAVE_TGETENT
630 	"+tgetent",
631 # else
632 	"-tgetent",
633 # endif
634 #endif
635 #ifdef FEAT_TIMERS
636 	"+timers",
637 #else
638 	"-timers",
639 #endif
640 #ifdef FEAT_TITLE
641 	"+title",
642 #else
643 	"-title",
644 #endif
645 #ifdef FEAT_TOOLBAR
646 	"+toolbar",
647 #else
648 	"-toolbar",
649 #endif
650 	"+user_commands",
651 #ifdef FEAT_VARTABS
652 	"+vartabs",
653 #else
654 	"-vartabs",
655 #endif
656 	"+vertsplit",
657 	"+virtualedit",
658 	"+visual",
659 	"+visualextra",
660 #ifdef FEAT_VIMINFO
661 	"+viminfo",
662 #else
663 	"-viminfo",
664 #endif
665 	"+vreplace",
666 #ifdef MSWIN
667 # ifdef FEAT_VTP
668 	"+vtp",
669 # else
670 	"-vtp",
671 # endif
672 #endif
673 #ifdef FEAT_WILDIGN
674 	"+wildignore",
675 #else
676 	"-wildignore",
677 #endif
678 #ifdef FEAT_WILDMENU
679 	"+wildmenu",
680 #else
681 	"-wildmenu",
682 #endif
683 	"+windows",
684 #ifdef FEAT_WRITEBACKUP
685 	"+writebackup",
686 #else
687 	"-writebackup",
688 #endif
689 #if defined(UNIX) || defined(VMS)
690 # ifdef FEAT_X11
691 	"+X11",
692 # else
693 	"-X11",
694 # endif
695 #endif
696 #ifdef FEAT_XFONTSET
697 	"+xfontset",
698 #else
699 	"-xfontset",
700 #endif
701 #ifdef FEAT_XIM
702 	"+xim",
703 #else
704 	"-xim",
705 #endif
706 #ifdef MSWIN
707 # ifdef FEAT_XPM_W32
708 	"+xpm_w32",
709 # else
710 	"-xpm_w32",
711 # endif
712 #else
713 # ifdef HAVE_XPM
714 	"+xpm",
715 # else
716 	"-xpm",
717 # endif
718 #endif
719 #if defined(UNIX) || defined(VMS)
720 # ifdef USE_XSMP_INTERACT
721 	"+xsmp_interact",
722 # else
723 #  ifdef USE_XSMP
724 	"+xsmp",
725 #  else
726 	"-xsmp",
727 #  endif
728 # endif
729 # ifdef FEAT_XCLIPBOARD
730 	"+xterm_clipboard",
731 # else
732 	"-xterm_clipboard",
733 # endif
734 #endif
735 #ifdef FEAT_XTERM_SAVE
736 	"+xterm_save",
737 #else
738 	"-xterm_save",
739 #endif
740 	NULL
741 };
742 
743 static int included_patches[] =
744 {   /* Add new patch number below this line */
745 /**/
746     117,
747 /**/
748     116,
749 /**/
750     115,
751 /**/
752     114,
753 /**/
754     113,
755 /**/
756     112,
757 /**/
758     111,
759 /**/
760     110,
761 /**/
762     109,
763 /**/
764     108,
765 /**/
766     107,
767 /**/
768     106,
769 /**/
770     105,
771 /**/
772     104,
773 /**/
774     103,
775 /**/
776     102,
777 /**/
778     101,
779 /**/
780     100,
781 /**/
782     99,
783 /**/
784     98,
785 /**/
786     97,
787 /**/
788     96,
789 /**/
790     95,
791 /**/
792     94,
793 /**/
794     93,
795 /**/
796     92,
797 /**/
798     91,
799 /**/
800     90,
801 /**/
802     89,
803 /**/
804     88,
805 /**/
806     87,
807 /**/
808     86,
809 /**/
810     85,
811 /**/
812     84,
813 /**/
814     83,
815 /**/
816     82,
817 /**/
818     81,
819 /**/
820     80,
821 /**/
822     79,
823 /**/
824     78,
825 /**/
826     77,
827 /**/
828     76,
829 /**/
830     75,
831 /**/
832     74,
833 /**/
834     73,
835 /**/
836     72,
837 /**/
838     71,
839 /**/
840     70,
841 /**/
842     69,
843 /**/
844     68,
845 /**/
846     67,
847 /**/
848     66,
849 /**/
850     65,
851 /**/
852     64,
853 /**/
854     63,
855 /**/
856     62,
857 /**/
858     61,
859 /**/
860     60,
861 /**/
862     59,
863 /**/
864     58,
865 /**/
866     57,
867 /**/
868     56,
869 /**/
870     55,
871 /**/
872     54,
873 /**/
874     53,
875 /**/
876     52,
877 /**/
878     51,
879 /**/
880     50,
881 /**/
882     49,
883 /**/
884     48,
885 /**/
886     47,
887 /**/
888     46,
889 /**/
890     45,
891 /**/
892     44,
893 /**/
894     43,
895 /**/
896     42,
897 /**/
898     41,
899 /**/
900     40,
901 /**/
902     39,
903 /**/
904     38,
905 /**/
906     37,
907 /**/
908     36,
909 /**/
910     35,
911 /**/
912     34,
913 /**/
914     33,
915 /**/
916     32,
917 /**/
918     31,
919 /**/
920     30,
921 /**/
922     29,
923 /**/
924     28,
925 /**/
926     27,
927 /**/
928     26,
929 /**/
930     25,
931 /**/
932     24,
933 /**/
934     23,
935 /**/
936     22,
937 /**/
938     21,
939 /**/
940     20,
941 /**/
942     19,
943 /**/
944     18,
945 /**/
946     17,
947 /**/
948     16,
949 /**/
950     15,
951 /**/
952     14,
953 /**/
954     13,
955 /**/
956     12,
957 /**/
958     11,
959 /**/
960     10,
961 /**/
962     9,
963 /**/
964     8,
965 /**/
966     7,
967 /**/
968     6,
969 /**/
970     5,
971 /**/
972     4,
973 /**/
974     3,
975 /**/
976     2,
977 /**/
978     1,
979 /**/
980     0
981 };
982 
983 /*
984  * Place to put a short description when adding a feature with a patch.
985  * Keep it short, e.g.,: "relative numbers", "persistent undo".
986  * Also add a comment marker to separate the lines.
987  * See the official Vim patches for the diff format: It must use a context of
988  * one line only.  Create it by hand or use "diff -C2" and edit the patch.
989  */
990 static char *(extra_patches[]) =
991 {   /* Add your patch description below this line */
992 /**/
993     NULL
994 };
995 
996     int
997 highest_patch(void)
998 {
999     // this relies on the highest patch number to be the first entry
1000     return included_patches[0];
1001 }
1002 
1003 #if defined(FEAT_EVAL) || defined(PROTO)
1004 /*
1005  * Return TRUE if patch "n" has been included.
1006  */
1007     int
1008 has_patch(int n)
1009 {
1010     int		i;
1011 
1012     for (i = 0; included_patches[i] != 0; ++i)
1013 	if (included_patches[i] == n)
1014 	    return TRUE;
1015     return FALSE;
1016 }
1017 #endif
1018 
1019     void
1020 ex_version(exarg_T *eap)
1021 {
1022     /*
1023      * Ignore a ":version 9.99" command.
1024      */
1025     if (*eap->arg == NUL)
1026     {
1027 	msg_putchar('\n');
1028 	list_version();
1029     }
1030 }
1031 
1032 /*
1033  * Output a string for the version message.  If it's going to wrap, output a
1034  * newline, unless the message is too long to fit on the screen anyway.
1035  * When "wrap" is TRUE wrap the string in [].
1036  */
1037     static void
1038 version_msg_wrap(char_u *s, int wrap)
1039 {
1040     int		len = (int)vim_strsize(s) + (wrap ? 2 : 0);
1041 
1042     if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
1043 								&& *s != '\n')
1044 	msg_putchar('\n');
1045     if (!got_int)
1046     {
1047 	if (wrap)
1048 	    msg_puts("[");
1049 	msg_puts((char *)s);
1050 	if (wrap)
1051 	    msg_puts("]");
1052     }
1053 }
1054 
1055     static void
1056 version_msg(char *s)
1057 {
1058     version_msg_wrap((char_u *)s, FALSE);
1059 }
1060 
1061 /*
1062  * List all features aligned in columns, dictionary style.
1063  */
1064     static void
1065 list_features(void)
1066 {
1067     list_in_columns((char_u **)features, -1, -1);
1068 }
1069 
1070 /*
1071  * List string items nicely aligned in columns.
1072  * When "size" is < 0 then the last entry is marked with NULL.
1073  * The entry with index "current" is inclosed in [].
1074  */
1075     void
1076 list_in_columns(char_u **items, int size, int current)
1077 {
1078     int		i;
1079     int		ncol;
1080     int		nrow;
1081     int		cur_row = 1;
1082     int		item_count = 0;
1083     int		width = 0;
1084 #ifdef FEAT_SYN_HL
1085     int		use_highlight = (items == (char_u **)features);
1086 #endif
1087 
1088     // Find the length of the longest item, use that + 1 as the column
1089     // width.
1090     for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
1091     {
1092 	int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0);
1093 
1094 	if (l > width)
1095 	    width = l;
1096 	++item_count;
1097     }
1098     width += 1;
1099 
1100     if (Columns < width)
1101     {
1102 	// Not enough screen columns - show one per line
1103 	for (i = 0; i < item_count; ++i)
1104 	{
1105 	    version_msg_wrap(items[i], i == current);
1106 	    if (msg_col > 0 && i < item_count - 1)
1107 		msg_putchar('\n');
1108 	}
1109 	return;
1110     }
1111 
1112     // The rightmost column doesn't need a separator.
1113     // Sacrifice it to fit in one more column if possible.
1114     ncol = (int) (Columns + 1) / width;
1115     nrow = item_count / ncol + (item_count % ncol ? 1 : 0);
1116 
1117     // "i" counts columns then rows.  "idx" counts rows then columns.
1118     for (i = 0; !got_int && i < nrow * ncol; ++i)
1119     {
1120 	int idx = (i / ncol) + (i % ncol) * nrow;
1121 
1122 	if (idx < item_count)
1123 	{
1124 	    int last_col = (i + 1) % ncol == 0;
1125 
1126 	    if (idx == current)
1127 		msg_putchar('[');
1128 #ifdef FEAT_SYN_HL
1129 	    if (use_highlight && items[idx][0] == '-')
1130 		msg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));
1131 	    else
1132 #endif
1133 		msg_puts((char *)items[idx]);
1134 	    if (idx == current)
1135 		msg_putchar(']');
1136 	    if (last_col)
1137 	    {
1138 		if (msg_col > 0 && cur_row < nrow)
1139 		    msg_putchar('\n');
1140 		++cur_row;
1141 	    }
1142 	    else
1143 	    {
1144 		while (msg_col % width)
1145 		    msg_putchar(' ');
1146 	    }
1147 	}
1148 	else
1149 	{
1150 	    // this row is out of items, thus at the end of the row
1151 	    if (msg_col > 0)
1152 	    {
1153 		if (cur_row < nrow)
1154 		    msg_putchar('\n');
1155 		++cur_row;
1156 	    }
1157 	}
1158     }
1159 }
1160 
1161     void
1162 list_version(void)
1163 {
1164     int		i;
1165     int		first;
1166     char	*s = "";
1167 
1168     /*
1169      * When adding features here, don't forget to update the list of
1170      * internal variables in eval.c!
1171      */
1172     init_longVersion();
1173     msg(longVersion);
1174 #ifdef MSWIN
1175 # ifdef FEAT_GUI_MSWIN
1176 #  ifdef VIMDLL
1177 #   ifdef _WIN64
1178     msg_puts(_("\nMS-Windows 64-bit GUI/console version"));
1179 #   else
1180     msg_puts(_("\nMS-Windows 32-bit GUI/console version"));
1181 #   endif
1182 #  else
1183 #   ifdef _WIN64
1184     msg_puts(_("\nMS-Windows 64-bit GUI version"));
1185 #   else
1186     msg_puts(_("\nMS-Windows 32-bit GUI version"));
1187 #   endif
1188 #  endif
1189 #  ifdef FEAT_OLE
1190     msg_puts(_(" with OLE support"));
1191 #  endif
1192 # else
1193 #  ifdef _WIN64
1194     msg_puts(_("\nMS-Windows 64-bit console version"));
1195 #  else
1196     msg_puts(_("\nMS-Windows 32-bit console version"));
1197 #  endif
1198 # endif
1199 #endif
1200 #if defined(MACOS_X)
1201 # if defined(MACOS_X_DARWIN)
1202     msg_puts(_("\nmacOS version"));
1203 # else
1204     msg_puts(_("\nmacOS version w/o darwin feat."));
1205 # endif
1206 #endif
1207 
1208 #ifdef VMS
1209     msg_puts(_("\nOpenVMS version"));
1210 # ifdef HAVE_PATHDEF
1211     if (*compiled_arch != NUL)
1212     {
1213 	msg_puts(" - ");
1214 	msg_puts((char *)compiled_arch);
1215     }
1216 # endif
1217 
1218 #endif
1219 
1220     // Print the list of patch numbers if there is at least one.
1221     // Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45"
1222     if (included_patches[0] != 0)
1223     {
1224 	msg_puts(_("\nIncluded patches: "));
1225 	first = -1;
1226 	// find last one
1227 	for (i = 0; included_patches[i] != 0; ++i)
1228 	    ;
1229 	while (--i >= 0)
1230 	{
1231 	    if (first < 0)
1232 		first = included_patches[i];
1233 	    if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
1234 	    {
1235 		msg_puts(s);
1236 		s = ", ";
1237 		msg_outnum((long)first);
1238 		if (first != included_patches[i])
1239 		{
1240 		    msg_puts("-");
1241 		    msg_outnum((long)included_patches[i]);
1242 		}
1243 		first = -1;
1244 	    }
1245 	}
1246     }
1247 
1248     // Print the list of extra patch descriptions if there is at least one.
1249     if (extra_patches[0] != NULL)
1250     {
1251 	msg_puts(_("\nExtra patches: "));
1252 	s = "";
1253 	for (i = 0; extra_patches[i] != NULL; ++i)
1254 	{
1255 	    msg_puts(s);
1256 	    s = ", ";
1257 	    msg_puts(extra_patches[i]);
1258 	}
1259     }
1260 
1261 #ifdef MODIFIED_BY
1262     msg_puts("\n");
1263     msg_puts(_("Modified by "));
1264     msg_puts(MODIFIED_BY);
1265 #endif
1266 
1267 #ifdef HAVE_PATHDEF
1268     if (*compiled_user != NUL || *compiled_sys != NUL)
1269     {
1270 	msg_puts(_("\nCompiled "));
1271 	if (*compiled_user != NUL)
1272 	{
1273 	    msg_puts(_("by "));
1274 	    msg_puts((char *)compiled_user);
1275 	}
1276 	if (*compiled_sys != NUL)
1277 	{
1278 	    msg_puts("@");
1279 	    msg_puts((char *)compiled_sys);
1280 	}
1281     }
1282 #endif
1283 
1284 #ifdef FEAT_HUGE
1285     msg_puts(_("\nHuge version "));
1286 #else
1287 # ifdef FEAT_BIG
1288     msg_puts(_("\nBig version "));
1289 # else
1290 #  ifdef FEAT_NORMAL
1291     msg_puts(_("\nNormal version "));
1292 #  else
1293 #   ifdef FEAT_SMALL
1294     msg_puts(_("\nSmall version "));
1295 #   else
1296     msg_puts(_("\nTiny version "));
1297 #   endif
1298 #  endif
1299 # endif
1300 #endif
1301 #ifndef FEAT_GUI
1302     msg_puts(_("without GUI."));
1303 #else
1304 # ifdef FEAT_GUI_GTK
1305 #  ifdef USE_GTK3
1306     msg_puts(_("with GTK3 GUI."));
1307 #  else
1308 #   ifdef FEAT_GUI_GNOME
1309      msg_puts(_("with GTK2-GNOME GUI."));
1310 #   else
1311      msg_puts(_("with GTK2 GUI."));
1312 #   endif
1313 # endif
1314 # else
1315 #  ifdef FEAT_GUI_MOTIF
1316     msg_puts(_("with X11-Motif GUI."));
1317 #  else
1318 #   ifdef FEAT_GUI_ATHENA
1319 #    ifdef FEAT_GUI_NEXTAW
1320     msg_puts(_("with X11-neXtaw GUI."));
1321 #    else
1322     msg_puts(_("with X11-Athena GUI."));
1323 #    endif
1324 #   else
1325 #     ifdef FEAT_GUI_PHOTON
1326     msg_puts(_("with Photon GUI."));
1327 #     else
1328 #      if defined(MSWIN)
1329     msg_puts(_("with GUI."));
1330 #      else
1331 #	if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
1332     msg_puts(_("with Carbon GUI."));
1333 #	else
1334 #	 if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
1335     msg_puts(_("with Cocoa GUI."));
1336 #	 else
1337 #	 endif
1338 #	endif
1339 #      endif
1340 #    endif
1341 #   endif
1342 #  endif
1343 # endif
1344 #endif
1345     version_msg(_("  Features included (+) or not (-):\n"));
1346 
1347     list_features();
1348     if (msg_col > 0)
1349 	msg_putchar('\n');
1350 
1351 #ifdef SYS_VIMRC_FILE
1352     version_msg(_("   system vimrc file: \""));
1353     version_msg(SYS_VIMRC_FILE);
1354     version_msg("\"\n");
1355 #endif
1356 #ifdef USR_VIMRC_FILE
1357     version_msg(_("     user vimrc file: \""));
1358     version_msg(USR_VIMRC_FILE);
1359     version_msg("\"\n");
1360 #endif
1361 #ifdef USR_VIMRC_FILE2
1362     version_msg(_(" 2nd user vimrc file: \""));
1363     version_msg(USR_VIMRC_FILE2);
1364     version_msg("\"\n");
1365 #endif
1366 #ifdef USR_VIMRC_FILE3
1367     version_msg(_(" 3rd user vimrc file: \""));
1368     version_msg(USR_VIMRC_FILE3);
1369     version_msg("\"\n");
1370 #endif
1371 #ifdef USR_EXRC_FILE
1372     version_msg(_("      user exrc file: \""));
1373     version_msg(USR_EXRC_FILE);
1374     version_msg("\"\n");
1375 #endif
1376 #ifdef USR_EXRC_FILE2
1377     version_msg(_("  2nd user exrc file: \""));
1378     version_msg(USR_EXRC_FILE2);
1379     version_msg("\"\n");
1380 #endif
1381 #ifdef FEAT_GUI
1382 # ifdef SYS_GVIMRC_FILE
1383     version_msg(_("  system gvimrc file: \""));
1384     version_msg(SYS_GVIMRC_FILE);
1385     version_msg("\"\n");
1386 # endif
1387     version_msg(_("    user gvimrc file: \""));
1388     version_msg(USR_GVIMRC_FILE);
1389     version_msg("\"\n");
1390 # ifdef USR_GVIMRC_FILE2
1391     version_msg(_("2nd user gvimrc file: \""));
1392     version_msg(USR_GVIMRC_FILE2);
1393     version_msg("\"\n");
1394 # endif
1395 # ifdef USR_GVIMRC_FILE3
1396     version_msg(_("3rd user gvimrc file: \""));
1397     version_msg(USR_GVIMRC_FILE3);
1398     version_msg("\"\n");
1399 # endif
1400 #endif
1401     version_msg(_("       defaults file: \""));
1402     version_msg(VIM_DEFAULTS_FILE);
1403     version_msg("\"\n");
1404 #ifdef FEAT_GUI
1405 # ifdef SYS_MENU_FILE
1406     version_msg(_("    system menu file: \""));
1407     version_msg(SYS_MENU_FILE);
1408     version_msg("\"\n");
1409 # endif
1410 #endif
1411 #ifdef HAVE_PATHDEF
1412     if (*default_vim_dir != NUL)
1413     {
1414 	version_msg(_("  fall-back for $VIM: \""));
1415 	version_msg((char *)default_vim_dir);
1416 	version_msg("\"\n");
1417     }
1418     if (*default_vimruntime_dir != NUL)
1419     {
1420 	version_msg(_(" f-b for $VIMRUNTIME: \""));
1421 	version_msg((char *)default_vimruntime_dir);
1422 	version_msg("\"\n");
1423     }
1424     version_msg(_("Compilation: "));
1425     version_msg((char *)all_cflags);
1426     version_msg("\n");
1427 #ifdef VMS
1428     if (*compiler_version != NUL)
1429     {
1430 	version_msg(_("Compiler: "));
1431 	version_msg((char *)compiler_version);
1432 	version_msg("\n");
1433     }
1434 #endif
1435     version_msg(_("Linking: "));
1436     version_msg((char *)all_lflags);
1437 #endif
1438 #ifdef DEBUG
1439     version_msg("\n");
1440     version_msg(_("  DEBUG BUILD"));
1441 #endif
1442 }
1443 
1444 static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
1445 
1446 /*
1447  * Show the intro message when not editing a file.
1448  */
1449     void
1450 maybe_intro_message(void)
1451 {
1452     if (BUFEMPTY()
1453 	    && curbuf->b_fname == NULL
1454 	    && firstwin->w_next == NULL
1455 	    && vim_strchr(p_shm, SHM_INTRO) == NULL)
1456 	intro_message(FALSE);
1457 }
1458 
1459 /*
1460  * Give an introductory message about Vim.
1461  * Only used when starting Vim on an empty file, without a file name.
1462  * Or with the ":intro" command (for Sven :-).
1463  */
1464     void
1465 intro_message(
1466     int		colon)		// TRUE for ":intro"
1467 {
1468     int		i;
1469     int		row;
1470     int		blanklines;
1471     int		sponsor;
1472     char	*p;
1473     static char	*(lines[]) =
1474     {
1475 	N_("VIM - Vi IMproved"),
1476 	"",
1477 	N_("version "),
1478 	N_("by Bram Moolenaar et al."),
1479 #ifdef MODIFIED_BY
1480 	" ",
1481 #endif
1482 	N_("Vim is open source and freely distributable"),
1483 	"",
1484 	N_("Help poor children in Uganda!"),
1485 	N_("type  :help iccf<Enter>       for information "),
1486 	"",
1487 	N_("type  :q<Enter>               to exit         "),
1488 	N_("type  :help<Enter>  or  <F1>  for on-line help"),
1489 	N_("type  :help version8<Enter>   for version info"),
1490 	NULL,
1491 	"",
1492 	N_("Running in Vi compatible mode"),
1493 	N_("type  :set nocp<Enter>        for Vim defaults"),
1494 	N_("type  :help cp-default<Enter> for info on this"),
1495     };
1496 #ifdef FEAT_GUI
1497     static char	*(gui_lines[]) =
1498     {
1499 	NULL,
1500 	NULL,
1501 	NULL,
1502 	NULL,
1503 #ifdef MODIFIED_BY
1504 	NULL,
1505 #endif
1506 	NULL,
1507 	NULL,
1508 	NULL,
1509 	N_("menu  Help->Orphans           for information    "),
1510 	NULL,
1511 	N_("Running modeless, typed text is inserted"),
1512 	N_("menu  Edit->Global Settings->Toggle Insert Mode  "),
1513 	N_("                              for two modes      "),
1514 	NULL,
1515 	NULL,
1516 	NULL,
1517 	N_("menu  Edit->Global Settings->Toggle Vi Compatible"),
1518 	N_("                              for Vim defaults   "),
1519     };
1520 #endif
1521 
1522     // blanklines = screen height - # message lines
1523     blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1524     if (!p_cp)
1525 	blanklines += 4;  // add 4 for not showing "Vi compatible" message
1526 
1527     // Don't overwrite a statusline.  Depends on 'cmdheight'.
1528     if (p_ls > 1)
1529 	blanklines -= Rows - topframe->fr_height;
1530     if (blanklines < 0)
1531 	blanklines = 0;
1532 
1533     // Show the sponsor and register message one out of four times, the Uganda
1534     // message two out of four times.
1535     sponsor = (int)time(NULL);
1536     sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1537 
1538     // start displaying the message lines after half of the blank lines
1539     row = blanklines / 2;
1540     if ((row >= 2 && Columns >= 50) || colon)
1541     {
1542 	for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1543 	{
1544 	    p = lines[i];
1545 #ifdef FEAT_GUI
1546 	    if (p_im && gui.in_use && gui_lines[i] != NULL)
1547 		p = gui_lines[i];
1548 #endif
1549 	    if (p == NULL)
1550 	    {
1551 		if (!p_cp)
1552 		    break;
1553 		continue;
1554 	    }
1555 	    if (sponsor != 0)
1556 	    {
1557 		if (strstr(p, "children") != NULL)
1558 		    p = sponsor < 0
1559 			? N_("Sponsor Vim development!")
1560 			: N_("Become a registered Vim user!");
1561 		else if (strstr(p, "iccf") != NULL)
1562 		    p = sponsor < 0
1563 			? N_("type  :help sponsor<Enter>    for information ")
1564 			: N_("type  :help register<Enter>   for information ");
1565 		else if (strstr(p, "Orphans") != NULL)
1566 		    p = N_("menu  Help->Sponsor/Register  for information    ");
1567 	    }
1568 	    if (*p != NUL)
1569 		do_intro_line(row, (char_u *)_(p), i == 2, 0);
1570 	    ++row;
1571 	}
1572     }
1573 
1574     // Make the wait-return message appear just below the text.
1575     if (colon)
1576 	msg_row = row;
1577 }
1578 
1579     static void
1580 do_intro_line(
1581     int		row,
1582     char_u	*mesg,
1583     int		add_version,
1584     int		attr)
1585 {
1586     char_u	vers[20];
1587     int		col;
1588     char_u	*p;
1589     int		l;
1590     int		clen;
1591 #ifdef MODIFIED_BY
1592 # define MODBY_LEN 150
1593     char_u	modby[MODBY_LEN];
1594 
1595     if (*mesg == ' ')
1596     {
1597 	vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
1598 	l = (int)STRLEN(modby);
1599 	vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
1600 	mesg = modby;
1601     }
1602 #endif
1603 
1604     // Center the message horizontally.
1605     col = vim_strsize(mesg);
1606     if (add_version)
1607     {
1608 	STRCPY(vers, mediumVersion);
1609 	if (highest_patch())
1610 	{
1611 	    // Check for 9.9x or 9.9xx, alpha/beta version
1612 	    if (isalpha((int)vers[3]))
1613 	    {
1614 		int len = (isalpha((int)vers[4])) ? 5 : 4;
1615 		sprintf((char *)vers + len, ".%d%s", highest_patch(),
1616 							 mediumVersion + len);
1617 	    }
1618 	    else
1619 		sprintf((char *)vers + 3, ".%d", highest_patch());
1620 	}
1621 	col += (int)STRLEN(vers);
1622     }
1623     col = (Columns - col) / 2;
1624     if (col < 0)
1625 	col = 0;
1626 
1627     // Split up in parts to highlight <> items differently.
1628     for (p = mesg; *p != NUL; p += l)
1629     {
1630 	clen = 0;
1631 	for (l = 0; p[l] != NUL
1632 			 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1633 	{
1634 	    if (has_mbyte)
1635 	    {
1636 		clen += ptr2cells(p + l);
1637 		l += (*mb_ptr2len)(p + l) - 1;
1638 	    }
1639 	    else
1640 		clen += byte2cells(p[l]);
1641 	}
1642 	screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);
1643 	col += clen;
1644     }
1645 
1646     // Add the version number to the version line.
1647     if (add_version)
1648 	screen_puts(vers, row, col, 0);
1649 }
1650 
1651 /*
1652  * ":intro": clear screen, display intro screen and wait for return.
1653  */
1654     void
1655 ex_intro(exarg_T *eap UNUSED)
1656 {
1657     screenclear();
1658     intro_message(TRUE);
1659     wait_return(TRUE);
1660 }
1661