blob: bb0f25b25fa593e1a7be2859b0101d64eb9cbdce [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
30char *Version = VIM_VERSION_SHORT;
31char *mediumVersion = VIM_VERSION_MEDIUM;
32
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
424#ifdef FEAT_PYTHON
425# ifdef DYNAMIC_PYTHON
426 "+python/dyn",
427# else
428 "+python",
429# endif
430#else
431 "-python",
432#endif
433#ifdef FEAT_QUICKFIX
434 "+quickfix",
435#else
436 "-quickfix",
437#endif
438#ifdef FEAT_RIGHTLEFT
439 "+rightleft",
440#else
441 "-rightleft",
442#endif
443#ifdef FEAT_RUBY
444# ifdef DYNAMIC_RUBY
445 "+ruby/dyn",
446# else
447 "+ruby",
448# endif
449#else
450 "-ruby",
451#endif
452#ifdef FEAT_SCROLLBIND
453 "+scrollbind",
454#else
455 "-scrollbind",
456#endif
457#ifdef FEAT_SIGNS
458 "+signs",
459#else
460 "-signs",
461#endif
462#ifdef FEAT_SMARTINDENT
463 "+smartindent",
464#else
465 "-smartindent",
466#endif
467#ifdef FEAT_SNIFF
468 "+sniff",
469#else
470 "-sniff",
471#endif
472#ifdef FEAT_STL_OPT
473 "+statusline",
474#else
475 "-statusline",
476#endif
477#ifdef FEAT_SUN_WORKSHOP
478 "+sun_workshop",
479#else
480 "-sun_workshop",
481#endif
482#ifdef FEAT_SYN_HL
483 "+syntax",
484#else
485 "-syntax",
486#endif
487 /* only interesting on Unix systems */
488#if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
489 "+system()",
490#endif
491#ifdef FEAT_TAG_BINS
492 "+tag_binary",
493#else
494 "-tag_binary",
495#endif
496#ifdef FEAT_TAG_OLDSTATIC
497 "+tag_old_static",
498#else
499 "-tag_old_static",
500#endif
501#ifdef FEAT_TAG_ANYWHITE
502 "+tag_any_white",
503#else
504 "-tag_any_white",
505#endif
506#ifdef FEAT_TCL
507# ifdef DYNAMIC_TCL
508 "+tcl/dyn",
509# else
510 "+tcl",
511# endif
512#else
513 "-tcl",
514#endif
515#if defined(UNIX) || defined(__EMX__)
516/* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */
517# ifdef TERMINFO
518 "+terminfo",
519# else
520 "-terminfo",
521# endif
522#else /* unix always includes termcap support */
523# ifdef HAVE_TGETENT
524 "+tgetent",
525# else
526 "-tgetent",
527# endif
528#endif
529#ifdef FEAT_TERMRESPONSE
530 "+termresponse",
531#else
532 "-termresponse",
533#endif
534#ifdef FEAT_TEXTOBJ
535 "+textobjects",
536#else
537 "-textobjects",
538#endif
539#ifdef FEAT_TITLE
540 "+title",
541#else
542 "-title",
543#endif
544#ifdef FEAT_TOOLBAR
545 "+toolbar",
546#else
547 "-toolbar",
548#endif
549#ifdef FEAT_USR_CMDS
550 "+user_commands",
551#else
552 "-user_commands",
553#endif
554#ifdef FEAT_VERTSPLIT
555 "+vertsplit",
556#else
557 "-vertsplit",
558#endif
559#ifdef FEAT_VIRTUALEDIT
560 "+virtualedit",
561#else
562 "-virtualedit",
563#endif
564#ifdef FEAT_VISUAL
565 "+visual",
566# ifdef FEAT_VISUALEXTRA
567 "+visualextra",
568# else
569 "-visualextra",
570# endif
571#else
572 "-visual",
573#endif
574#ifdef FEAT_VIMINFO
575 "+viminfo",
576#else
577 "-viminfo",
578#endif
579#ifdef FEAT_VREPLACE
580 "+vreplace",
581#else
582 "-vreplace",
583#endif
584#ifdef FEAT_WILDIGN
585 "+wildignore",
586#else
587 "-wildignore",
588#endif
589#ifdef FEAT_WILDMENU
590 "+wildmenu",
591#else
592 "-wildmenu",
593#endif
594#ifdef FEAT_WINDOWS
595 "+windows",
596#else
597 "-windows",
598#endif
599#ifdef FEAT_WRITEBACKUP
600 "+writebackup",
601#else
602 "-writebackup",
603#endif
604#if defined(UNIX) || defined(VMS)
605# ifdef FEAT_X11
606 "+X11",
607# else
608 "-X11",
609# endif
610#endif
611#ifdef FEAT_XFONTSET
612 "+xfontset",
613#else
614 "-xfontset",
615#endif
616#ifdef FEAT_XIM
617 "+xim",
618#else
619 "-xim",
620#endif
621#if defined(UNIX) || defined(VMS)
622# ifdef USE_XSMP_INTERACT
623 "+xsmp_interact",
624# else
625# ifdef USE_XSMP
626 "+xsmp",
627# else
628 "-xsmp",
629# endif
630# endif
631# ifdef FEAT_XCLIPBOARD
632 "+xterm_clipboard",
633# else
634 "-xterm_clipboard",
635# endif
636#endif
637#ifdef FEAT_XTERM_SAVE
638 "+xterm_save",
639#else
640 "-xterm_save",
641#endif
642#ifdef WIN3264
643# ifdef FEAT_XPM_W32
644 "+xpm_w32",
645# else
646 "-xpm_w32",
647# endif
648#endif
649 NULL
650};
651
652static int included_patches[] =
653{ /* Add new patch number below this line */
654/**/
655 0
656};
657
658 int
659highest_patch()
660{
661 int i;
662 int h = 0;
663
664 for (i = 0; included_patches[i] != 0; ++i)
665 if (included_patches[i] > h)
666 h = included_patches[i];
667 return h;
668}
669
670#if defined(FEAT_EVAL) || defined(PROTO)
671/*
672 * Return TRUE if patch "n" has been included.
673 */
674 int
675has_patch(n)
676 int n;
677{
678 int i;
679
680 for (i = 0; included_patches[i] != 0; ++i)
681 if (included_patches[i] == n)
682 return TRUE;
683 return FALSE;
684}
685#endif
686
687 void
688ex_version(eap)
689 exarg_T *eap;
690{
691 /*
692 * Ignore a ":version 9.99" command.
693 */
694 if (*eap->arg == NUL)
695 {
696 msg_putchar('\n');
697 list_version();
698 }
699}
700
701 void
702list_version()
703{
704 int i;
705 int first;
706 char *s = "";
707
708 /*
709 * When adding features here, don't forget to update the list of
710 * internal variables in eval.c!
711 */
712 MSG(longVersion);
713#ifdef WIN3264
714# ifdef FEAT_GUI_W32
715# if defined(_MSC_VER) && (_MSC_VER <= 1010)
716 /* Only MS VC 4.1 and earlier can do Win32s */
717 MSG_PUTS(_("\nMS-Windows 16/32 bit GUI version"));
718# else
719 MSG_PUTS(_("\nMS-Windows 32 bit GUI version"));
720# endif
721 if (gui_is_win32s())
722 MSG_PUTS(_(" in Win32s mode"));
723# ifdef FEAT_OLE
724 MSG_PUTS(_(" with OLE support"));
725# endif
726# else
727 MSG_PUTS(_("\nMS-Windows 32 bit console version"));
728# endif
729#endif
730#ifdef WIN16
731 MSG_PUTS(_("\nMS-Windows 16 bit version"));
732#endif
733#ifdef MSDOS
734# ifdef DJGPP
735 MSG_PUTS(_("\n32 bit MS-DOS version"));
736# else
737 MSG_PUTS(_("\n16 bit MS-DOS version"));
738# endif
739#endif
740#ifdef MACOS
741# ifdef MACOS_X
742# ifdef MACOS_X_UNIX
743 MSG_PUTS(_("\nMacOS X (unix) version"));
744# else
745 MSG_PUTS(_("\nMacOS X version"));
746# endif
747#else
748 MSG_PUTS(_("\nMacOS version"));
749# endif
750#endif
751
752#ifdef RISCOS
753 MSG_PUTS(_("\nRISC OS version"));
754#endif
755#ifdef VMS
756 MSG_PUTS("\nOpenVMS version");
757#endif
758
759 /* Print the list of patch numbers if there is at least one. */
760 /* Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" */
761 if (included_patches[0] != 0)
762 {
763 MSG_PUTS(_("\nIncluded patches: "));
764 first = -1;
765 /* find last one */
766 for (i = 0; included_patches[i] != 0; ++i)
767 ;
768 while (--i >= 0)
769 {
770 if (first < 0)
771 first = included_patches[i];
772 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
773 {
774 MSG_PUTS(s);
775 s = ", ";
776 msg_outnum((long)first);
777 if (first != included_patches[i])
778 {
779 MSG_PUTS("-");
780 msg_outnum((long)included_patches[i]);
781 }
782 first = -1;
783 }
784 }
785 }
786
787#ifdef MODIFIED_BY
788 MSG_PUTS("\n");
789 MSG_PUTS(_("Modified by "));
790 MSG_PUTS(MODIFIED_BY);
791#endif
792
793#ifdef HAVE_PATHDEF
794 if (*compiled_user != NUL || *compiled_sys != NUL)
795 {
796 MSG_PUTS(_("\nCompiled "));
797 if (*compiled_user != NUL)
798 {
799 MSG_PUTS(_("by "));
800 MSG_PUTS(compiled_user);
801 }
802 if (*compiled_sys != NUL)
803 {
804 MSG_PUTS("@");
805 MSG_PUTS(compiled_sys);
806 }
807 }
808#endif
809
810#ifdef FEAT_HUGE
811 MSG_PUTS(_("\nHuge version "));
812#else
813# ifdef FEAT_BIG
814 MSG_PUTS(_("\nBig version "));
815# else
816# ifdef FEAT_NORMAL
817 MSG_PUTS(_("\nNormal version "));
818# else
819# ifdef FEAT_SMALL
820 MSG_PUTS(_("\nSmall version "));
821# else
822 MSG_PUTS(_("\nTiny version "));
823# endif
824# endif
825# endif
826#endif
827#ifndef FEAT_GUI
828 MSG_PUTS(_("without GUI."));
829#else
830# ifdef FEAT_GUI_GTK
831# ifdef FEAT_GUI_GNOME
832# ifdef HAVE_GTK2
833 MSG_PUTS(_("with GTK2-GNOME GUI."));
834# else
835 MSG_PUTS(_("with GTK-GNOME GUI."));
836# endif
837# else
838# ifdef HAVE_GTK2
839 MSG_PUTS(_("with GTK2 GUI."));
840# else
841 MSG_PUTS(_("with GTK GUI."));
842# endif
843# endif
844# else
845# ifdef FEAT_GUI_MOTIF
846 MSG_PUTS(_("with X11-Motif GUI."));
847# else
848# ifdef FEAT_GUI_ATHENA
849# ifdef FEAT_GUI_NEXTAW
850 MSG_PUTS(_("with X11-neXtaw GUI."));
851# else
852 MSG_PUTS(_("with X11-Athena GUI."));
853# endif
854# else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000855# ifdef FEAT_GUI_PHOTON
856 MSG_PUTS(_("with Photon GUI."));
857# else
858# if defined(MSWIN)
859 MSG_PUTS(_("with GUI."));
860# else
861# if defined (TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
862 MSG_PUTS(_("with Carbon GUI."));
863# else
864# if defined (TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
865 MSG_PUTS(_("with Cocoa GUI."));
866# else
867# if defined (MACOS)
868 MSG_PUTS(_("with (classic) GUI."));
Bram Moolenaar843ee412004-06-30 16:16:41 +0000869# else
870# ifdef FEAT_GUI_KDE
871 MSG_PUTS(_("with KDE GUI."));
872# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000873# endif
874# endif
875# endif
876# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000877# endif
878# endif
879# endif
880# endif
881#endif
882 version_msg(_(" Features included (+) or not (-):\n"));
883
884 /* print all the features */
885 for (i = 0; features[i] != NULL; ++i)
886 {
887 version_msg(features[i]);
888 if (msg_col > 0)
889 version_msg(" ");
890 }
891
892 version_msg("\n");
893#ifdef SYS_VIMRC_FILE
894 version_msg(_(" system vimrc file: \""));
895 version_msg(SYS_VIMRC_FILE);
896 version_msg("\"\n");
897#endif
898#ifdef USR_VIMRC_FILE
899 version_msg(_(" user vimrc file: \""));
900 version_msg(USR_VIMRC_FILE);
901 version_msg("\"\n");
902#endif
903#ifdef USR_VIMRC_FILE2
904 version_msg(_(" 2nd user vimrc file: \""));
905 version_msg(USR_VIMRC_FILE2);
906 version_msg("\"\n");
907#endif
908#ifdef USR_VIMRC_FILE3
909 version_msg(_(" 3rd user vimrc file: \""));
910 version_msg(USR_VIMRC_FILE3);
911 version_msg("\"\n");
912#endif
913#ifdef USR_EXRC_FILE
914 version_msg(_(" user exrc file: \""));
915 version_msg(USR_EXRC_FILE);
916 version_msg("\"\n");
917#endif
918#ifdef USR_EXRC_FILE2
919 version_msg(_(" 2nd user exrc file: \""));
920 version_msg(USR_EXRC_FILE2);
921 version_msg("\"\n");
922#endif
923#ifdef FEAT_GUI
924# ifdef SYS_GVIMRC_FILE
925 version_msg(_(" system gvimrc file: \""));
926 version_msg(SYS_GVIMRC_FILE);
927 version_msg("\"\n");
928# endif
929 version_msg(_(" user gvimrc file: \""));
930 version_msg(USR_GVIMRC_FILE);
931 version_msg("\"\n");
932# ifdef USR_GVIMRC_FILE2
933 version_msg(_("2nd user gvimrc file: \""));
934 version_msg(USR_GVIMRC_FILE2);
935 version_msg("\"\n");
936# endif
937# ifdef USR_GVIMRC_FILE3
938 version_msg(_("3rd user gvimrc file: \""));
939 version_msg(USR_GVIMRC_FILE3);
940 version_msg("\"\n");
941# endif
942#endif
943#ifdef FEAT_GUI
944# ifdef SYS_MENU_FILE
945 version_msg(_(" system menu file: \""));
946 version_msg(SYS_MENU_FILE);
947 version_msg("\"\n");
948# endif
949#endif
950#ifdef HAVE_PATHDEF
951 if (*default_vim_dir != NUL)
952 {
953 version_msg(_(" fall-back for $VIM: \""));
954 version_msg((char *)default_vim_dir);
955 version_msg("\"\n");
956 }
957 if (*default_vimruntime_dir != NUL)
958 {
959 version_msg(_(" f-b for $VIMRUNTIME: \""));
960 version_msg((char *)default_vimruntime_dir);
961 version_msg("\"\n");
962 }
963 version_msg(_("Compilation: "));
964 version_msg((char *)all_cflags);
965 version_msg("\n");
966#ifdef VMS
967 if (*compiler_version != NUL)
968 {
969 version_msg(_("Compiler: "));
970 version_msg((char *)compiler_version);
971 version_msg("\n");
972 }
973#endif
974 version_msg(_("Linking: "));
975 version_msg((char *)all_lflags);
976#endif
977#ifdef DEBUG
978 version_msg("\n");
979 version_msg(_(" DEBUG BUILD"));
980#endif
981}
982
983/*
984 * Output a string for the version message. If it's going to wrap, output a
985 * newline, unless the message is too long to fit on the screen anyway.
986 */
987 static void
988version_msg(s)
989 char *s;
990{
991 int len = (int)STRLEN(s);
992
993 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
994 && *s != '\n')
995 msg_putchar('\n');
996 if (!got_int)
997 MSG_PUTS(s);
998}
999
1000static void do_intro_line __ARGS((int row, char_u *mesg, int add_version, int attr));
1001
1002/*
1003 * Give an introductory message about Vim.
1004 * Only used when starting Vim on an empty file, without a file name.
1005 * Or with the ":intro" command (for Sven :-).
1006 */
1007 void
1008intro_message(colon)
1009 int colon; /* TRUE for ":intro" */
1010{
1011 int i;
1012 int row;
1013 int blanklines;
1014 int sponsor;
1015 char *p;
1016 static char *(lines[]) =
1017 {
1018 N_("VIM - Vi IMproved"),
1019 "",
1020 N_("version "),
1021 N_("by Bram Moolenaar et al."),
1022#ifdef MODIFIED_BY
1023 " ",
1024#endif
1025 N_("Vim is open source and freely distributable"),
1026 "",
1027 N_("Help poor children in Uganda!"),
1028 N_("type :help iccf<Enter> for information "),
1029 "",
1030 N_("type :q<Enter> to exit "),
1031 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001032 N_("type :help version7<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001033 NULL,
1034 "",
1035 N_("Running in Vi compatible mode"),
1036 N_("type :set nocp<Enter> for Vim defaults"),
1037 N_("type :help cp-default<Enter> for info on this"),
1038 };
1039#ifdef FEAT_GUI
1040 static char *(gui_lines[]) =
1041 {
1042 NULL,
1043 NULL,
1044 NULL,
1045 NULL,
1046#ifdef MODIFIED_BY
1047 NULL,
1048#endif
1049 NULL,
1050 NULL,
1051 NULL,
1052 N_("menu Help->Orphans for information "),
1053 NULL,
1054 N_("Running modeless, typed text is inserted"),
1055 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1056 N_(" for two modes "),
1057 NULL,
1058 NULL,
1059 NULL,
1060 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1061 N_(" for Vim defaults "),
1062 };
1063#endif
1064
1065 /* blanklines = screen height - # message lines */
1066 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1067 if (!p_cp)
1068 blanklines += 4; /* add 4 for not showing "Vi compatible" message */
1069#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1070 if (mch_windows95())
1071 blanklines -= 3; /* subtract 3 for showing "Windows 95" message */
1072#endif
1073
1074#ifdef FEAT_WINDOWS
1075 /* Don't overwrite a statusline. Depends on 'cmdheight'. */
1076 if (p_ls > 1)
1077 blanklines -= Rows - topframe->fr_height;
1078#endif
1079 if (blanklines < 0)
1080 blanklines = 0;
1081
1082 /* Show the sponsor and register message one out of four times, the Uganda
1083 * message two out of four times. */
1084 sponsor = time(NULL);
1085 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1086
1087 /* start displaying the message lines after half of the blank lines */
1088 row = blanklines / 2;
1089 if ((row >= 2 && Columns >= 50) || colon)
1090 {
1091 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1092 {
1093 p = lines[i];
1094#ifdef FEAT_GUI
1095 if (p_im && gui.in_use && gui_lines[i] != NULL)
1096 p = gui_lines[i];
1097#endif
1098 if (p == NULL)
1099 {
1100 if (!p_cp)
1101 break;
1102 continue;
1103 }
1104 if (sponsor != 0)
1105 {
1106 if (strstr(p, "children") != NULL)
1107 p = sponsor < 0
1108 ? N_("Sponsor Vim development!")
1109 : N_("Become a registered Vim user!");
1110 else if (strstr(p, "iccf") != NULL)
1111 p = sponsor < 0
1112 ? N_("type :help sponsor<Enter> for information ")
1113 : N_("type :help register<Enter> for information ");
1114 else if (strstr(p, "Orphans") != NULL)
1115 p = N_("menu Help->Sponsor/Register for information ");
1116 }
1117 if (*p != NUL)
1118 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1119 ++row;
1120 }
1121#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1122 if (mch_windows95())
1123 {
1124 do_intro_line(++row,
1125 (char_u *)_("WARNING: Windows 95/98/ME detected"),
1126 FALSE, hl_attr(HLF_E));
1127 do_intro_line(++row,
1128 (char_u *)_("type :help windows95<Enter> for info on this"),
1129 FALSE, 0);
1130 }
1131#endif
1132 }
1133
1134 /* Make the wait-return message appear just below the text. */
1135 if (colon)
1136 msg_row = row;
1137}
1138
1139 static void
1140do_intro_line(row, mesg, add_version, attr)
1141 int row;
1142 char_u *mesg;
1143 int add_version;
1144 int attr;
1145{
1146 char_u vers[20];
1147 int col;
1148 char_u *p;
1149 int l;
1150 int clen;
1151#ifdef MODIFIED_BY
1152# define MODBY_LEN 150
1153 char_u modby[MODBY_LEN];
1154
1155 if (*mesg == ' ')
1156 {
1157 STRNCPY(modby, _("Modified by "), MODBY_LEN);
1158 modby[MODBY_LEN - 1] = NUL;
1159 l = STRLEN(modby);
1160 STRNCPY(modby + l, MODIFIED_BY, MODBY_LEN - l);
1161 modby[MODBY_LEN - 1] = NUL;
1162 mesg = modby;
1163 }
1164#endif
1165
1166 /* Center the message horizontally. */
1167 col = vim_strsize(mesg);
1168 if (add_version)
1169 {
1170 STRCPY(vers, mediumVersion);
1171 if (highest_patch())
1172 {
1173 /* Check for 9.9x or 9.9xx, alpha/beta version */
1174 if (isalpha((int)mediumVersion[3]))
1175 {
1176 if (isalpha((int)mediumVersion[4]))
1177 sprintf((char *)vers + 5, ".%d%s", highest_patch(),
1178 mediumVersion + 5);
1179 else
1180 sprintf((char *)vers + 4, ".%d%s", highest_patch(),
1181 mediumVersion + 4);
1182 }
1183 else
1184 sprintf((char *)vers + 3, ".%d", highest_patch());
1185 }
1186 col += (int)STRLEN(vers);
1187 }
1188 col = (Columns - col) / 2;
1189 if (col < 0)
1190 col = 0;
1191
1192 /* Split up in parts to highlight <> items differently. */
1193 for (p = mesg; *p != NUL; p += l)
1194 {
1195 clen = 0;
1196 for (l = 0; p[l] != NUL
1197 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1198 {
1199#ifdef FEAT_MBYTE
1200 if (has_mbyte)
1201 {
1202 clen += ptr2cells(p + l);
1203 l += (*mb_ptr2len_check)(p + l) - 1;
1204 }
1205 else
1206#endif
1207 clen += byte2cells(p[l]);
1208 }
1209 screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr);
1210 col += clen;
1211 }
1212
1213 /* Add the version number to the version line. */
1214 if (add_version)
1215 screen_puts(vers, row, col, 0);
1216}
1217
1218/*
1219 * ":intro": clear screen, display intro screen and wait for return.
1220 */
1221/*ARGSUSED*/
1222 void
1223ex_intro(eap)
1224 exarg_T *eap;
1225{
1226 screenclear();
1227 intro_message(TRUE);
1228 wait_return(TRUE);
1229}