comparison src/emacs.c @ 4556:a1f8c5c250c2

Automated merge with file:/Sources/xemacs-21.5-checked-out
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 11 May 2008 19:50:49 +0200
parents ac6231e0c1df
children d9b9b5f90386
comparison
equal deleted inserted replaced
4555:20c32e489235 4556:a1f8c5c250c2
953 /* prevent a very annoying problem where GCC will attempt to free (3) */ 953 /* prevent a very annoying problem where GCC will attempt to free (3) */
954 /* memory at exit() and cause a coredump. */ 954 /* memory at exit() and cause a coredump. */
955 init_free_hook (); 955 init_free_hook ();
956 #endif 956 #endif
957 957
958 #define SHEBANG_PROGNAME_LENGTH \
959 (int)((sizeof (WEXTSTRING (SHEBANG_PROGNAME)) - sizeof (WEXTSTRING (""))))
960 #define SHEBANG_EXE_PROGNAME_LENGTH \
961 (int)(sizeof (WEXTSTRING (SHEBANG_PROGNAME ".exe")) \
962 - sizeof (WEXTSTRING ("")))
963
964 {
965 int progname_len = wext_strlen (argv[0]);
966 if (progname_len >= SHEBANG_PROGNAME_LENGTH)
967 {
968 if (!wext_strcmp_ascii (argv[0] +
969 (progname_len - SHEBANG_PROGNAME_LENGTH),
970 SHEBANG_PROGNAME)
971 /* Allow trailing .exe. Don't check it, it could also be
972 .com. */
973 || (progname_len >= SHEBANG_EXE_PROGNAME_LENGTH &&
974 !wext_strncmp_ascii
975 (argv[0] + (progname_len - SHEBANG_EXE_PROGNAME_LENGTH),
976 SHEBANG_PROGNAME,
977 SHEBANG_PROGNAME_LENGTH)))
978 {
979 Wexttext **newarr = alloca_array (Wexttext *, argc + 2);
980 int j;
981
982 newarr[0] = argv[0];
983 newarr[1] = WEXTSTRING ("--script");
984 for (j = 1; j < argc; ++j)
985 {
986 newarr[j + 1] = argv[j];
987 }
988 argv = newarr;
989 argc++;
990 }
991 }
992 }
993
958 sort_args (argc, argv); 994 sort_args (argc, argv);
959 995
960 #if 0 /* defined (_SCO_DS) 996 #if 0 /* defined (_SCO_DS)
961 #### Turn this off, we already have another SCO_DS hack in main(). 997 #### Turn this off, we already have another SCO_DS hack in main().
962 */ 998 */
1046 inhibit_autoloads = 1; 1082 inhibit_autoloads = 1;
1047 #endif 1083 #endif
1048 noninteractive = 1; 1084 noninteractive = 1;
1049 } 1085 }
1050 1086
1087 {
1088 int count_before = skip_args;
1089 /* Handle the -script switch, which implies batch and vanilla. The -l
1090 part of its functionality is implemented in Lisp. */
1091 if (argmatch (argv, argc, "-script", "--script", 0, NULL,
1092 &skip_args))
1093 {
1094 noninteractive = 1;
1095 vanilla_inhibiting = 1;
1096 }
1097
1098 /* Don't actually discard this argument. */
1099 skip_args = count_before;
1100 }
1051 #ifdef WIN32_NATIVE 1101 #ifdef WIN32_NATIVE
1052 { 1102 {
1053 /* Since we aren't a console application, we can't easily be terminated 1103 /* Since we aren't a console application, we can't easily be terminated
1054 using ^C. (We aren't a console application to avoid Windows from 1104 using ^C. (We aren't a console application to avoid Windows from
1055 automatically and unwantedly creating a console window for us. If 1105 automatically and unwantedly creating a console window for us. If
2688 /* Handled by main_1 above: Each must have its own priority and must be 2738 /* Handled by main_1 above: Each must have its own priority and must be
2689 in the order mentioned in main_1. */ 2739 in the order mentioned in main_1. */
2690 { "-sd", "--show-dump-id", 105, 0 }, 2740 { "-sd", "--show-dump-id", 105, 0 },
2691 { "-nd", "--no-dump-file", 95, 0 }, 2741 { "-nd", "--no-dump-file", 95, 0 },
2692 { "-batch", "--batch", 88, 0 }, 2742 { "-batch", "--batch", 88, 0 },
2743 { "-script", "--script", 89, 1 },
2693 #ifdef WIN32_NATIVE 2744 #ifdef WIN32_NATIVE
2694 { "-mswindows-termination-handle", 0, 84, 1 }, 2745 { "-mswindows-termination-handle", 0, 84, 1 },
2695 { "-nuni", "--no-unicode-lib-calls", 83, 0 }, 2746 { "-nuni", "--no-unicode-lib-calls", 83, 0 },
2696 #endif /* WIN32_NATIVE */ 2747 #endif /* WIN32_NATIVE */
2697 { "-debug-paths", "--debug-paths", 82, 0 }, 2748 { "-debug-paths", "--debug-paths", 82, 0 },