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