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