xref: /vim-8.2.3635/src/version.c (revision 191acfde)
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 	"+num64",
440 #ifdef FEAT_GUI_MSWIN
441 # ifdef FEAT_OLE
442 	"+ole",
443 # else
444 	"-ole",
445 # endif
446 #endif
447 #ifdef FEAT_EVAL
448 	"+packages",
449 #else
450 	"-packages",
451 #endif
452 #ifdef FEAT_PATH_EXTRA
453 	"+path_extra",
454 #else
455 	"-path_extra",
456 #endif
457 #ifdef FEAT_PERL
458 # ifdef DYNAMIC_PERL
459 	"+perl/dyn",
460 # else
461 	"+perl",
462 # endif
463 #else
464 	"-perl",
465 #endif
466 #ifdef FEAT_PERSISTENT_UNDO
467 	"+persistent_undo",
468 #else
469 	"-persistent_undo",
470 #endif
471 #ifdef FEAT_PROP_POPUP
472 	"+popupwin",
473 #else
474 	"-popupwin",
475 #endif
476 #ifdef FEAT_PRINTER
477 # ifdef FEAT_POSTSCRIPT
478 	"+postscript",
479 # else
480 	"-postscript",
481 # endif
482 	"+printer",
483 #else
484 	"-printer",
485 #endif
486 #ifdef FEAT_PROFILE
487 	"+profile",
488 #else
489 	"-profile",
490 #endif
491 #ifdef FEAT_PYTHON
492 # ifdef DYNAMIC_PYTHON
493 	"+python/dyn",
494 # else
495 	"+python",
496 # endif
497 #else
498 	"-python",
499 #endif
500 #ifdef FEAT_PYTHON3
501 # ifdef DYNAMIC_PYTHON3
502 	"+python3/dyn",
503 # else
504 	"+python3",
505 # endif
506 #else
507 	"-python3",
508 #endif
509 #ifdef FEAT_QUICKFIX
510 	"+quickfix",
511 #else
512 	"-quickfix",
513 #endif
514 #ifdef FEAT_RELTIME
515 	"+reltime",
516 #else
517 	"-reltime",
518 #endif
519 #ifdef FEAT_RIGHTLEFT
520 	"+rightleft",
521 #else
522 	"-rightleft",
523 #endif
524 #ifdef FEAT_RUBY
525 # ifdef DYNAMIC_RUBY
526 	"+ruby/dyn",
527 # else
528 	"+ruby",
529 # endif
530 #else
531 	"-ruby",
532 #endif
533 	"+scrollbind",
534 #ifdef FEAT_SIGNS
535 	"+signs",
536 #else
537 	"-signs",
538 #endif
539 #ifdef FEAT_SMARTINDENT
540 	"+smartindent",
541 #else
542 	"-smartindent",
543 #endif
544 #ifdef FEAT_SOUND
545 	"+sound",
546 #else
547 	"-sound",
548 #endif
549 #ifdef FEAT_SPELL
550 	"+spell",
551 #else
552 	"-spell",
553 #endif
554 #ifdef STARTUPTIME
555 	"+startuptime",
556 #else
557 	"-startuptime",
558 #endif
559 #ifdef FEAT_STL_OPT
560 	"+statusline",
561 #else
562 	"-statusline",
563 #endif
564 	"-sun_workshop",
565 #ifdef FEAT_SYN_HL
566 	"+syntax",
567 #else
568 	"-syntax",
569 #endif
570 	    // only interesting on Unix systems
571 #if defined(USE_SYSTEM) && defined(UNIX)
572 	"+system()",
573 #endif
574 #ifdef FEAT_TAG_BINS
575 	"+tag_binary",
576 #else
577 	"-tag_binary",
578 #endif
579 	"-tag_old_static",
580 	"-tag_any_white",
581 #ifdef FEAT_TCL
582 # ifdef DYNAMIC_TCL
583 	"+tcl/dyn",
584 # else
585 	"+tcl",
586 # endif
587 #else
588 	"-tcl",
589 #endif
590 #ifdef FEAT_TERMGUICOLORS
591 	"+termguicolors",
592 #else
593 	"-termguicolors",
594 #endif
595 #ifdef FEAT_TERMINAL
596 	"+terminal",
597 #else
598 	"-terminal",
599 #endif
600 #if defined(UNIX)
601 // only Unix can have terminfo instead of termcap
602 # ifdef TERMINFO
603 	"+terminfo",
604 # else
605 	"-terminfo",
606 # endif
607 #endif
608 #ifdef FEAT_TERMRESPONSE
609 	"+termresponse",
610 #else
611 	"-termresponse",
612 #endif
613 #ifdef FEAT_TEXTOBJ
614 	"+textobjects",
615 #else
616 	"-textobjects",
617 #endif
618 #ifdef FEAT_PROP_POPUP
619 	"+textprop",
620 #else
621 	"-textprop",
622 #endif
623 #if !defined(UNIX)
624 // unix always includes termcap support
625 # ifdef HAVE_TGETENT
626 	"+tgetent",
627 # else
628 	"-tgetent",
629 # endif
630 #endif
631 #ifdef FEAT_TIMERS
632 	"+timers",
633 #else
634 	"-timers",
635 #endif
636 #ifdef FEAT_TITLE
637 	"+title",
638 #else
639 	"-title",
640 #endif
641 #ifdef FEAT_TOOLBAR
642 	"+toolbar",
643 #else
644 	"-toolbar",
645 #endif
646 	"+user_commands",
647 #ifdef FEAT_VARTABS
648 	"+vartabs",
649 #else
650 	"-vartabs",
651 #endif
652 	"+vertsplit",
653 	"+virtualedit",
654 	"+visual",
655 	"+visualextra",
656 #ifdef FEAT_VIMINFO
657 	"+viminfo",
658 #else
659 	"-viminfo",
660 #endif
661 	"+vreplace",
662 #ifdef MSWIN
663 # ifdef FEAT_VTP
664 	"+vtp",
665 # else
666 	"-vtp",
667 # endif
668 #endif
669 #ifdef FEAT_WILDIGN
670 	"+wildignore",
671 #else
672 	"-wildignore",
673 #endif
674 #ifdef FEAT_WILDMENU
675 	"+wildmenu",
676 #else
677 	"-wildmenu",
678 #endif
679 	"+windows",
680 #ifdef FEAT_WRITEBACKUP
681 	"+writebackup",
682 #else
683 	"-writebackup",
684 #endif
685 #if defined(UNIX) || defined(VMS)
686 # ifdef FEAT_X11
687 	"+X11",
688 # else
689 	"-X11",
690 # endif
691 #endif
692 #ifdef FEAT_XFONTSET
693 	"+xfontset",
694 #else
695 	"-xfontset",
696 #endif
697 #ifdef FEAT_XIM
698 	"+xim",
699 #else
700 	"-xim",
701 #endif
702 #ifdef MSWIN
703 # ifdef FEAT_XPM_W32
704 	"+xpm_w32",
705 # else
706 	"-xpm_w32",
707 # endif
708 #else
709 # ifdef HAVE_XPM
710 	"+xpm",
711 # else
712 	"-xpm",
713 # endif
714 #endif
715 #if defined(UNIX) || defined(VMS)
716 # ifdef USE_XSMP_INTERACT
717 	"+xsmp_interact",
718 # else
719 #  ifdef USE_XSMP
720 	"+xsmp",
721 #  else
722 	"-xsmp",
723 #  endif
724 # endif
725 # ifdef FEAT_XCLIPBOARD
726 	"+xterm_clipboard",
727 # else
728 	"-xterm_clipboard",
729 # endif
730 #endif
731 #ifdef FEAT_XTERM_SAVE
732 	"+xterm_save",
733 #else
734 	"-xterm_save",
735 #endif
736 	NULL
737 };
738 
739 static int included_patches[] =
740 {   /* Add new patch number below this line */
741 /**/
742     462,
743 /**/
744     461,
745 /**/
746     460,
747 /**/
748     459,
749 /**/
750     458,
751 /**/
752     457,
753 /**/
754     456,
755 /**/
756     455,
757 /**/
758     454,
759 /**/
760     453,
761 /**/
762     452,
763 /**/
764     451,
765 /**/
766     450,
767 /**/
768     449,
769 /**/
770     448,
771 /**/
772     447,
773 /**/
774     446,
775 /**/
776     445,
777 /**/
778     444,
779 /**/
780     443,
781 /**/
782     442,
783 /**/
784     441,
785 /**/
786     440,
787 /**/
788     439,
789 /**/
790     438,
791 /**/
792     437,
793 /**/
794     436,
795 /**/
796     435,
797 /**/
798     434,
799 /**/
800     433,
801 /**/
802     432,
803 /**/
804     431,
805 /**/
806     430,
807 /**/
808     429,
809 /**/
810     428,
811 /**/
812     427,
813 /**/
814     426,
815 /**/
816     425,
817 /**/
818     424,
819 /**/
820     423,
821 /**/
822     422,
823 /**/
824     421,
825 /**/
826     420,
827 /**/
828     419,
829 /**/
830     418,
831 /**/
832     417,
833 /**/
834     416,
835 /**/
836     415,
837 /**/
838     414,
839 /**/
840     413,
841 /**/
842     412,
843 /**/
844     411,
845 /**/
846     410,
847 /**/
848     409,
849 /**/
850     408,
851 /**/
852     407,
853 /**/
854     406,
855 /**/
856     405,
857 /**/
858     404,
859 /**/
860     403,
861 /**/
862     402,
863 /**/
864     401,
865 /**/
866     400,
867 /**/
868     399,
869 /**/
870     398,
871 /**/
872     397,
873 /**/
874     396,
875 /**/
876     395,
877 /**/
878     394,
879 /**/
880     393,
881 /**/
882     392,
883 /**/
884     391,
885 /**/
886     390,
887 /**/
888     389,
889 /**/
890     388,
891 /**/
892     387,
893 /**/
894     386,
895 /**/
896     385,
897 /**/
898     384,
899 /**/
900     383,
901 /**/
902     382,
903 /**/
904     381,
905 /**/
906     380,
907 /**/
908     379,
909 /**/
910     378,
911 /**/
912     377,
913 /**/
914     376,
915 /**/
916     375,
917 /**/
918     374,
919 /**/
920     373,
921 /**/
922     372,
923 /**/
924     371,
925 /**/
926     370,
927 /**/
928     369,
929 /**/
930     368,
931 /**/
932     367,
933 /**/
934     366,
935 /**/
936     365,
937 /**/
938     364,
939 /**/
940     363,
941 /**/
942     362,
943 /**/
944     361,
945 /**/
946     360,
947 /**/
948     359,
949 /**/
950     358,
951 /**/
952     357,
953 /**/
954     356,
955 /**/
956     355,
957 /**/
958     354,
959 /**/
960     353,
961 /**/
962     352,
963 /**/
964     351,
965 /**/
966     350,
967 /**/
968     349,
969 /**/
970     348,
971 /**/
972     347,
973 /**/
974     346,
975 /**/
976     345,
977 /**/
978     344,
979 /**/
980     343,
981 /**/
982     342,
983 /**/
984     341,
985 /**/
986     340,
987 /**/
988     339,
989 /**/
990     338,
991 /**/
992     337,
993 /**/
994     336,
995 /**/
996     335,
997 /**/
998     334,
999 /**/
1000     333,
1001 /**/
1002     332,
1003 /**/
1004     331,
1005 /**/
1006     330,
1007 /**/
1008     329,
1009 /**/
1010     328,
1011 /**/
1012     327,
1013 /**/
1014     326,
1015 /**/
1016     325,
1017 /**/
1018     324,
1019 /**/
1020     323,
1021 /**/
1022     322,
1023 /**/
1024     321,
1025 /**/
1026     320,
1027 /**/
1028     319,
1029 /**/
1030     318,
1031 /**/
1032     317,
1033 /**/
1034     316,
1035 /**/
1036     315,
1037 /**/
1038     314,
1039 /**/
1040     313,
1041 /**/
1042     312,
1043 /**/
1044     311,
1045 /**/
1046     310,
1047 /**/
1048     309,
1049 /**/
1050     308,
1051 /**/
1052     307,
1053 /**/
1054     306,
1055 /**/
1056     305,
1057 /**/
1058     304,
1059 /**/
1060     303,
1061 /**/
1062     302,
1063 /**/
1064     301,
1065 /**/
1066     300,
1067 /**/
1068     299,
1069 /**/
1070     298,
1071 /**/
1072     297,
1073 /**/
1074     296,
1075 /**/
1076     295,
1077 /**/
1078     294,
1079 /**/
1080     293,
1081 /**/
1082     292,
1083 /**/
1084     291,
1085 /**/
1086     290,
1087 /**/
1088     289,
1089 /**/
1090     288,
1091 /**/
1092     287,
1093 /**/
1094     286,
1095 /**/
1096     285,
1097 /**/
1098     284,
1099 /**/
1100     283,
1101 /**/
1102     282,
1103 /**/
1104     281,
1105 /**/
1106     280,
1107 /**/
1108     279,
1109 /**/
1110     278,
1111 /**/
1112     277,
1113 /**/
1114     276,
1115 /**/
1116     275,
1117 /**/
1118     274,
1119 /**/
1120     273,
1121 /**/
1122     272,
1123 /**/
1124     271,
1125 /**/
1126     270,
1127 /**/
1128     269,
1129 /**/
1130     268,
1131 /**/
1132     267,
1133 /**/
1134     266,
1135 /**/
1136     265,
1137 /**/
1138     264,
1139 /**/
1140     263,
1141 /**/
1142     262,
1143 /**/
1144     261,
1145 /**/
1146     260,
1147 /**/
1148     259,
1149 /**/
1150     258,
1151 /**/
1152     257,
1153 /**/
1154     256,
1155 /**/
1156     255,
1157 /**/
1158     254,
1159 /**/
1160     253,
1161 /**/
1162     252,
1163 /**/
1164     251,
1165 /**/
1166     250,
1167 /**/
1168     249,
1169 /**/
1170     248,
1171 /**/
1172     247,
1173 /**/
1174     246,
1175 /**/
1176     245,
1177 /**/
1178     244,
1179 /**/
1180     243,
1181 /**/
1182     242,
1183 /**/
1184     241,
1185 /**/
1186     240,
1187 /**/
1188     239,
1189 /**/
1190     238,
1191 /**/
1192     237,
1193 /**/
1194     236,
1195 /**/
1196     235,
1197 /**/
1198     234,
1199 /**/
1200     233,
1201 /**/
1202     232,
1203 /**/
1204     231,
1205 /**/
1206     230,
1207 /**/
1208     229,
1209 /**/
1210     228,
1211 /**/
1212     227,
1213 /**/
1214     226,
1215 /**/
1216     225,
1217 /**/
1218     224,
1219 /**/
1220     223,
1221 /**/
1222     222,
1223 /**/
1224     221,
1225 /**/
1226     220,
1227 /**/
1228     219,
1229 /**/
1230     218,
1231 /**/
1232     217,
1233 /**/
1234     216,
1235 /**/
1236     215,
1237 /**/
1238     214,
1239 /**/
1240     213,
1241 /**/
1242     212,
1243 /**/
1244     211,
1245 /**/
1246     210,
1247 /**/
1248     209,
1249 /**/
1250     208,
1251 /**/
1252     207,
1253 /**/
1254     206,
1255 /**/
1256     205,
1257 /**/
1258     204,
1259 /**/
1260     203,
1261 /**/
1262     202,
1263 /**/
1264     201,
1265 /**/
1266     200,
1267 /**/
1268     199,
1269 /**/
1270     198,
1271 /**/
1272     197,
1273 /**/
1274     196,
1275 /**/
1276     195,
1277 /**/
1278     194,
1279 /**/
1280     193,
1281 /**/
1282     192,
1283 /**/
1284     191,
1285 /**/
1286     190,
1287 /**/
1288     189,
1289 /**/
1290     188,
1291 /**/
1292     187,
1293 /**/
1294     186,
1295 /**/
1296     185,
1297 /**/
1298     184,
1299 /**/
1300     183,
1301 /**/
1302     182,
1303 /**/
1304     181,
1305 /**/
1306     180,
1307 /**/
1308     179,
1309 /**/
1310     178,
1311 /**/
1312     177,
1313 /**/
1314     176,
1315 /**/
1316     175,
1317 /**/
1318     174,
1319 /**/
1320     173,
1321 /**/
1322     172,
1323 /**/
1324     171,
1325 /**/
1326     170,
1327 /**/
1328     169,
1329 /**/
1330     168,
1331 /**/
1332     167,
1333 /**/
1334     166,
1335 /**/
1336     165,
1337 /**/
1338     164,
1339 /**/
1340     163,
1341 /**/
1342     162,
1343 /**/
1344     161,
1345 /**/
1346     160,
1347 /**/
1348     159,
1349 /**/
1350     158,
1351 /**/
1352     157,
1353 /**/
1354     156,
1355 /**/
1356     155,
1357 /**/
1358     154,
1359 /**/
1360     153,
1361 /**/
1362     152,
1363 /**/
1364     151,
1365 /**/
1366     150,
1367 /**/
1368     149,
1369 /**/
1370     148,
1371 /**/
1372     147,
1373 /**/
1374     146,
1375 /**/
1376     145,
1377 /**/
1378     144,
1379 /**/
1380     143,
1381 /**/
1382     142,
1383 /**/
1384     141,
1385 /**/
1386     140,
1387 /**/
1388     139,
1389 /**/
1390     138,
1391 /**/
1392     137,
1393 /**/
1394     136,
1395 /**/
1396     135,
1397 /**/
1398     134,
1399 /**/
1400     133,
1401 /**/
1402     132,
1403 /**/
1404     131,
1405 /**/
1406     130,
1407 /**/
1408     129,
1409 /**/
1410     128,
1411 /**/
1412     127,
1413 /**/
1414     126,
1415 /**/
1416     125,
1417 /**/
1418     124,
1419 /**/
1420     123,
1421 /**/
1422     122,
1423 /**/
1424     121,
1425 /**/
1426     120,
1427 /**/
1428     119,
1429 /**/
1430     118,
1431 /**/
1432     117,
1433 /**/
1434     116,
1435 /**/
1436     115,
1437 /**/
1438     114,
1439 /**/
1440     113,
1441 /**/
1442     112,
1443 /**/
1444     111,
1445 /**/
1446     110,
1447 /**/
1448     109,
1449 /**/
1450     108,
1451 /**/
1452     107,
1453 /**/
1454     106,
1455 /**/
1456     105,
1457 /**/
1458     104,
1459 /**/
1460     103,
1461 /**/
1462     102,
1463 /**/
1464     101,
1465 /**/
1466     100,
1467 /**/
1468     99,
1469 /**/
1470     98,
1471 /**/
1472     97,
1473 /**/
1474     96,
1475 /**/
1476     95,
1477 /**/
1478     94,
1479 /**/
1480     93,
1481 /**/
1482     92,
1483 /**/
1484     91,
1485 /**/
1486     90,
1487 /**/
1488     89,
1489 /**/
1490     88,
1491 /**/
1492     87,
1493 /**/
1494     86,
1495 /**/
1496     85,
1497 /**/
1498     84,
1499 /**/
1500     83,
1501 /**/
1502     82,
1503 /**/
1504     81,
1505 /**/
1506     80,
1507 /**/
1508     79,
1509 /**/
1510     78,
1511 /**/
1512     77,
1513 /**/
1514     76,
1515 /**/
1516     75,
1517 /**/
1518     74,
1519 /**/
1520     73,
1521 /**/
1522     72,
1523 /**/
1524     71,
1525 /**/
1526     70,
1527 /**/
1528     69,
1529 /**/
1530     68,
1531 /**/
1532     67,
1533 /**/
1534     66,
1535 /**/
1536     65,
1537 /**/
1538     64,
1539 /**/
1540     63,
1541 /**/
1542     62,
1543 /**/
1544     61,
1545 /**/
1546     60,
1547 /**/
1548     59,
1549 /**/
1550     58,
1551 /**/
1552     57,
1553 /**/
1554     56,
1555 /**/
1556     55,
1557 /**/
1558     54,
1559 /**/
1560     53,
1561 /**/
1562     52,
1563 /**/
1564     51,
1565 /**/
1566     50,
1567 /**/
1568     49,
1569 /**/
1570     48,
1571 /**/
1572     47,
1573 /**/
1574     46,
1575 /**/
1576     45,
1577 /**/
1578     44,
1579 /**/
1580     43,
1581 /**/
1582     42,
1583 /**/
1584     41,
1585 /**/
1586     40,
1587 /**/
1588     39,
1589 /**/
1590     38,
1591 /**/
1592     37,
1593 /**/
1594     36,
1595 /**/
1596     35,
1597 /**/
1598     34,
1599 /**/
1600     33,
1601 /**/
1602     32,
1603 /**/
1604     31,
1605 /**/
1606     30,
1607 /**/
1608     29,
1609 /**/
1610     28,
1611 /**/
1612     27,
1613 /**/
1614     26,
1615 /**/
1616     25,
1617 /**/
1618     24,
1619 /**/
1620     23,
1621 /**/
1622     22,
1623 /**/
1624     21,
1625 /**/
1626     20,
1627 /**/
1628     19,
1629 /**/
1630     18,
1631 /**/
1632     17,
1633 /**/
1634     16,
1635 /**/
1636     15,
1637 /**/
1638     14,
1639 /**/
1640     13,
1641 /**/
1642     12,
1643 /**/
1644     11,
1645 /**/
1646     10,
1647 /**/
1648     9,
1649 /**/
1650     8,
1651 /**/
1652     7,
1653 /**/
1654     6,
1655 /**/
1656     5,
1657 /**/
1658     4,
1659 /**/
1660     3,
1661 /**/
1662     2,
1663 /**/
1664     1,
1665 /**/
1666     0
1667 };
1668 
1669 /*
1670  * Place to put a short description when adding a feature with a patch.
1671  * Keep it short, e.g.,: "relative numbers", "persistent undo".
1672  * Also add a comment marker to separate the lines.
1673  * See the official Vim patches for the diff format: It must use a context of
1674  * one line only.  Create it by hand or use "diff -C2" and edit the patch.
1675  */
1676 static char *(extra_patches[]) =
1677 {   /* Add your patch description below this line */
1678 /**/
1679     NULL
1680 };
1681 
1682     int
1683 highest_patch(void)
1684 {
1685     // this relies on the highest patch number to be the first entry
1686     return included_patches[0];
1687 }
1688 
1689 #if defined(FEAT_EVAL) || defined(PROTO)
1690 /*
1691  * Return TRUE if patch "n" has been included.
1692  */
1693     int
1694 has_patch(int n)
1695 {
1696     int		i;
1697 
1698     for (i = 0; included_patches[i] != 0; ++i)
1699 	if (included_patches[i] == n)
1700 	    return TRUE;
1701     return FALSE;
1702 }
1703 #endif
1704 
1705     void
1706 ex_version(exarg_T *eap)
1707 {
1708     /*
1709      * Ignore a ":version 9.99" command.
1710      */
1711     if (*eap->arg == NUL)
1712     {
1713 	msg_putchar('\n');
1714 	list_version();
1715     }
1716 }
1717 
1718 /*
1719  * Output a string for the version message.  If it's going to wrap, output a
1720  * newline, unless the message is too long to fit on the screen anyway.
1721  * When "wrap" is TRUE wrap the string in [].
1722  */
1723     static void
1724 version_msg_wrap(char_u *s, int wrap)
1725 {
1726     int		len = (int)vim_strsize(s) + (wrap ? 2 : 0);
1727 
1728     if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
1729 								&& *s != '\n')
1730 	msg_putchar('\n');
1731     if (!got_int)
1732     {
1733 	if (wrap)
1734 	    msg_puts("[");
1735 	msg_puts((char *)s);
1736 	if (wrap)
1737 	    msg_puts("]");
1738     }
1739 }
1740 
1741     static void
1742 version_msg(char *s)
1743 {
1744     version_msg_wrap((char_u *)s, FALSE);
1745 }
1746 
1747 /*
1748  * List all features aligned in columns, dictionary style.
1749  */
1750     static void
1751 list_features(void)
1752 {
1753     list_in_columns((char_u **)features, -1, -1);
1754 }
1755 
1756 /*
1757  * List string items nicely aligned in columns.
1758  * When "size" is < 0 then the last entry is marked with NULL.
1759  * The entry with index "current" is inclosed in [].
1760  */
1761     void
1762 list_in_columns(char_u **items, int size, int current)
1763 {
1764     int		i;
1765     int		ncol;
1766     int		nrow;
1767     int		cur_row = 1;
1768     int		item_count = 0;
1769     int		width = 0;
1770 #ifdef FEAT_SYN_HL
1771     int		use_highlight = (items == (char_u **)features);
1772 #endif
1773 
1774     // Find the length of the longest item, use that + 1 as the column
1775     // width.
1776     for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
1777     {
1778 	int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0);
1779 
1780 	if (l > width)
1781 	    width = l;
1782 	++item_count;
1783     }
1784     width += 1;
1785 
1786     if (Columns < width)
1787     {
1788 	// Not enough screen columns - show one per line
1789 	for (i = 0; i < item_count; ++i)
1790 	{
1791 	    version_msg_wrap(items[i], i == current);
1792 	    if (msg_col > 0 && i < item_count - 1)
1793 		msg_putchar('\n');
1794 	}
1795 	return;
1796     }
1797 
1798     // The rightmost column doesn't need a separator.
1799     // Sacrifice it to fit in one more column if possible.
1800     ncol = (int) (Columns + 1) / width;
1801     nrow = item_count / ncol + (item_count % ncol ? 1 : 0);
1802 
1803     // "i" counts columns then rows.  "idx" counts rows then columns.
1804     for (i = 0; !got_int && i < nrow * ncol; ++i)
1805     {
1806 	int idx = (i / ncol) + (i % ncol) * nrow;
1807 
1808 	if (idx < item_count)
1809 	{
1810 	    int last_col = (i + 1) % ncol == 0;
1811 
1812 	    if (idx == current)
1813 		msg_putchar('[');
1814 #ifdef FEAT_SYN_HL
1815 	    if (use_highlight && items[idx][0] == '-')
1816 		msg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));
1817 	    else
1818 #endif
1819 		msg_puts((char *)items[idx]);
1820 	    if (idx == current)
1821 		msg_putchar(']');
1822 	    if (last_col)
1823 	    {
1824 		if (msg_col > 0 && cur_row < nrow)
1825 		    msg_putchar('\n');
1826 		++cur_row;
1827 	    }
1828 	    else
1829 	    {
1830 		while (msg_col % width)
1831 		    msg_putchar(' ');
1832 	    }
1833 	}
1834 	else
1835 	{
1836 	    // this row is out of items, thus at the end of the row
1837 	    if (msg_col > 0)
1838 	    {
1839 		if (cur_row < nrow)
1840 		    msg_putchar('\n');
1841 		++cur_row;
1842 	    }
1843 	}
1844     }
1845 }
1846 
1847     void
1848 list_version(void)
1849 {
1850     int		i;
1851     int		first;
1852     char	*s = "";
1853 
1854     /*
1855      * When adding features here, don't forget to update the list of
1856      * internal variables in eval.c!
1857      */
1858     init_longVersion();
1859     msg(longVersion);
1860 #ifdef MSWIN
1861 # ifdef FEAT_GUI_MSWIN
1862 #  ifdef VIMDLL
1863 #   ifdef _WIN64
1864     msg_puts(_("\nMS-Windows 64-bit GUI/console version"));
1865 #   else
1866     msg_puts(_("\nMS-Windows 32-bit GUI/console version"));
1867 #   endif
1868 #  else
1869 #   ifdef _WIN64
1870     msg_puts(_("\nMS-Windows 64-bit GUI version"));
1871 #   else
1872     msg_puts(_("\nMS-Windows 32-bit GUI version"));
1873 #   endif
1874 #  endif
1875 #  ifdef FEAT_OLE
1876     msg_puts(_(" with OLE support"));
1877 #  endif
1878 # else
1879 #  ifdef _WIN64
1880     msg_puts(_("\nMS-Windows 64-bit console version"));
1881 #  else
1882     msg_puts(_("\nMS-Windows 32-bit console version"));
1883 #  endif
1884 # endif
1885 #endif
1886 #if defined(MACOS_X)
1887 # if defined(MACOS_X_DARWIN)
1888     msg_puts(_("\nmacOS version"));
1889 # else
1890     msg_puts(_("\nmacOS version w/o darwin feat."));
1891 # endif
1892 #endif
1893 
1894 #ifdef VMS
1895     msg_puts(_("\nOpenVMS version"));
1896 # ifdef HAVE_PATHDEF
1897     if (*compiled_arch != NUL)
1898     {
1899 	msg_puts(" - ");
1900 	msg_puts((char *)compiled_arch);
1901     }
1902 # endif
1903 
1904 #endif
1905 
1906     // Print the list of patch numbers if there is at least one.
1907     // Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45"
1908     if (included_patches[0] != 0)
1909     {
1910 	msg_puts(_("\nIncluded patches: "));
1911 	first = -1;
1912 	// find last one
1913 	for (i = 0; included_patches[i] != 0; ++i)
1914 	    ;
1915 	while (--i >= 0)
1916 	{
1917 	    if (first < 0)
1918 		first = included_patches[i];
1919 	    if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
1920 	    {
1921 		msg_puts(s);
1922 		s = ", ";
1923 		msg_outnum((long)first);
1924 		if (first != included_patches[i])
1925 		{
1926 		    msg_puts("-");
1927 		    msg_outnum((long)included_patches[i]);
1928 		}
1929 		first = -1;
1930 	    }
1931 	}
1932     }
1933 
1934     // Print the list of extra patch descriptions if there is at least one.
1935     if (extra_patches[0] != NULL)
1936     {
1937 	msg_puts(_("\nExtra patches: "));
1938 	s = "";
1939 	for (i = 0; extra_patches[i] != NULL; ++i)
1940 	{
1941 	    msg_puts(s);
1942 	    s = ", ";
1943 	    msg_puts(extra_patches[i]);
1944 	}
1945     }
1946 
1947 #ifdef MODIFIED_BY
1948     msg_puts("\n");
1949     msg_puts(_("Modified by "));
1950     msg_puts(MODIFIED_BY);
1951 #endif
1952 
1953 #ifdef HAVE_PATHDEF
1954     if (*compiled_user != NUL || *compiled_sys != NUL)
1955     {
1956 	msg_puts(_("\nCompiled "));
1957 	if (*compiled_user != NUL)
1958 	{
1959 	    msg_puts(_("by "));
1960 	    msg_puts((char *)compiled_user);
1961 	}
1962 	if (*compiled_sys != NUL)
1963 	{
1964 	    msg_puts("@");
1965 	    msg_puts((char *)compiled_sys);
1966 	}
1967     }
1968 #endif
1969 
1970 #ifdef FEAT_HUGE
1971     msg_puts(_("\nHuge version "));
1972 #else
1973 # ifdef FEAT_BIG
1974     msg_puts(_("\nBig version "));
1975 # else
1976 #  ifdef FEAT_NORMAL
1977     msg_puts(_("\nNormal version "));
1978 #  else
1979 #   ifdef FEAT_SMALL
1980     msg_puts(_("\nSmall version "));
1981 #   else
1982     msg_puts(_("\nTiny version "));
1983 #   endif
1984 #  endif
1985 # endif
1986 #endif
1987 #ifndef FEAT_GUI
1988     msg_puts(_("without GUI."));
1989 #else
1990 # ifdef FEAT_GUI_GTK
1991 #  ifdef USE_GTK3
1992     msg_puts(_("with GTK3 GUI."));
1993 #  else
1994 #   ifdef FEAT_GUI_GNOME
1995      msg_puts(_("with GTK2-GNOME GUI."));
1996 #   else
1997      msg_puts(_("with GTK2 GUI."));
1998 #   endif
1999 # endif
2000 # else
2001 #  ifdef FEAT_GUI_MOTIF
2002     msg_puts(_("with X11-Motif GUI."));
2003 #  else
2004 #   ifdef FEAT_GUI_ATHENA
2005 #    ifdef FEAT_GUI_NEXTAW
2006     msg_puts(_("with X11-neXtaw GUI."));
2007 #    else
2008     msg_puts(_("with X11-Athena GUI."));
2009 #    endif
2010 #   else
2011 #    ifdef FEAT_GUI_HAIKU
2012     msg_puts(_("with Haiku GUI."));
2013 #    else
2014 #     ifdef FEAT_GUI_PHOTON
2015     msg_puts(_("with Photon GUI."));
2016 #     else
2017 #      if defined(MSWIN)
2018     msg_puts(_("with GUI."));
2019 #      else
2020 #	if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
2021     msg_puts(_("with Carbon GUI."));
2022 #	else
2023 #	 if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
2024     msg_puts(_("with Cocoa GUI."));
2025 #	 else
2026 #	 endif
2027 #	endif
2028 #	 endif
2029 #      endif
2030 #    endif
2031 #   endif
2032 #  endif
2033 # endif
2034 #endif
2035     version_msg(_("  Features included (+) or not (-):\n"));
2036 
2037     list_features();
2038     if (msg_col > 0)
2039 	msg_putchar('\n');
2040 
2041 #ifdef SYS_VIMRC_FILE
2042     version_msg(_("   system vimrc file: \""));
2043     version_msg(SYS_VIMRC_FILE);
2044     version_msg("\"\n");
2045 #endif
2046 #ifdef USR_VIMRC_FILE
2047     version_msg(_("     user vimrc file: \""));
2048     version_msg(USR_VIMRC_FILE);
2049     version_msg("\"\n");
2050 #endif
2051 #ifdef USR_VIMRC_FILE2
2052     version_msg(_(" 2nd user vimrc file: \""));
2053     version_msg(USR_VIMRC_FILE2);
2054     version_msg("\"\n");
2055 #endif
2056 #ifdef USR_VIMRC_FILE3
2057     version_msg(_(" 3rd user vimrc file: \""));
2058     version_msg(USR_VIMRC_FILE3);
2059     version_msg("\"\n");
2060 #endif
2061 #ifdef USR_EXRC_FILE
2062     version_msg(_("      user exrc file: \""));
2063     version_msg(USR_EXRC_FILE);
2064     version_msg("\"\n");
2065 #endif
2066 #ifdef USR_EXRC_FILE2
2067     version_msg(_("  2nd user exrc file: \""));
2068     version_msg(USR_EXRC_FILE2);
2069     version_msg("\"\n");
2070 #endif
2071 #ifdef FEAT_GUI
2072 # ifdef SYS_GVIMRC_FILE
2073     version_msg(_("  system gvimrc file: \""));
2074     version_msg(SYS_GVIMRC_FILE);
2075     version_msg("\"\n");
2076 # endif
2077     version_msg(_("    user gvimrc file: \""));
2078     version_msg(USR_GVIMRC_FILE);
2079     version_msg("\"\n");
2080 # ifdef USR_GVIMRC_FILE2
2081     version_msg(_("2nd user gvimrc file: \""));
2082     version_msg(USR_GVIMRC_FILE2);
2083     version_msg("\"\n");
2084 # endif
2085 # ifdef USR_GVIMRC_FILE3
2086     version_msg(_("3rd user gvimrc file: \""));
2087     version_msg(USR_GVIMRC_FILE3);
2088     version_msg("\"\n");
2089 # endif
2090 #endif
2091     version_msg(_("       defaults file: \""));
2092     version_msg(VIM_DEFAULTS_FILE);
2093     version_msg("\"\n");
2094 #ifdef FEAT_GUI
2095 # ifdef SYS_MENU_FILE
2096     version_msg(_("    system menu file: \""));
2097     version_msg(SYS_MENU_FILE);
2098     version_msg("\"\n");
2099 # endif
2100 #endif
2101 #ifdef HAVE_PATHDEF
2102     if (*default_vim_dir != NUL)
2103     {
2104 	version_msg(_("  fall-back for $VIM: \""));
2105 	version_msg((char *)default_vim_dir);
2106 	version_msg("\"\n");
2107     }
2108     if (*default_vimruntime_dir != NUL)
2109     {
2110 	version_msg(_(" f-b for $VIMRUNTIME: \""));
2111 	version_msg((char *)default_vimruntime_dir);
2112 	version_msg("\"\n");
2113     }
2114     version_msg(_("Compilation: "));
2115     version_msg((char *)all_cflags);
2116     version_msg("\n");
2117 #ifdef VMS
2118     if (*compiler_version != NUL)
2119     {
2120 	version_msg(_("Compiler: "));
2121 	version_msg((char *)compiler_version);
2122 	version_msg("\n");
2123     }
2124 #endif
2125     version_msg(_("Linking: "));
2126     version_msg((char *)all_lflags);
2127 #endif
2128 #ifdef DEBUG
2129     version_msg("\n");
2130     version_msg(_("  DEBUG BUILD"));
2131 #endif
2132 }
2133 
2134 static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
2135 
2136 /*
2137  * Show the intro message when not editing a file.
2138  */
2139     void
2140 maybe_intro_message(void)
2141 {
2142     if (BUFEMPTY()
2143 	    && curbuf->b_fname == NULL
2144 	    && firstwin->w_next == NULL
2145 	    && vim_strchr(p_shm, SHM_INTRO) == NULL)
2146 	intro_message(FALSE);
2147 }
2148 
2149 /*
2150  * Give an introductory message about Vim.
2151  * Only used when starting Vim on an empty file, without a file name.
2152  * Or with the ":intro" command (for Sven :-).
2153  */
2154     void
2155 intro_message(
2156     int		colon)		// TRUE for ":intro"
2157 {
2158     int		i;
2159     int		row;
2160     int		blanklines;
2161     int		sponsor;
2162     char	*p;
2163     static char	*(lines[]) =
2164     {
2165 	N_("VIM - Vi IMproved"),
2166 	"",
2167 	N_("version "),
2168 	N_("by Bram Moolenaar et al."),
2169 #ifdef MODIFIED_BY
2170 	" ",
2171 #endif
2172 	N_("Vim is open source and freely distributable"),
2173 	"",
2174 	N_("Help poor children in Uganda!"),
2175 	N_("type  :help iccf<Enter>       for information "),
2176 	"",
2177 	N_("type  :q<Enter>               to exit         "),
2178 	N_("type  :help<Enter>  or  <F1>  for on-line help"),
2179 	N_("type  :help version8<Enter>   for version info"),
2180 	NULL,
2181 	"",
2182 	N_("Running in Vi compatible mode"),
2183 	N_("type  :set nocp<Enter>        for Vim defaults"),
2184 	N_("type  :help cp-default<Enter> for info on this"),
2185     };
2186 #ifdef FEAT_GUI
2187     static char	*(gui_lines[]) =
2188     {
2189 	NULL,
2190 	NULL,
2191 	NULL,
2192 	NULL,
2193 #ifdef MODIFIED_BY
2194 	NULL,
2195 #endif
2196 	NULL,
2197 	NULL,
2198 	NULL,
2199 	N_("menu  Help->Orphans           for information    "),
2200 	NULL,
2201 	N_("Running modeless, typed text is inserted"),
2202 	N_("menu  Edit->Global Settings->Toggle Insert Mode  "),
2203 	N_("                              for two modes      "),
2204 	NULL,
2205 	NULL,
2206 	NULL,
2207 	N_("menu  Edit->Global Settings->Toggle Vi Compatible"),
2208 	N_("                              for Vim defaults   "),
2209     };
2210 #endif
2211 
2212     // blanklines = screen height - # message lines
2213     blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
2214     if (!p_cp)
2215 	blanklines += 4;  // add 4 for not showing "Vi compatible" message
2216 
2217     // Don't overwrite a statusline.  Depends on 'cmdheight'.
2218     if (p_ls > 1)
2219 	blanklines -= Rows - topframe->fr_height;
2220     if (blanklines < 0)
2221 	blanklines = 0;
2222 
2223     // Show the sponsor and register message one out of four times, the Uganda
2224     // message two out of four times.
2225     sponsor = (int)time(NULL);
2226     sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
2227 
2228     // start displaying the message lines after half of the blank lines
2229     row = blanklines / 2;
2230     if ((row >= 2 && Columns >= 50) || colon)
2231     {
2232 	for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
2233 	{
2234 	    p = lines[i];
2235 #ifdef FEAT_GUI
2236 	    if (p_im && gui.in_use && gui_lines[i] != NULL)
2237 		p = gui_lines[i];
2238 #endif
2239 	    if (p == NULL)
2240 	    {
2241 		if (!p_cp)
2242 		    break;
2243 		continue;
2244 	    }
2245 	    if (sponsor != 0)
2246 	    {
2247 		if (strstr(p, "children") != NULL)
2248 		    p = sponsor < 0
2249 			? N_("Sponsor Vim development!")
2250 			: N_("Become a registered Vim user!");
2251 		else if (strstr(p, "iccf") != NULL)
2252 		    p = sponsor < 0
2253 			? N_("type  :help sponsor<Enter>    for information ")
2254 			: N_("type  :help register<Enter>   for information ");
2255 		else if (strstr(p, "Orphans") != NULL)
2256 		    p = N_("menu  Help->Sponsor/Register  for information    ");
2257 	    }
2258 	    if (*p != NUL)
2259 		do_intro_line(row, (char_u *)_(p), i == 2, 0);
2260 	    ++row;
2261 	}
2262     }
2263 
2264     // Make the wait-return message appear just below the text.
2265     if (colon)
2266 	msg_row = row;
2267 }
2268 
2269     static void
2270 do_intro_line(
2271     int		row,
2272     char_u	*mesg,
2273     int		add_version,
2274     int		attr)
2275 {
2276     char_u	vers[20];
2277     int		col;
2278     char_u	*p;
2279     int		l;
2280     int		clen;
2281 #ifdef MODIFIED_BY
2282 # define MODBY_LEN 150
2283     char_u	modby[MODBY_LEN];
2284 
2285     if (*mesg == ' ')
2286     {
2287 	vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
2288 	l = (int)STRLEN(modby);
2289 	vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
2290 	mesg = modby;
2291     }
2292 #endif
2293 
2294     // Center the message horizontally.
2295     col = vim_strsize(mesg);
2296     if (add_version)
2297     {
2298 	STRCPY(vers, mediumVersion);
2299 	if (highest_patch())
2300 	{
2301 	    // Check for 9.9x or 9.9xx, alpha/beta version
2302 	    if (isalpha((int)vers[3]))
2303 	    {
2304 		int len = (isalpha((int)vers[4])) ? 5 : 4;
2305 		sprintf((char *)vers + len, ".%d%s", highest_patch(),
2306 							 mediumVersion + len);
2307 	    }
2308 	    else
2309 		sprintf((char *)vers + 3, ".%d", highest_patch());
2310 	}
2311 	col += (int)STRLEN(vers);
2312     }
2313     col = (Columns - col) / 2;
2314     if (col < 0)
2315 	col = 0;
2316 
2317     // Split up in parts to highlight <> items differently.
2318     for (p = mesg; *p != NUL; p += l)
2319     {
2320 	clen = 0;
2321 	for (l = 0; p[l] != NUL
2322 			 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
2323 	{
2324 	    if (has_mbyte)
2325 	    {
2326 		clen += ptr2cells(p + l);
2327 		l += (*mb_ptr2len)(p + l) - 1;
2328 	    }
2329 	    else
2330 		clen += byte2cells(p[l]);
2331 	}
2332 	screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);
2333 	col += clen;
2334     }
2335 
2336     // Add the version number to the version line.
2337     if (add_version)
2338 	screen_puts(vers, row, col, 0);
2339 }
2340 
2341 /*
2342  * ":intro": clear screen, display intro screen and wait for return.
2343  */
2344     void
2345 ex_intro(exarg_T *eap UNUSED)
2346 {
2347     screenclear();
2348     intro_message(TRUE);
2349     wait_return(TRUE);
2350 }
2351