aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan Nicolaescu2008-07-31 05:33:56 +0000
committerDan Nicolaescu2008-07-31 05:33:56 +0000
commit7c2fb837ec2f0e0a509f22ccc35f9b43476a6119 (patch)
tree7ec796ef1f109e43c8be2cc8cfb8dc579cfa8033 /src
parent69ab3201ca6f6ef1414d678fd9cb13dd4d6f6b95 (diff)
downloademacs-7c2fb837ec2f0e0a509f22ccc35f9b43476a6119.tar.gz
emacs-7c2fb837ec2f0e0a509f22ccc35f9b43476a6119.zip
* bitmaps/README:
* xfns.c: * termcap.c: * term.c: * syswait.h: * systty.h: * systime.h: * syssignal.h: * sysdep.c: * process.h: * process.c: * print.c: * ndir.h: * lread.c: * keyboard.c: * getpagesize.h: * floatfns.c: * fileio.c: * emacs.c: * doc.c: * dispnew.c: * dired.c: * data.c: * callproc.c: * buffer.c: * README: * Makefile.in: * s/template.h: * s/msdos.h: * m/vax.h: Remove VMS support. * s/vms.h: * vlimit.h: * uaf.h: * temacs.opt: * param.h: * ioctl.h: Remove file. * descrip.mms: * compile.com: Remove file. * Create.c: Remove VMS support. * message.el (Module): * gnus-start.el (Module): * gnus-registry.el (Module): * textmodes/texinfmt.el: * nxml/nxml-enc.el: * mail/feedmail.el: * international/mule.el: * international/latexenc.el: * emulation/viper-util.el: * emulation/viper-init.el: * emulation/viper-ex.el: * emacs-lisp/bytecomp.el: * version.el: * subr.el: * startup.el: * sort.el: * shadowfile.el: * recentf.el: * printing.el: * paths.el: * minibuffer.el: * ls-lisp.el: * loadup.el: * hippie-exp.el: * finder.el: * files.el: * ediff-util.el: * ediff-ptch.el: * ediff-init.el: * ediff-diff.el: * dired.el: * dired-aux.el: * cus-edit.el: * bindings.el: * arc-mode.el: * add-log.el: Remove VMS support. * obsolete/vmsproc.el: * obsolete/vms-pmail.el: * obsolete/vms-patch.el: Remove file. * etags.c: * emacsclient.c: Remove VMS support. * termcap.src: Remove file. * README: * PROBLEMS: * MACHINES: Remove VMS info. * ediff.texi: Remove VMS support. * os.texi: * intro.texi: * files.texi: Remove VMS support. * emacs.texi: Remove VMS support. * make-dist: * README: Remove VMS support. * vms: Remove directory.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog39
-rw-r--r--src/Makefile.in8
-rw-r--r--src/README17
-rw-r--r--src/bitmaps/README3
-rw-r--r--src/buffer.c2
-rw-r--r--src/callproc.c20
-rw-r--r--src/data.c4
-rw-r--r--src/dired.c84
-rw-r--r--src/dispnew.c30
-rw-r--r--src/doc.c25
-rw-r--r--src/emacs.c84
-rw-r--r--src/fileio.c725
-rw-r--r--src/floatfns.c10
-rw-r--r--src/getpagesize.h4
-rw-r--r--src/ioctl.h4
-rw-r--r--src/keyboard.c37
-rw-r--r--src/lread.c10
-rw-r--r--src/m/vax.h17
-rw-r--r--src/ndir.h17
-rw-r--r--src/param.h5
-rw-r--r--src/print.c39
-rw-r--r--src/process.c127
-rw-r--r--src/process.h2
-rw-r--r--src/s/msdos.h1
-rw-r--r--src/s/template.h8
-rw-r--r--src/s/vms.h192
-rw-r--r--src/sysdep.c2000
-rw-r--r--src/syssignal.h2
-rw-r--r--src/systime.h6
-rw-r--r--src/systty.h47
-rw-r--r--src/syswait.h17
-rw-r--r--src/temacs.opt60
-rw-r--r--src/term.c23
-rw-r--r--src/termcap.c35
-rw-r--r--src/uaf.h298
-rw-r--r--src/vlimit.h5
-rw-r--r--src/xfns.c4
37 files changed, 63 insertions, 3948 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 89b730f299d..bb9f3c600a9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,44 @@
12008-07-31 Dan Nicolaescu <dann@ics.uci.edu> 12008-07-31 Dan Nicolaescu <dann@ics.uci.edu>
2 2
3 * bitmaps/README:
4 * xfns.c:
5 * termcap.c:
6 * term.c:
7 * syswait.h:
8 * systty.h:
9 * systime.h:
10 * syssignal.h:
11 * sysdep.c:
12 * process.h:
13 * process.c:
14 * print.c:
15 * ndir.h:
16 * lread.c:
17 * keyboard.c:
18 * getpagesize.h:
19 * floatfns.c:
20 * fileio.c:
21 * emacs.c:
22 * doc.c:
23 * dispnew.c:
24 * dired.c:
25 * data.c:
26 * callproc.c:
27 * buffer.c:
28 * README:
29 * Makefile.in:
30 * s/template.h:
31 * s/msdos.h:
32 * m/vax.h: Remove VMS support.
33 * s/vms.h:
34 * vlimit.h:
35 * uaf.h:
36 * temacs.opt:
37 * param.h:
38 * ioctl.h: Remove file.
39
402008-07-31 Dan Nicolaescu <dann@ics.uci.edu>
41
3 * s/ms-w32.h (MULTI_KBOARD): Remove. 42 * s/ms-w32.h (MULTI_KBOARD): Remove.
4 * xterm.c: 43 * xterm.c:
5 * xselect.c: 44 * xselect.c:
diff --git a/src/Makefile.in b/src/Makefile.in
index 2fe5990a1a5..3536e816422 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -622,12 +622,6 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
622#endif 622#endif
623#endif 623#endif
624 624
625#ifdef VMS
626#define VMS_SUPPORT ${lispsource}vmsproc.elc ${lispsource}vms-patch.elc
627#else
628#define VMS_SUPPORT
629#endif
630
631#ifdef MSDOS 625#ifdef MSDOS
632#define MSDOS_SUPPORT ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \ 626#define MSDOS_SUPPORT ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \
633 ${lispsource}dos-fns.elc ${lispsource}dos-w32.elc ${lispsource}dos-vars.elc \ 627 ${lispsource}dos-fns.elc ${lispsource}dos-w32.elc ${lispsource}dos-vars.elc \
@@ -762,7 +756,6 @@ lisp= \
762 ${lispsource}ediff-hook.elc \ 756 ${lispsource}ediff-hook.elc \
763 ${lispsource}epa-hook.elc \ 757 ${lispsource}epa-hook.elc \
764 TOOLTIP_SUPPORT \ 758 TOOLTIP_SUPPORT \
765 VMS_SUPPORT \
766 MSDOS_SUPPORT \ 759 MSDOS_SUPPORT \
767 WINNT_SUPPORT \ 760 WINNT_SUPPORT \
768 WINDOW_SUPPORT \ 761 WINDOW_SUPPORT \
@@ -864,7 +857,6 @@ shortlisp= \
864 for the sake of systems which can''t handle large ones. */ 857 for the sake of systems which can''t handle large ones. */
865SOME_MACHINE_LISP = ../lisp/mouse.elc \ 858SOME_MACHINE_LISP = ../lisp/mouse.elc \
866 ../lisp/select.elc ../lisp/scroll-bar.elc \ 859 ../lisp/select.elc ../lisp/scroll-bar.elc \
867 VMS_SUPPORT \
868 ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \ 860 ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \
869 ../lisp/w32-fns.elc ../lisp/dos-w32.elc \ 861 ../lisp/w32-fns.elc ../lisp/dos-w32.elc \
870 ../lisp/disp-table.elc ../lisp/dos-vars.elc \ 862 ../lisp/disp-table.elc ../lisp/dos-vars.elc \
diff --git a/src/README b/src/README
index 2975b2f982e..ad37bb206fb 100644
--- a/src/README
+++ b/src/README
@@ -5,8 +5,7 @@ See the end of the file for license conditions.
5 5
6This directory contains the source files for the C component of GNU Emacs. 6This directory contains the source files for the C component of GNU Emacs.
7Nothing in this directory is needed for using Emacs once it is built 7Nothing in this directory is needed for using Emacs once it is built
8and installed, if the dumped Emacs (on Unix systems) or the Emacs 8and installed, if the dumped Emacs (on Unix systems) is copied elsewhere.
9executable and map files (on VMS systems) are copied elsewhere.
10 9
11See the files ../README and then ../INSTALL for installation instructions. 10See the files ../README and then ../INSTALL for installation instructions.
12 11
@@ -18,20 +17,6 @@ controls the compilation of Emacs. Most of this should work
18transparently to the user; you should only need to run `../configure', 17transparently to the user; you should only need to run `../configure',
19and then type `make'. 18and then type `make'.
20 19
21See the file VMSBUILD in this directory for instructions on compiling,
22linking and building Emacs on VMS.
23
24The files `*.com' and `temacs.opt' are used on VMS only.
25The files `vlimit.h', `ioclt.h' and `param.h' are stubs to
26allow compilation on VMS with the minimum amount of #ifdefs.
27
28`uaf.h' contains VMS uaf structure definitions. This is only needed if
29you define READ_SYSUAF. This should only be done for single-user
30systems where you are not overly concerned with security, since it
31either requires that you install Emacs with SYSPRV or make SYSUAF.DAT
32world readable. Otherwise, Emacs can determine information about the
33current user, but no one else.
34
35 20
36This file is part of GNU Emacs. 21This file is part of GNU Emacs.
37 22
diff --git a/src/bitmaps/README b/src/bitmaps/README
index 016aeb70e1e..2a6e72595cc 100644
--- a/src/bitmaps/README
+++ b/src/bitmaps/README
@@ -1,6 +1,5 @@
1This directory contains bitmap files that Emacs uses from 1This directory contains bitmap files that Emacs uses from
2/usr/include/X11/bitmaps. That directory doesn't seem to exist under 2/usr/include/X11/bitmaps.
3VMS.
4 3
5 4
6COPYRIGHT AND LICENSE INFORMATION 5COPYRIGHT AND LICENSE INFORMATION
diff --git a/src/buffer.c b/src/buffer.c
index 2ba21922ab8..a2d0cfac591 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5312,7 +5312,6 @@ init_buffer ()
5312 if (!pwd) 5312 if (!pwd)
5313 fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); 5313 fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));
5314 5314
5315#ifndef VMS
5316 /* Maybe this should really use some standard subroutine 5315 /* Maybe this should really use some standard subroutine
5317 whose definition is filename syntax dependent. */ 5316 whose definition is filename syntax dependent. */
5318 len = strlen (pwd); 5317 len = strlen (pwd);
@@ -5323,7 +5322,6 @@ init_buffer ()
5323 pwd[len] = DIRECTORY_SEP; 5322 pwd[len] = DIRECTORY_SEP;
5324 pwd[len + 1] = '\0'; 5323 pwd[len + 1] = '\0';
5325 } 5324 }
5326#endif /* not VMS */
5327 5325
5328 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); 5326 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd));
5329 if (! NILP (buffer_defaults.enable_multibyte_characters)) 5327 if (! NILP (buffer_defaults.enable_multibyte_characters))
diff --git a/src/callproc.c b/src/callproc.c
index a6de7668c15..1aad176978e 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -90,13 +90,9 @@ extern int errno;
90#include "msdos.h" 90#include "msdos.h"
91#endif 91#endif
92 92
93#ifdef VMS
94extern noshare char **environ;
95#else
96#ifndef USE_CRT_DLL 93#ifndef USE_CRT_DLL
97extern char **environ; 94extern char **environ;
98#endif 95#endif
99#endif
100 96
101#ifdef HAVE_SETPGID 97#ifdef HAVE_SETPGID
102#if !defined (USG) || defined (BSD_PGRPS) 98#if !defined (USG) || defined (BSD_PGRPS)
@@ -142,8 +138,6 @@ static int call_process_exited;
142 138
143EXFUN (Fgetenv_internal, 2); 139EXFUN (Fgetenv_internal, 2);
144 140
145#ifndef VMS /* VMS version is in vmsproc.c. */
146
147static Lisp_Object 141static Lisp_Object
148call_process_kill (fdpid) 142call_process_kill (fdpid)
149 Lisp_Object fdpid; 143 Lisp_Object fdpid;
@@ -843,7 +837,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
843 Vlocale_coding_system, 0); 837 Vlocale_coding_system, 0);
844 return make_number (synch_process_retcode); 838 return make_number (synch_process_retcode);
845} 839}
846#endif
847 840
848static Lisp_Object 841static Lisp_Object
849delete_temp_file (name) 842delete_temp_file (name)
@@ -999,8 +992,6 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
999 RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args))); 992 RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args)));
1000} 993}
1001 994
1002#ifndef VMS /* VMS version is in vmsproc.c. */
1003
1004static int relocate_fd (); 995static int relocate_fd ();
1005 996
1006static char ** 997static char **
@@ -1448,7 +1439,6 @@ egetenv (var)
1448 return 0; 1439 return 0;
1449} 1440}
1450 1441
1451#endif /* not VMS */
1452 1442
1453/* This is run before init_cmdargs. */ 1443/* This is run before init_cmdargs. */
1454 1444
@@ -1551,16 +1541,9 @@ init_callproc ()
1551 dir_warning ("Warning: arch-independent data dir (%s) does not exist.\n", 1541 dir_warning ("Warning: arch-independent data dir (%s) does not exist.\n",
1552 Vdata_directory); 1542 Vdata_directory);
1553 1543
1554#ifdef VMS
1555 Vshell_file_name = build_string ("*dcl*");
1556#else
1557 sh = (char *) getenv ("SHELL"); 1544 sh = (char *) getenv ("SHELL");
1558 Vshell_file_name = build_string (sh ? sh : "/bin/sh"); 1545 Vshell_file_name = build_string (sh ? sh : "/bin/sh");
1559#endif
1560 1546
1561#ifdef VMS
1562 Vtemp_file_name_pattern = build_string ("tmp:emacsXXXXXX.");
1563#else
1564 if (getenv ("TMPDIR")) 1547 if (getenv ("TMPDIR"))
1565 { 1548 {
1566 char *dir = getenv ("TMPDIR"); 1549 char *dir = getenv ("TMPDIR");
@@ -1570,7 +1553,6 @@ init_callproc ()
1570 } 1553 }
1571 else 1554 else
1572 Vtemp_file_name_pattern = build_string ("/tmp/emacsXXXXXX"); 1555 Vtemp_file_name_pattern = build_string ("/tmp/emacsXXXXXX");
1573#endif
1574 1556
1575#ifdef DOS_NT 1557#ifdef DOS_NT
1576 Vshared_game_score_directory = Qnil; 1558 Vshared_game_score_directory = Qnil;
@@ -1686,10 +1668,8 @@ use.
1686See `setenv' and `getenv'. */); 1668See `setenv' and `getenv'. */);
1687 Vprocess_environment = Qnil; 1669 Vprocess_environment = Qnil;
1688 1670
1689#ifndef VMS
1690 defsubr (&Scall_process); 1671 defsubr (&Scall_process);
1691 defsubr (&Sgetenv_internal); 1672 defsubr (&Sgetenv_internal);
1692#endif
1693 defsubr (&Scall_process_region); 1673 defsubr (&Scall_process_region);
1694} 1674}
1695 1675
diff --git a/src/data.c b/src/data.c
index ab52c20c77f..54c0d7c211c 100644
--- a/src/data.c
+++ b/src/data.c
@@ -3271,10 +3271,6 @@ arith_error (signo)
3271 must reestablish each time */ 3271 must reestablish each time */
3272 signal (signo, arith_error); 3272 signal (signo, arith_error);
3273#endif /* USG */ 3273#endif /* USG */
3274#ifdef VMS
3275 /* VMS systems are like USG. */
3276 signal (signo, arith_error);
3277#endif /* VMS */
3278 sigsetmask (SIGEMPTYMASK); 3274 sigsetmask (SIGEMPTYMASK);
3279 3275
3280 SIGNAL_THREAD_CHECK (signo); 3276 SIGNAL_THREAD_CHECK (signo);
diff --git a/src/dired.c b/src/dired.c
index 2d82c4bfdc3..5e82fef0df2 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -27,18 +27,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#ifdef HAVE_PWD_H 27#ifdef HAVE_PWD_H
28#include <pwd.h> 28#include <pwd.h>
29#endif 29#endif
30#ifndef VMS
31#include <grp.h> 30#include <grp.h>
32#endif
33 31
34#include <errno.h> 32#include <errno.h>
35 33
36#ifdef VMS
37#include <string.h>
38#include <rms.h>
39#include <rmsdef.h>
40#endif
41
42#ifdef HAVE_UNISTD_H 34#ifdef HAVE_UNISTD_H
43#include <unistd.h> 35#include <unistd.h>
44#endif 36#endif
@@ -62,15 +54,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
62 54
63#else /* not SYSV_SYSTEM_DIR */ 55#else /* not SYSV_SYSTEM_DIR */
64 56
65#ifdef NONSYSTEM_DIR_LIBRARY
66#include "ndir.h"
67#else /* not NONSYSTEM_DIR_LIBRARY */
68#ifdef MSDOS 57#ifdef MSDOS
69#include <dirent.h> 58#include <dirent.h>
70#else 59#else
71#include <sys/dir.h> 60#include <sys/dir.h>
72#endif 61#endif
73#endif /* not NONSYSTEM_DIR_LIBRARY */
74 62
75#include <sys/stat.h> 63#include <sys/stat.h>
76 64
@@ -174,10 +162,6 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format)
174 compile_pattern to do the work for us. */ 162 compile_pattern to do the work for us. */
175 /* Pass 1 for the MULTIBYTE arg 163 /* Pass 1 for the MULTIBYTE arg
176 because we do make multibyte strings if the contents warrant. */ 164 because we do make multibyte strings if the contents warrant. */
177#ifdef VMS
178 bufp = compile_pattern (match, 0,
179 buffer_defaults.downcase_table, 0, 1);
180#else /* !VMS */
181# ifdef WINDOWSNT 165# ifdef WINDOWSNT
182 /* Windows users want case-insensitive wildcards. */ 166 /* Windows users want case-insensitive wildcards. */
183 bufp = compile_pattern (match, 0, 167 bufp = compile_pattern (match, 0,
@@ -185,7 +169,6 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format)
185# else /* !WINDOWSNT */ 169# else /* !WINDOWSNT */
186 bufp = compile_pattern (match, 0, Qnil, 0, 1); 170 bufp = compile_pattern (match, 0, Qnil, 0, 1);
187# endif /* !WINDOWSNT */ 171# endif /* !WINDOWSNT */
188#endif /* !VMS */
189 } 172 }
190 173
191 /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run 174 /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run
@@ -215,11 +198,9 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format)
215 re_match_object = Qt; 198 re_match_object = Qt;
216 199
217 /* Decide whether we need to add a directory separator. */ 200 /* Decide whether we need to add a directory separator. */
218#ifndef VMS
219 if (directory_nbytes == 0 201 if (directory_nbytes == 0
220 || !IS_ANY_SEP (SREF (directory, directory_nbytes - 1))) 202 || !IS_ANY_SEP (SREF (directory, directory_nbytes - 1)))
221 needsep = 1; 203 needsep = 1;
222#endif /* not VMS */
223 204
224 /* Loop reading blocks until EOF or error. */ 205 /* Loop reading blocks until EOF or error. */
225 for (;;) 206 for (;;)
@@ -483,21 +464,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
483 464
484 elt = Qnil; 465 elt = Qnil;
485 466
486#ifdef VMS
487 extern DIRENTRY * readdirver ();
488
489 DIRENTRY *((* readfunc) ());
490
491 /* Filename completion on VMS ignores case, since VMS filesys does. */
492 specbind (Qcompletion_ignore_case, Qt);
493
494 readfunc = readdir;
495 if (ver_flag)
496 readfunc = readdirver;
497 file = Fupcase (file);
498#else /* not VMS */
499 CHECK_STRING (file); 467 CHECK_STRING (file);
500#endif /* not VMS */
501 468
502#ifdef FILE_SYSTEM_CASE 469#ifdef FILE_SYSTEM_CASE
503 file = FILE_SYSTEM_CASE (file); 470 file = FILE_SYSTEM_CASE (file);
@@ -535,9 +502,6 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
535 int len; 502 int len;
536 int canexclude = 0; 503 int canexclude = 0;
537 504
538#ifdef VMS
539 dp = (*readfunc) (d);
540#else
541 errno = 0; 505 errno = 0;
542 dp = readdir (d); 506 dp = readdir (d);
543 if (dp == NULL && (0 507 if (dp == NULL && (0
@@ -549,7 +513,6 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
549# endif 513# endif
550 )) 514 ))
551 { QUIT; continue; } 515 { QUIT; continue; }
552#endif
553 516
554 if (!dp) break; 517 if (!dp) break;
555 518
@@ -830,10 +793,8 @@ file_name_completion_stat (dirname, dp, st_addr)
830#endif /* MSDOS */ 793#endif /* MSDOS */
831 794
832 bcopy (SDATA (dirname), fullname, pos); 795 bcopy (SDATA (dirname), fullname, pos);
833#ifndef VMS
834 if (!IS_DIRECTORY_SEP (fullname[pos - 1])) 796 if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
835 fullname[pos++] = DIRECTORY_SEP; 797 fullname[pos++] = DIRECTORY_SEP;
836#endif
837 798
838 bcopy (dp->d_name, fullname + pos, len); 799 bcopy (dp->d_name, fullname + pos, len);
839 fullname[pos + len] = 0; 800 fullname[pos + len] = 0;
@@ -856,47 +817,6 @@ file_name_completion_stat (dirname, dp, st_addr)
856#endif /* S_IFLNK */ 817#endif /* S_IFLNK */
857} 818}
858 819
859#ifdef VMS
860
861DEFUN ("file-name-all-versions", Ffile_name_all_versions,
862 Sfile_name_all_versions, 2, 2, 0,
863 doc: /* Return a list of all versions of file name FILE in directory DIRECTORY. */)
864 (file, directory)
865 Lisp_Object file, directory;
866{
867 return file_name_completion (file, directory, 1, 1, Qnil);
868}
869
870DEFUN ("file-version-limit", Ffile_version_limit, Sfile_version_limit, 1, 1, 0,
871 doc: /* Return the maximum number of versions allowed for FILE.
872Returns nil if the file cannot be opened or if there is no version limit. */)
873 (filename)
874 Lisp_Object filename;
875{
876 Lisp_Object retval;
877 struct FAB fab;
878 struct RAB rab;
879 struct XABFHC xabfhc;
880 int status;
881
882 filename = Fexpand_file_name (filename, Qnil);
883 fab = cc$rms_fab;
884 xabfhc = cc$rms_xabfhc;
885 fab.fab$l_fna = SDATA (filename);
886 fab.fab$b_fns = strlen (fab.fab$l_fna);
887 fab.fab$l_xab = (char *) &xabfhc;
888 status = sys$open (&fab, 0, 0);
889 if (status != RMS$_NORMAL) /* Probably non-existent file */
890 return Qnil;
891 sys$close (&fab, 0, 0);
892 if (xabfhc.xab$w_verlimit == 32767)
893 return Qnil; /* No version limit */
894 else
895 return make_number (xabfhc.xab$w_verlimit);
896}
897
898#endif /* VMS */
899
900Lisp_Object 820Lisp_Object
901make_time (time) 821make_time (time)
902 time_t time; 822 time_t time;
@@ -1132,10 +1052,6 @@ syms_of_dired ()
1132 defsubr (&Sdirectory_files); 1052 defsubr (&Sdirectory_files);
1133 defsubr (&Sdirectory_files_and_attributes); 1053 defsubr (&Sdirectory_files_and_attributes);
1134 defsubr (&Sfile_name_completion); 1054 defsubr (&Sfile_name_completion);
1135#ifdef VMS
1136 defsubr (&Sfile_name_all_versions);
1137 defsubr (&Sfile_version_limit);
1138#endif /* VMS */
1139 defsubr (&Sfile_name_all_completions); 1055 defsubr (&Sfile_name_all_completions);
1140 defsubr (&Sfile_attributes); 1056 defsubr (&Sfile_attributes);
1141 defsubr (&Sfile_attributes_lessp); 1057 defsubr (&Sfile_attributes_lessp);
diff --git a/src/dispnew.c b/src/dispnew.c
index 4c55f2e7adb..e3e73919fe4 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6836,12 +6836,7 @@ init_display ()
6836 if (! inhibit_window_system && ! display_arg) 6836 if (! inhibit_window_system && ! display_arg)
6837 { 6837 {
6838 char *display; 6838 char *display;
6839#ifdef VMS
6840 display = getenv ("DECW$DISPLAY");
6841#else
6842 display = getenv ("DISPLAY"); 6839 display = getenv ("DISPLAY");
6843#endif
6844
6845 display_arg = (display != 0 && *display != 0); 6840 display_arg = (display != 0 && *display != 0);
6846 6841
6847 if (display_arg && !x_display_ok (display)) 6842 if (display_arg && !x_display_ok (display))
@@ -6912,40 +6907,15 @@ init_display ()
6912#endif 6907#endif
6913 if (!terminal_type) 6908 if (!terminal_type)
6914 { 6909 {
6915#ifdef VMS
6916 fprintf (stderr, "Please specify your terminal type.\n\
6917For types defined in VMS, use set term /device=TYPE.\n\
6918For types not defined in VMS, use define emacs_term \"TYPE\".\n\
6919\(The quotation marks are necessary since terminal types are lower case.)\n");
6920#else /* not VMS */
6921
6922#ifdef HAVE_WINDOW_SYSTEM 6910#ifdef HAVE_WINDOW_SYSTEM
6923 if (! inhibit_window_system) 6911 if (! inhibit_window_system)
6924 fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see `tset').\n"); 6912 fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see `tset').\n");
6925 else 6913 else
6926#endif /* HAVE_WINDOW_SYSTEM */ 6914#endif /* HAVE_WINDOW_SYSTEM */
6927 fprintf (stderr, "Please set the environment variable TERM; see `tset'.\n"); 6915 fprintf (stderr, "Please set the environment variable TERM; see `tset'.\n");
6928#endif /* not VMS */
6929 exit (1); 6916 exit (1);
6930 } 6917 }
6931 6918
6932#ifdef VMS
6933 /* VMS DCL tends to up-case things, so down-case term type.
6934 Hardly any uppercase letters in terminal types; should be none. */
6935 {
6936 char *new = (char *) xmalloc (strlen (terminal_type) + 1);
6937 char *p;
6938
6939 strcpy (new, terminal_type);
6940
6941 for (p = new; *p; p++)
6942 if (isupper (*p))
6943 *p = tolower (*p);
6944
6945 terminal_type = new;
6946 }
6947#endif /* VMS */
6948
6949 { 6919 {
6950 struct terminal *t; 6920 struct terminal *t;
6951 struct frame *f = XFRAME (selected_frame); 6921 struct frame *f = XFRAME (selected_frame);
diff --git a/src/doc.c b/src/doc.c
index 433a6109afc..7f9ab5d3b38 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -58,28 +58,6 @@ extern Lisp_Object Voverriding_local_map;
58 58
59extern Lisp_Object Qremap; 59extern Lisp_Object Qremap;
60 60
61/* For VMS versions with limited file name syntax,
62 convert the name to something VMS will allow. */
63static void
64munge_doc_file_name (name)
65 char *name;
66{
67#ifdef VMS
68#ifndef NO_HYPHENS_IN_FILENAMES
69 extern char * sys_translate_unix (char *ufile);
70 strcpy (name, sys_translate_unix (name));
71#else /* NO_HYPHENS_IN_FILENAMES */
72 char *p = name;
73 while (*p)
74 {
75 if (*p == '-')
76 *p = '_';
77 p++;
78 }
79#endif /* NO_HYPHENS_IN_FILENAMES */
80#endif /* VMS */
81}
82
83/* Buffer used for reading from documentation file. */ 61/* Buffer used for reading from documentation file. */
84static char *get_doc_string_buffer; 62static char *get_doc_string_buffer;
85static int get_doc_string_buffer_size; 63static int get_doc_string_buffer_size;
@@ -169,7 +147,6 @@ get_doc_string (filepos, unibyte, definition)
169 name = (char *) alloca (minsize + SCHARS (file) + 8); 147 name = (char *) alloca (minsize + SCHARS (file) + 8);
170 strcpy (name, SDATA (Vdoc_directory)); 148 strcpy (name, SDATA (Vdoc_directory));
171 strcat (name, SDATA (file)); 149 strcat (name, SDATA (file));
172 munge_doc_file_name (name);
173 } 150 }
174 else 151 else
175 { 152 {
@@ -186,7 +163,6 @@ get_doc_string (filepos, unibyte, definition)
186 So check in ../etc. */ 163 So check in ../etc. */
187 strcpy (name, "../etc/"); 164 strcpy (name, "../etc/");
188 strcat (name, SDATA (file)); 165 strcat (name, SDATA (file));
189 munge_doc_file_name (name);
190 166
191 fd = emacs_open (name, O_RDONLY, 0); 167 fd = emacs_open (name, O_RDONLY, 0);
192 } 168 }
@@ -618,7 +594,6 @@ the same file name is found in the `doc-directory'. */)
618 strcpy (name, SDATA (Vdoc_directory)); 594 strcpy (name, SDATA (Vdoc_directory));
619 } 595 }
620 strcat (name, SDATA (filename)); /*** Add this line ***/ 596 strcat (name, SDATA (filename)); /*** Add this line ***/
621 munge_doc_file_name (name);
622 597
623 /* Vbuild_files is nil when temacs is run, and non-nil after that. */ 598 /* Vbuild_files is nil when temacs is run, and non-nil after that. */
624 if (NILP (Vbuild_files)) 599 if (NILP (Vbuild_files))
diff --git a/src/emacs.c b/src/emacs.c
index 9d1e69f600f..ece0e41487d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -27,10 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include <sys/types.h> 27#include <sys/types.h>
28#include <sys/file.h> 28#include <sys/file.h>
29 29
30#ifdef VMS
31#include <ssdef.h>
32#endif
33
34#ifdef HAVE_UNISTD_H 30#ifdef HAVE_UNISTD_H
35#include <unistd.h> 31#include <unistd.h>
36#endif 32#endif
@@ -378,9 +374,6 @@ fatal_error_signal (sig)
378 shut_down_emacs (sig, 0, Qnil); 374 shut_down_emacs (sig, 0, Qnil);
379 } 375 }
380 376
381#ifdef VMS
382 LIB$STOP (SS$_ABORT);
383#else
384 /* Signal the same code; this time it will really be fatal. 377 /* Signal the same code; this time it will really be fatal.
385 Remember that since we're in a signal handler, the signal we're 378 Remember that since we're in a signal handler, the signal we're
386 going to send is probably blocked, so we have to unblock it if we 379 going to send is probably blocked, so we have to unblock it if we
@@ -393,7 +386,6 @@ fatal_error_signal (sig)
393 fatal_error_signal_hook (); 386 fatal_error_signal_hook ();
394 387
395 kill (getpid (), fatal_error_code); 388 kill (getpid (), fatal_error_code);
396#endif /* not VMS */
397} 389}
398 390
399#ifdef SIGDANGER 391#ifdef SIGDANGER
@@ -591,14 +583,6 @@ DEFUN ("invocation-directory", Finvocation_directory, Sinvocation_directory,
591} 583}
592 584
593 585
594#ifdef VMS
595#ifdef LINK_CRTL_SHARE
596#ifdef SHARABLE_LIB_BUG
597extern noshare char **environ;
598#endif /* SHARABLE_LIB_BUG */
599#endif /* LINK_CRTL_SHARE */
600#endif /* VMS */
601
602#ifdef HAVE_TZSET 586#ifdef HAVE_TZSET
603/* A valid but unlikely value for the TZ environment value. 587/* A valid but unlikely value for the TZ environment value.
604 It is OK (though a bit slower) if the user actually chooses this value. */ 588 It is OK (though a bit slower) if the user actually chooses this value. */
@@ -785,16 +769,7 @@ bug_reporting_address ()
785 769
786/* ARGSUSED */ 770/* ARGSUSED */
787int 771int
788main (argc, argv 772main (int argc, char **argv)
789#ifdef VMS
790, envp
791#endif
792)
793 int argc;
794 char **argv;
795#ifdef VMS
796 char **envp;
797#endif
798{ 773{
799#if GC_MARK_STACK 774#if GC_MARK_STACK
800 Lisp_Object dummy; 775 Lisp_Object dummy;
@@ -921,29 +896,6 @@ main (argc, argv
921 } 896 }
922#endif 897#endif
923 898
924#ifdef VMS
925 /* If -map specified, map the data file in. */
926 {
927 char *file;
928 if (argmatch (argv, argc, "-map", "--map-data", 3, &file, &skip_args))
929 mapin_data (file);
930 }
931
932#ifdef LINK_CRTL_SHARE
933#ifdef SHARABLE_LIB_BUG
934 /* Bletcherous shared libraries! */
935 if (!stdin)
936 stdin = fdopen (0, "r");
937 if (!stdout)
938 stdout = fdopen (1, "w");
939 if (!stderr)
940 stderr = fdopen (2, "w");
941 if (!environ)
942 environ = envp;
943#endif /* SHARABLE_LIB_BUG */
944#endif /* LINK_CRTL_SHARE */
945#endif /* VMS */
946
947#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) 899#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK)
948 /* Extend the stack space available. 900 /* Extend the stack space available.
949 Don't do that if dumping, since some systems (e.g. DJGPP) 901 Don't do that if dumping, since some systems (e.g. DJGPP)
@@ -1565,9 +1517,6 @@ main (argc, argv
1565#endif 1517#endif
1566 syms_of_textprop (); 1518 syms_of_textprop ();
1567 syms_of_composite (); 1519 syms_of_composite ();
1568#ifdef VMS
1569 syms_of_vmsproc ();
1570#endif /* VMS */
1571#ifdef WINDOWSNT 1520#ifdef WINDOWSNT
1572 syms_of_ntproc (); 1521 syms_of_ntproc ();
1573#endif /* WINDOWSNT */ 1522#endif /* WINDOWSNT */
@@ -1644,16 +1593,8 @@ main (argc, argv
1644 init_editfns (); /* init_process uses Voperating_system_release. */ 1593 init_editfns (); /* init_process uses Voperating_system_release. */
1645 init_process (); /* init_display uses add_keyboard_wait_descriptor. */ 1594 init_process (); /* init_display uses add_keyboard_wait_descriptor. */
1646 init_keyboard (); /* This too must precede init_sys_modes. */ 1595 init_keyboard (); /* This too must precede init_sys_modes. */
1647#ifdef VMS
1648 init_vmsproc (); /* And this too. */
1649#endif /* VMS */
1650 if (!noninteractive) 1596 if (!noninteractive)
1651 { 1597 init_display (); /* Determine terminal type. Calls init_sys_modes. */
1652#ifdef VMS
1653 init_vms_input ();/* init_display calls get_tty_size, that needs this. */
1654#endif /* VMS */
1655 init_display (); /* Determine terminal type. Calls init_sys_modes. */
1656 }
1657 init_fns (); 1598 init_fns ();
1658 init_xdisp (); 1599 init_xdisp ();
1659#ifdef HAVE_WINDOW_SYSTEM 1600#ifdef HAVE_WINDOW_SYSTEM
@@ -1662,9 +1603,6 @@ main (argc, argv
1662#endif /* HAVE_WINDOW_SYSTEM */ 1603#endif /* HAVE_WINDOW_SYSTEM */
1663 init_macros (); 1604 init_macros ();
1664 init_floatfns (); 1605 init_floatfns ();
1665#ifdef VMS
1666 init_vmsfns ();
1667#endif /* VMS */
1668#ifdef HAVE_SOUND 1606#ifdef HAVE_SOUND
1669 init_sound (); 1607 init_sound ();
1670#endif 1608#endif
@@ -1770,9 +1708,6 @@ struct standard_args standard_args[] =
1770#ifdef HAVE_SHM 1708#ifdef HAVE_SHM
1771 { "-nl", "--no-shared-memory", 140, 0 }, 1709 { "-nl", "--no-shared-memory", 140, 0 },
1772#endif 1710#endif
1773#ifdef VMS
1774 { "-map", "--map-data", 130, 0 },
1775#endif
1776 { "-t", "--terminal", 120, 1 }, 1711 { "-t", "--terminal", 120, 1 },
1777 { "-nw", "--no-window-system", 110, 0 }, 1712 { "-nw", "--no-window-system", 110, 0 },
1778 { "-nw", "--no-windows", 110, 0 }, 1713 { "-nw", "--no-windows", 110, 0 },
@@ -2051,12 +1986,6 @@ all of which are called before Emacs is actually killed. */)
2051 1986
2052 UNGCPRO; 1987 UNGCPRO;
2053 1988
2054/* Is it really necessary to do this deassign
2055 when we are going to exit anyway? */
2056/* #ifdef VMS
2057 stop_vms_input ();
2058 #endif */
2059
2060 shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil); 1989 shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
2061 1990
2062 /* If we have an auto-save list file, 1991 /* If we have an auto-save list file,
@@ -2124,10 +2053,6 @@ shut_down_emacs (sig, no_x, stuff)
2124 unlock_all_files (); 2053 unlock_all_files ();
2125#endif 2054#endif
2126 2055
2127#ifdef VMS
2128 kill_vms_processes ();
2129#endif
2130
2131#if 0 /* This triggers a bug in XCloseDisplay and is not needed. */ 2056#if 0 /* This triggers a bug in XCloseDisplay and is not needed. */
2132#ifdef HAVE_X_WINDOWS 2057#ifdef HAVE_X_WINDOWS
2133 /* It's not safe to call intern here. Maybe we are crashing. */ 2058 /* It's not safe to call intern here. Maybe we are crashing. */
@@ -2264,9 +2189,6 @@ You must run Emacs in batch mode in order to dump it. */)
2264#endif 2189#endif
2265 2190
2266 fflush (stdout); 2191 fflush (stdout);
2267#ifdef VMS
2268 mapout_data (SDATA (filename));
2269#else
2270 /* Tell malloc where start of impure now is. */ 2192 /* Tell malloc where start of impure now is. */
2271 /* Also arrange for warnings when nearly out of space. */ 2193 /* Also arrange for warnings when nearly out of space. */
2272#ifndef SYSTEM_MALLOC 2194#ifndef SYSTEM_MALLOC
@@ -2297,7 +2219,6 @@ You must run Emacs in batch mode in order to dump it. */)
2297#ifdef DOUG_LEA_MALLOC 2219#ifdef DOUG_LEA_MALLOC
2298 free (malloc_state_ptr); 2220 free (malloc_state_ptr);
2299#endif 2221#endif
2300#endif /* not VMS */
2301 2222
2302 Vpurify_flag = tem; 2223 Vpurify_flag = tem;
2303 2224
@@ -2455,7 +2376,6 @@ Special values:
2455 `ms-dos' compiled as an MS-DOS application. 2376 `ms-dos' compiled as an MS-DOS application.
2456 `windows-nt' compiled as a native W32 application. 2377 `windows-nt' compiled as a native W32 application.
2457 `cygwin' compiled using the Cygwin library. 2378 `cygwin' compiled using the Cygwin library.
2458 `vax-vms' compiled for a (Open)VMS system.
2459Anything else indicates some sort of Unix system. */); 2379Anything else indicates some sort of Unix system. */);
2460 Vsystem_type = intern (SYSTEM_TYPE); 2380 Vsystem_type = intern (SYSTEM_TYPE);
2461 2381
diff --git a/src/fileio.c b/src/fileio.c
index 918c06fdced..69eac9a7e98 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -50,14 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#endif 50#endif
51 51
52#include <ctype.h> 52#include <ctype.h>
53
54#ifdef VMS
55#include "vmsdir.h"
56#include <perror.h>
57#include <stddef.h>
58#include <string.h>
59#endif
60
61#include <errno.h> 53#include <errno.h>
62 54
63#ifndef vax11c 55#ifndef vax11c
@@ -111,13 +103,6 @@ extern int errno;
111#define DRIVE_LETTER(x) (tolower (x)) 103#define DRIVE_LETTER(x) (tolower (x))
112#endif 104#endif
113 105
114#ifdef VMS
115#include <file.h>
116#include <rmsdef.h>
117#include <fab.h>
118#include <nam.h>
119#endif
120
121#include "systime.h" 106#include "systime.h"
122 107
123#ifdef HPUX 108#ifdef HPUX
@@ -200,10 +185,6 @@ Lisp_Object Vwrite_region_annotations_so_far;
200/* File name in which we write a list of all our auto save files. */ 185/* File name in which we write a list of all our auto save files. */
201Lisp_Object Vauto_save_list_file_name; 186Lisp_Object Vauto_save_list_file_name;
202 187
203/* On VMS, nonzero means write new files with record format stmlf.
204 Zero means use var format. */
205int vms_stmlf_recfm;
206
207/* On NT, specifies the directory separator character, used (eg.) when 188/* On NT, specifies the directory separator character, used (eg.) when
208 expanding file names. This can be bound to / or \. */ 189 expanding file names. This can be bound to / or \. */
209Lisp_Object Vdirectory_sep_char; 190Lisp_Object Vdirectory_sep_char;
@@ -404,8 +385,7 @@ DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory,
404 doc: /* Return the directory component in file name FILENAME. 385 doc: /* Return the directory component in file name FILENAME.
405Return nil if FILENAME does not include a directory. 386Return nil if FILENAME does not include a directory.
406Otherwise return a directory name. 387Otherwise return a directory name.
407Given a Unix syntax file name, returns a string ending in slash; 388Given a Unix syntax file name, returns a string ending in slash. */)
408on VMS, perhaps instead a string ending in `:', `]' or `>'. */)
409 (filename) 389 (filename)
410 Lisp_Object filename; 390 Lisp_Object filename;
411{ 391{
@@ -433,9 +413,6 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'. */)
433 p = beg + SBYTES (filename); 413 p = beg + SBYTES (filename);
434 414
435 while (p != beg && !IS_DIRECTORY_SEP (p[-1]) 415 while (p != beg && !IS_DIRECTORY_SEP (p[-1])
436#ifdef VMS
437 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>'
438#endif /* VMS */
439#ifdef DOS_NT 416#ifdef DOS_NT
440 /* only recognise drive specifier at the beginning */ 417 /* only recognise drive specifier at the beginning */
441 && !(p[-1] == ':' 418 && !(p[-1] == ':'
@@ -500,9 +477,6 @@ or the entire name if it contains no slash. */)
500 end = p = beg + SBYTES (filename); 477 end = p = beg + SBYTES (filename);
501 478
502 while (p != beg && !IS_DIRECTORY_SEP (p[-1]) 479 while (p != beg && !IS_DIRECTORY_SEP (p[-1])
503#ifdef VMS
504 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>'
505#endif /* VMS */
506#ifdef DOS_NT 480#ifdef DOS_NT
507 /* only recognise drive specifier at beginning */ 481 /* only recognise drive specifier at beginning */
508 && !(p[-1] == ':' 482 && !(p[-1] == ':'
@@ -557,64 +531,6 @@ file_name_as_directory (out, in)
557 return out; 531 return out;
558 } 532 }
559 533
560#ifdef VMS
561 /* Is it already a directory string? */
562 if (in[size] == ':' || in[size] == ']' || in[size] == '>')
563 return out;
564 /* Is it a VMS directory file name? If so, hack VMS syntax. */
565 else if (! index (in, '/')
566 && ((size > 3 && ! strcmp (&in[size - 3], ".DIR"))
567 || (size > 3 && ! strcmp (&in[size - 3], ".dir"))
568 || (size > 5 && (! strncmp (&in[size - 5], ".DIR", 4)
569 || ! strncmp (&in[size - 5], ".dir", 4))
570 && (in[size - 1] == '.' || in[size - 1] == ';')
571 && in[size] == '1')))
572 {
573 register char *p, *dot;
574 char brack;
575
576 /* x.dir -> [.x]
577 dir:x.dir --> dir:[x]
578 dir:[x]y.dir --> dir:[x.y] */
579 p = in + size;
580 while (p != in && *p != ':' && *p != '>' && *p != ']') p--;
581 if (p != in)
582 {
583 strncpy (out, in, p - in);
584 out[p - in] = '\0';
585 if (*p == ':')
586 {
587 brack = ']';
588 strcat (out, ":[");
589 }
590 else
591 {
592 brack = *p;
593 strcat (out, ".");
594 }
595 p++;
596 }
597 else
598 {
599 brack = ']';
600 strcpy (out, "[.");
601 }
602 dot = index (p, '.');
603 if (dot)
604 {
605 /* blindly remove any extension */
606 size = strlen (out) + (dot - p);
607 strncat (out, p, dot - p);
608 }
609 else
610 {
611 strcat (out, p);
612 size = strlen (out);
613 }
614 out[size++] = brack;
615 out[size] = '\0';
616 }
617#else /* not VMS */
618 /* For Unix syntax, Append a slash if necessary */ 534 /* For Unix syntax, Append a slash if necessary */
619 if (!IS_DIRECTORY_SEP (out[size])) 535 if (!IS_DIRECTORY_SEP (out[size]))
620 { 536 {
@@ -625,7 +541,6 @@ file_name_as_directory (out, in)
625#ifdef DOS_NT 541#ifdef DOS_NT
626 CORRECT_DIR_SEPS (out); 542 CORRECT_DIR_SEPS (out);
627#endif 543#endif
628#endif /* not VMS */
629 return out; 544 return out;
630} 545}
631 546
@@ -636,8 +551,7 @@ This operation exists because a directory is also a file, but its name as
636a directory is different from its name as a file. 551a directory is different from its name as a file.
637The result can be used as the value of `default-directory' 552The result can be used as the value of `default-directory'
638or passed as second argument to `expand-file-name'. 553or passed as second argument to `expand-file-name'.
639For a Unix-syntax file name, just appends a slash. 554For a Unix-syntax file name, just appends a slash. */)
640On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc. */)
641 (file) 555 (file)
642 Lisp_Object file; 556 Lisp_Object file;
643{ 557{
@@ -662,9 +576,6 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc. */)
662 576
663/* 577/*
664 * Convert from directory name to filename. 578 * Convert from directory name to filename.
665 * On VMS:
666 * xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1
667 * xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1
668 * On UNIX, it's simple: just make sure there isn't a terminating / 579 * On UNIX, it's simple: just make sure there isn't a terminating /
669 580
670 * Value is nonzero if the string output is different from the input. 581 * Value is nonzero if the string output is different from the input.
@@ -675,130 +586,9 @@ directory_file_name (src, dst)
675 char *src, *dst; 586 char *src, *dst;
676{ 587{
677 long slen; 588 long slen;
678#ifdef VMS
679 long rlen;
680 char * ptr, * rptr;
681 char bracket;
682 struct FAB fab = cc$rms_fab;
683 struct NAM nam = cc$rms_nam;
684 char esa[NAM$C_MAXRSS];
685#endif /* VMS */
686 589
687 slen = strlen (src); 590 slen = strlen (src);
688#ifdef VMS 591
689 if (! index (src, '/')
690 && (src[slen - 1] == ']'
691 || src[slen - 1] == ':'
692 || src[slen - 1] == '>'))
693 {
694 /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */
695 fab.fab$l_fna = src;
696 fab.fab$b_fns = slen;
697 fab.fab$l_nam = &nam;
698 fab.fab$l_fop = FAB$M_NAM;
699
700 nam.nam$l_esa = esa;
701 nam.nam$b_ess = sizeof esa;
702 nam.nam$b_nop |= NAM$M_SYNCHK;
703
704 /* We call SYS$PARSE to handle such things as [--] for us. */
705 if (SYS$PARSE (&fab, 0, 0) == RMS$_NORMAL)
706 {
707 slen = nam.nam$b_esl;
708 if (esa[slen - 1] == ';' && esa[slen - 2] == '.')
709 slen -= 2;
710 esa[slen] = '\0';
711 src = esa;
712 }
713 if (src[slen - 1] != ']' && src[slen - 1] != '>')
714 {
715 /* what about when we have logical_name:???? */
716 if (src[slen - 1] == ':')
717 { /* Xlate logical name and see what we get */
718 ptr = strcpy (dst, src); /* upper case for getenv */
719 while (*ptr)
720 {
721 if ('a' <= *ptr && *ptr <= 'z')
722 *ptr -= 040;
723 ptr++;
724 }
725 dst[slen - 1] = 0; /* remove colon */
726 if (!(src = egetenv (dst)))
727 return 0;
728 /* should we jump to the beginning of this procedure?
729 Good points: allows us to use logical names that xlate
730 to Unix names,
731 Bad points: can be a problem if we just translated to a device
732 name...
733 For now, I'll punt and always expect VMS names, and hope for
734 the best! */
735 slen = strlen (src);
736 if (src[slen - 1] != ']' && src[slen - 1] != '>')
737 { /* no recursion here! */
738 strcpy (dst, src);
739 return 0;
740 }
741 }
742 else
743 { /* not a directory spec */
744 strcpy (dst, src);
745 return 0;
746 }
747 }
748 bracket = src[slen - 1];
749
750 /* If bracket is ']' or '>', bracket - 2 is the corresponding
751 opening bracket. */
752 ptr = index (src, bracket - 2);
753 if (ptr == 0)
754 { /* no opening bracket */
755 strcpy (dst, src);
756 return 0;
757 }
758 if (!(rptr = rindex (src, '.')))
759 rptr = ptr;
760 slen = rptr - src;
761 strncpy (dst, src, slen);
762 dst[slen] = '\0';
763 if (*rptr == '.')
764 {
765 dst[slen++] = bracket;
766 dst[slen] = '\0';
767 }
768 else
769 {
770 /* If we have the top-level of a rooted directory (i.e. xx:[000000]),
771 then translate the device and recurse. */
772 if (dst[slen - 1] == ':'
773 && dst[slen - 2] != ':' /* skip decnet nodes */
774 && strcmp (src + slen, "[000000]") == 0)
775 {
776 dst[slen - 1] = '\0';
777 if ((ptr = egetenv (dst))
778 && (rlen = strlen (ptr) - 1) > 0
779 && (ptr[rlen] == ']' || ptr[rlen] == '>')
780 && ptr[rlen - 1] == '.')
781 {
782 char * buf = (char *) alloca (strlen (ptr) + 1);
783 strcpy (buf, ptr);
784 buf[rlen - 1] = ']';
785 buf[rlen] = '\0';
786 return directory_file_name (buf, dst);
787 }
788 else
789 dst[slen - 1] = ':';
790 }
791 strcat (dst, "[000000]");
792 slen += 8;
793 }
794 rptr++;
795 rlen = strlen (rptr) - 1;
796 strncat (dst, rptr, rlen);
797 dst[slen + rlen] = '\0';
798 strcat (dst, ".DIR.1");
799 return 1;
800 }
801#endif /* VMS */
802 /* Process as Unix format: just remove any final slash. 592 /* Process as Unix format: just remove any final slash.
803 But leave "/" unchanged; do not change it to "". */ 593 But leave "/" unchanged; do not change it to "". */
804 strcpy (dst, src); 594 strcpy (dst, src);
@@ -821,9 +611,7 @@ DEFUN ("directory-file-name", Fdirectory_file_name, Sdirectory_file_name,
821This is the name of the file that holds the data for the directory DIRECTORY. 611This is the name of the file that holds the data for the directory DIRECTORY.
822This operation exists because a directory is also a file, but its name as 612This operation exists because a directory is also a file, but its name as
823a directory is different from its name as a file. 613a directory is different from its name as a file.
824In Unix-syntax, this function just removes the final slash. 614In Unix-syntax, this function just removes the final slash. */)
825On VMS, given a VMS-syntax directory name such as \"[X.Y]\",
826it returns a file name such as \"[X]Y.DIR.1\". */)
827 (directory) 615 (directory)
828 Lisp_Object directory; 616 Lisp_Object directory;
829{ 617{
@@ -841,14 +629,7 @@ it returns a file name such as \"[X]Y.DIR.1\". */)
841 if (!NILP (handler)) 629 if (!NILP (handler))
842 return call2 (handler, Qdirectory_file_name, directory); 630 return call2 (handler, Qdirectory_file_name, directory);
843 631
844#ifdef VMS
845 /* 20 extra chars is insufficient for VMS, since we might perform a
846 logical name translation. an equivalence string can be up to 255
847 chars long, so grab that much extra space... - sss */
848 buf = (char *) alloca (SBYTES (directory) + 20 + 255);
849#else
850 buf = (char *) alloca (SBYTES (directory) + 20); 632 buf = (char *) alloca (SBYTES (directory) + 20);
851#endif
852 directory_file_name (SDATA (directory), buf); 633 directory_file_name (SDATA (directory), buf);
853 return make_specified_string (buf, -1, strlen (buf), 634 return make_specified_string (buf, -1, strlen (buf),
854 STRING_MULTIBYTE (directory)); 635 STRING_MULTIBYTE (directory));
@@ -1038,14 +819,6 @@ See also the function `substitute-in-file-name'. */)
1038 819
1039 int tlen; 820 int tlen;
1040 struct passwd *pw; 821 struct passwd *pw;
1041#ifdef VMS
1042 unsigned char * colon = 0;
1043 unsigned char * close = 0;
1044 unsigned char * slash = 0;
1045 unsigned char * brack = 0;
1046 int lbrack = 0, rbrack = 0;
1047 int dots = 0;
1048#endif /* VMS */
1049#ifdef DOS_NT 822#ifdef DOS_NT
1050 int drive = 0; 823 int drive = 0;
1051 int collapse_newdir = 1; 824 int collapse_newdir = 1;
@@ -1196,9 +969,6 @@ See also the function `substitute-in-file-name'. */)
1196#ifdef WINDOWSNT 969#ifdef WINDOWSNT
1197 && (drive || IS_DIRECTORY_SEP (nm[1])) && !is_escaped 970 && (drive || IS_DIRECTORY_SEP (nm[1])) && !is_escaped
1198#endif 971#endif
1199#ifdef VMS
1200 || index (nm, ':')
1201#endif /* VMS */
1202 ) 972 )
1203 { 973 {
1204 /* If it turns out that the filename we want to return is just a 974 /* If it turns out that the filename we want to return is just a
@@ -1229,92 +999,10 @@ See also the function `substitute-in-file-name'. */)
1229 && IS_DIRECTORY_SEP (p[0]) 999 && IS_DIRECTORY_SEP (p[0])
1230 && IS_DIRECTORY_SEP (p[1])) 1000 && IS_DIRECTORY_SEP (p[1]))
1231 lose = 1; 1001 lose = 1;
1232
1233#ifdef VMS
1234 if (p[0] == '\\')
1235 lose = 1;
1236 if (p[0] == '/') {
1237 /* if dev:[dir]/, move nm to / */
1238 if (!slash && p > nm && (brack || colon)) {
1239 nm = (brack ? brack + 1 : colon + 1);
1240 lbrack = rbrack = 0;
1241 brack = 0;
1242 colon = 0;
1243 }
1244 slash = p;
1245 }
1246 if (p[0] == '-')
1247#ifdef NO_HYPHENS_IN_FILENAMES
1248 if (lbrack == rbrack)
1249 {
1250 /* Avoid clobbering negative version numbers. */
1251 if (dots < 2)
1252 p[0] = '_';
1253 }
1254 else
1255#endif /* NO_HYPHENS_IN_FILENAMES */
1256 if (lbrack > rbrack
1257 && ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<')
1258 && (p[1] == '.' || p[1] == ']' || p[1] == '>')))
1259 lose = 1;
1260#ifdef NO_HYPHENS_IN_FILENAMES
1261 else
1262 p[0] = '_';
1263#endif /* NO_HYPHENS_IN_FILENAMES */
1264 /* count open brackets, reset close bracket pointer */
1265 if (p[0] == '[' || p[0] == '<')
1266 lbrack++, brack = 0;
1267 /* count close brackets, set close bracket pointer */
1268 if (p[0] == ']' || p[0] == '>')
1269 rbrack++, brack = p;
1270 /* detect ][ or >< */
1271 if ((p[0] == ']' || p[0] == '>') && (p[1] == '[' || p[1] == '<'))
1272 lose = 1;
1273 if ((p[0] == ':' || p[0] == ']' || p[0] == '>') && p[1] == '~')
1274 nm = p + 1, lose = 1;
1275 if (p[0] == ':' && (colon || slash))
1276 /* if dev1:[dir]dev2:, move nm to dev2: */
1277 if (brack)
1278 {
1279 nm = brack + 1;
1280 brack = 0;
1281 }
1282 /* if /name/dev:, move nm to dev: */
1283 else if (slash)
1284 nm = slash + 1;
1285 /* if node::dev:, move colon following dev */
1286 else if (colon && colon[-1] == ':')
1287 colon = p;
1288 /* if dev1:dev2:, move nm to dev2: */
1289 else if (colon && colon[-1] != ':')
1290 {
1291 nm = colon + 1;
1292 colon = 0;
1293 }
1294 if (p[0] == ':' && !colon)
1295 {
1296 if (p[1] == ':')
1297 p++;
1298 colon = p;
1299 }
1300 if (lbrack == rbrack)
1301 if (p[0] == ';')
1302 dots = 2;
1303 else if (p[0] == '.')
1304 dots++;
1305#endif /* VMS */
1306 p++; 1002 p++;
1307 } 1003 }
1308 if (!lose) 1004 if (!lose)
1309 { 1005 {
1310#ifdef VMS
1311 if (index (nm, '/'))
1312 {
1313 nm = sys_translate_unix (nm);
1314 nm_in_name = 0;
1315 return make_specified_string (nm, -1, strlen (nm), multibyte);
1316 }
1317#endif /* VMS */
1318#ifdef DOS_NT 1006#ifdef DOS_NT
1319 /* Make sure directories are all separated with / or \ as 1007 /* Make sure directories are all separated with / or \ as
1320 desired, but avoid allocation of a new string when not 1008 desired, but avoid allocation of a new string when not
@@ -1367,9 +1055,6 @@ See also the function `substitute-in-file-name'. */)
1367 if (nm[0] == '~') /* prefix ~ */ 1055 if (nm[0] == '~') /* prefix ~ */
1368 { 1056 {
1369 if (IS_DIRECTORY_SEP (nm[1]) 1057 if (IS_DIRECTORY_SEP (nm[1])
1370#ifdef VMS
1371 || nm[1] == ':'
1372#endif /* VMS */
1373 || nm[1] == 0) /* ~ by itself */ 1058 || nm[1] == 0) /* ~ by itself */
1374 { 1059 {
1375 Lisp_Object tem; 1060 Lisp_Object tem;
@@ -1393,18 +1078,11 @@ See also the function `substitute-in-file-name'. */)
1393#ifdef DOS_NT 1078#ifdef DOS_NT
1394 collapse_newdir = 0; 1079 collapse_newdir = 0;
1395#endif 1080#endif
1396#ifdef VMS
1397 nm++; /* Don't leave the slash in nm. */
1398#endif /* VMS */
1399 } 1081 }
1400 else /* ~user/filename */ 1082 else /* ~user/filename */
1401 { 1083 {
1402 unsigned char *o, *p; 1084 unsigned char *o, *p;
1403 for (p = nm; *p && (!IS_DIRECTORY_SEP (*p) 1085 for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++);
1404#ifdef VMS
1405 && *p != ':'
1406#endif /* VMS */
1407 ); p++);
1408 o = alloca (p - nm + 1); 1086 o = alloca (p - nm + 1);
1409 bcopy ((char *) nm, o, p - nm); 1087 bcopy ((char *) nm, o, p - nm);
1410 o [p - nm] = 0; 1088 o [p - nm] = 0;
@@ -1415,14 +1093,10 @@ See also the function `substitute-in-file-name'. */)
1415 if (pw) 1093 if (pw)
1416 { 1094 {
1417 newdir = (unsigned char *) pw -> pw_dir; 1095 newdir = (unsigned char *) pw -> pw_dir;
1418#ifdef VMS
1419 nm = p + 1; /* skip the terminator */
1420#else
1421 nm = p; 1096 nm = p;
1422#ifdef DOS_NT 1097#ifdef DOS_NT
1423 collapse_newdir = 0; 1098 collapse_newdir = 0;
1424#endif 1099#endif
1425#endif /* VMS */
1426 } 1100 }
1427 1101
1428 /* If we don't find a user of that name, leave the name 1102 /* If we don't find a user of that name, leave the name
@@ -1465,9 +1139,6 @@ See also the function `substitute-in-file-name'. */)
1465#ifdef WINDOWSNT 1139#ifdef WINDOWSNT
1466 && !(IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1])) 1140 && !(IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
1467#endif 1141#endif
1468#ifdef VMS
1469 && !index (nm, ':')
1470#endif
1471 && !newdir) 1142 && !newdir)
1472 { 1143 {
1473 newdir = SDATA (default_directory); 1144 newdir = SDATA (default_directory);
@@ -1588,7 +1259,6 @@ See also the function `substitute-in-file-name'. */)
1588 1259
1589 if (newdir) 1260 if (newdir)
1590 { 1261 {
1591#ifndef VMS
1592 if (nm[0] == 0 || IS_DIRECTORY_SEP (nm[0])) 1262 if (nm[0] == 0 || IS_DIRECTORY_SEP (nm[0]))
1593 { 1263 {
1594#ifdef DOS_NT 1264#ifdef DOS_NT
@@ -1603,69 +1273,19 @@ See also the function `substitute-in-file-name'. */)
1603 strcpy (target, newdir); 1273 strcpy (target, newdir);
1604 } 1274 }
1605 else 1275 else
1606#endif
1607 file_name_as_directory (target, newdir); 1276 file_name_as_directory (target, newdir);
1608 } 1277 }
1609 1278
1610 strcat (target, nm); 1279 strcat (target, nm);
1611#ifdef VMS
1612 if (index (target, '/'))
1613 strcpy (target, sys_translate_unix (target));
1614#endif /* VMS */
1615
1616 /* ASSERT (IS_DIRECTORY_SEP (target[0])) if not VMS */
1617 1280
1618 /* Now canonicalize by removing `//', `/.' and `/foo/..' if they 1281 /* Now canonicalize by removing `//', `/.' and `/foo/..' if they
1619 appear. */ 1282 appear. */
1620
1621 { 1283 {
1622 unsigned char *p = target; 1284 unsigned char *p = target;
1623 unsigned char *o = target; 1285 unsigned char *o = target;
1624 1286
1625 while (*p) 1287 while (*p)
1626 { 1288 {
1627#ifdef VMS
1628 if (*p != ']' && *p != '>' && *p != '-')
1629 {
1630 if (*p == '\\')
1631 p++;
1632 *o++ = *p++;
1633 }
1634 else if ((p[0] == ']' || p[0] == '>') && p[0] == p[1] + 2)
1635 /* brackets are offset from each other by 2 */
1636 {
1637 p += 2;
1638 if (*p != '.' && *p != '-' && o[-1] != '.')
1639 /* convert [foo][bar] to [bar] */
1640 while (o[-1] != '[' && o[-1] != '<')
1641 o--;
1642 else if (*p == '-' && *o != '.')
1643 *--p = '.';
1644 }
1645 else if (p[0] == '-' && o[-1] == '.'
1646 && (p[1] == '.' || p[1] == ']' || p[1] == '>'))
1647 /* flush .foo.- ; leave - if stopped by '[' or '<' */
1648 {
1649 do
1650 o--;
1651 while (o[-1] != '.' && o[-1] != '[' && o[-1] != '<');
1652 if (p[1] == '.') /* foo.-.bar ==> bar. */
1653 p += 2;
1654 else if (o[-1] == '.') /* '.foo.-]' ==> ']' */
1655 p++, o--;
1656 /* else [foo.-] ==> [-] */
1657 }
1658 else
1659 {
1660#ifdef NO_HYPHENS_IN_FILENAMES
1661 if (*p == '-'
1662 && o[-1] != '[' && o[-1] != '<' && o[-1] != '.'
1663 && p[1] != ']' && p[1] != '>' && p[1] != '.')
1664 *p = '_';
1665#endif /* NO_HYPHENS_IN_FILENAMES */
1666 *o++ = *p++;
1667 }
1668#else /* not VMS */
1669 if (!IS_DIRECTORY_SEP (*p)) 1289 if (!IS_DIRECTORY_SEP (*p))
1670 { 1290 {
1671 *o++ = *p++; 1291 *o++ = *p++;
@@ -1707,7 +1327,6 @@ See also the function `substitute-in-file-name'. */)
1707 { 1327 {
1708 *o++ = *p++; 1328 *o++ = *p++;
1709 } 1329 }
1710#endif /* not VMS */
1711 } 1330 }
1712 1331
1713#ifdef DOS_NT 1332#ifdef DOS_NT
@@ -1777,32 +1396,13 @@ See also the function `substitute-in-file-name'.")
1777 unsigned char *target; 1396 unsigned char *target;
1778 struct passwd *pw; 1397 struct passwd *pw;
1779 int lose; 1398 int lose;
1780#ifdef VMS
1781 unsigned char * colon = 0;
1782 unsigned char * close = 0;
1783 unsigned char * slash = 0;
1784 unsigned char * brack = 0;
1785 int lbrack = 0, rbrack = 0;
1786 int dots = 0;
1787#endif /* VMS */
1788 1399
1789 CHECK_STRING (name); 1400 CHECK_STRING (name);
1790
1791#ifdef VMS
1792 /* Filenames on VMS are always upper case. */
1793 name = Fupcase (name);
1794#endif
1795
1796 nm = SDATA (name); 1401 nm = SDATA (name);
1797 1402
1798 /* If nm is absolute, flush ...// and detect /./ and /../. 1403 /* If nm is absolute, flush ...// and detect /./ and /../.
1799 If no /./ or /../ we can return right away. */ 1404 If no /./ or /../ we can return right away. */
1800 if ( 1405 if (nm[0] == '/')
1801 nm[0] == '/'
1802#ifdef VMS
1803 || index (nm, ':')
1804#endif /* VMS */
1805 )
1806 { 1406 {
1807 p = nm; 1407 p = nm;
1808 lose = 0; 1408 lose = 0;
@@ -1817,87 +1417,10 @@ See also the function `substitute-in-file-name'.")
1817 && (p[2] == '/' || p[2] == 0 1417 && (p[2] == '/' || p[2] == 0
1818 || (p[2] == '.' && (p[3] == '/' || p[3] == 0)))) 1418 || (p[2] == '.' && (p[3] == '/' || p[3] == 0))))
1819 lose = 1; 1419 lose = 1;
1820#ifdef VMS
1821 if (p[0] == '\\')
1822 lose = 1;
1823 if (p[0] == '/') {
1824 /* if dev:[dir]/, move nm to / */
1825 if (!slash && p > nm && (brack || colon)) {
1826 nm = (brack ? brack + 1 : colon + 1);
1827 lbrack = rbrack = 0;
1828 brack = 0;
1829 colon = 0;
1830 }
1831 slash = p;
1832 }
1833 if (p[0] == '-')
1834#ifndef VMS4_4
1835 /* VMS pre V4.4,convert '-'s in filenames. */
1836 if (lbrack == rbrack)
1837 {
1838 if (dots < 2) /* this is to allow negative version numbers */
1839 p[0] = '_';
1840 }
1841 else
1842#endif /* VMS4_4 */
1843 if (lbrack > rbrack
1844 && ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<')
1845 && (p[1] == '.' || p[1] == ']' || p[1] == '>')))
1846 lose = 1;
1847#ifndef VMS4_4
1848 else
1849 p[0] = '_';
1850#endif /* VMS4_4 */
1851 /* count open brackets, reset close bracket pointer */
1852 if (p[0] == '[' || p[0] == '<')
1853 lbrack++, brack = 0;
1854 /* count close brackets, set close bracket pointer */
1855 if (p[0] == ']' || p[0] == '>')
1856 rbrack++, brack = p;
1857 /* detect ][ or >< */
1858 if ((p[0] == ']' || p[0] == '>') && (p[1] == '[' || p[1] == '<'))
1859 lose = 1;
1860 if ((p[0] == ':' || p[0] == ']' || p[0] == '>') && p[1] == '~')
1861 nm = p + 1, lose = 1;
1862 if (p[0] == ':' && (colon || slash))
1863 /* if dev1:[dir]dev2:, move nm to dev2: */
1864 if (brack)
1865 {
1866 nm = brack + 1;
1867 brack = 0;
1868 }
1869 /* If /name/dev:, move nm to dev: */
1870 else if (slash)
1871 nm = slash + 1;
1872 /* If node::dev:, move colon following dev */
1873 else if (colon && colon[-1] == ':')
1874 colon = p;
1875 /* If dev1:dev2:, move nm to dev2: */
1876 else if (colon && colon[-1] != ':')
1877 {
1878 nm = colon + 1;
1879 colon = 0;
1880 }
1881 if (p[0] == ':' && !colon)
1882 {
1883 if (p[1] == ':')
1884 p++;
1885 colon = p;
1886 }
1887 if (lbrack == rbrack)
1888 if (p[0] == ';')
1889 dots = 2;
1890 else if (p[0] == '.')
1891 dots++;
1892#endif /* VMS */
1893 p++; 1420 p++;
1894 } 1421 }
1895 if (!lose) 1422 if (!lose)
1896 { 1423 {
1897#ifdef VMS
1898 if (index (nm, '/'))
1899 return build_string (sys_translate_unix (nm));
1900#endif /* VMS */
1901 if (nm == SDATA (name)) 1424 if (nm == SDATA (name))
1902 return name; 1425 return name;
1903 return build_string (nm); 1426 return build_string (nm);
@@ -1909,18 +1432,11 @@ See also the function `substitute-in-file-name'.")
1909 newdir = 0; 1432 newdir = 0;
1910 1433
1911 if (nm[0] == '~') /* prefix ~ */ 1434 if (nm[0] == '~') /* prefix ~ */
1912 if (nm[1] == '/' 1435 if (nm[1] == '/' || nm[1] == 0)/* ~/filename */
1913#ifdef VMS
1914 || nm[1] == ':'
1915#endif /* VMS */
1916 || nm[1] == 0)/* ~/filename */
1917 { 1436 {
1918 if (!(newdir = (unsigned char *) egetenv ("HOME"))) 1437 if (!(newdir = (unsigned char *) egetenv ("HOME")))
1919 newdir = (unsigned char *) ""; 1438 newdir = (unsigned char *) "";
1920 nm++; 1439 nm++;
1921#ifdef VMS
1922 nm++; /* Don't leave the slash in nm. */
1923#endif /* VMS */
1924 } 1440 }
1925 else /* ~user/filename */ 1441 else /* ~user/filename */
1926 { 1442 {
@@ -1929,11 +1445,6 @@ See also the function `substitute-in-file-name'.")
1929 /* Find end of name. */ 1445 /* Find end of name. */
1930 unsigned char *ptr = (unsigned char *) index (user, '/'); 1446 unsigned char *ptr = (unsigned char *) index (user, '/');
1931 int len = ptr ? ptr - user : strlen (user); 1447 int len = ptr ? ptr - user : strlen (user);
1932#ifdef VMS
1933 unsigned char *ptr1 = index (user, ':');
1934 if (ptr1 != 0 && ptr1 - user < len)
1935 len = ptr1 - user;
1936#endif /* VMS */
1937 /* Copy the user name into temp storage. */ 1448 /* Copy the user name into temp storage. */
1938 o = (unsigned char *) alloca (len + 1); 1449 o = (unsigned char *) alloca (len + 1);
1939 bcopy ((char *) user, o, len); 1450 bcopy ((char *) user, o, len);
@@ -1952,11 +1463,7 @@ See also the function `substitute-in-file-name'.")
1952 nm += len; 1463 nm += len;
1953 } 1464 }
1954 1465
1955 if (nm[0] != '/' 1466 if (nm[0] != '/' && !newdir)
1956#ifdef VMS
1957 && !index (nm, ':')
1958#endif /* not VMS */
1959 && !newdir)
1960 { 1467 {
1961 if (NILP (defalt)) 1468 if (NILP (defalt))
1962 defalt = current_buffer->directory; 1469 defalt = current_buffer->directory;
@@ -1972,19 +1479,13 @@ See also the function `substitute-in-file-name'.")
1972 1479
1973 if (newdir) 1480 if (newdir)
1974 { 1481 {
1975#ifndef VMS
1976 if (nm[0] == 0 || nm[0] == '/') 1482 if (nm[0] == 0 || nm[0] == '/')
1977 strcpy (target, newdir); 1483 strcpy (target, newdir);
1978 else 1484 else
1979#endif
1980 file_name_as_directory (target, newdir); 1485 file_name_as_directory (target, newdir);
1981 } 1486 }
1982 1487
1983 strcat (target, nm); 1488 strcat (target, nm);
1984#ifdef VMS
1985 if (index (target, '/'))
1986 strcpy (target, sys_translate_unix (target));
1987#endif /* VMS */
1988 1489
1989 /* Now canonicalize by removing /. and /foo/.. if they appear */ 1490 /* Now canonicalize by removing /. and /foo/.. if they appear */
1990 1491
@@ -1993,48 +1494,6 @@ See also the function `substitute-in-file-name'.")
1993 1494
1994 while (*p) 1495 while (*p)
1995 { 1496 {
1996#ifdef VMS
1997 if (*p != ']' && *p != '>' && *p != '-')
1998 {
1999 if (*p == '\\')
2000 p++;
2001 *o++ = *p++;
2002 }
2003 else if ((p[0] == ']' || p[0] == '>') && p[0] == p[1] + 2)
2004 /* brackets are offset from each other by 2 */
2005 {
2006 p += 2;
2007 if (*p != '.' && *p != '-' && o[-1] != '.')
2008 /* convert [foo][bar] to [bar] */
2009 while (o[-1] != '[' && o[-1] != '<')
2010 o--;
2011 else if (*p == '-' && *o != '.')
2012 *--p = '.';
2013 }
2014 else if (p[0] == '-' && o[-1] == '.'
2015 && (p[1] == '.' || p[1] == ']' || p[1] == '>'))
2016 /* flush .foo.- ; leave - if stopped by '[' or '<' */
2017 {
2018 do
2019 o--;
2020 while (o[-1] != '.' && o[-1] != '[' && o[-1] != '<');
2021 if (p[1] == '.') /* foo.-.bar ==> bar. */
2022 p += 2;
2023 else if (o[-1] == '.') /* '.foo.-]' ==> ']' */
2024 p++, o--;
2025 /* else [foo.-] ==> [-] */
2026 }
2027 else
2028 {
2029#ifndef VMS4_4
2030 if (*p == '-'
2031 && o[-1] != '[' && o[-1] != '<' && o[-1] != '.'
2032 && p[1] != ']' && p[1] != '>' && p[1] != '.')
2033 *p = '_';
2034#endif /* VMS4_4 */
2035 *o++ = *p++;
2036 }
2037#else /* not VMS */
2038 if (*p != '/') 1497 if (*p != '/')
2039 { 1498 {
2040 *o++ = *p++; 1499 *o++ = *p++;
@@ -2063,7 +1522,6 @@ See also the function `substitute-in-file-name'.")
2063 { 1522 {
2064 *o++ = *p++; 1523 *o++ = *p++;
2065 } 1524 }
2066#endif /* not VMS */
2067 } 1525 }
2068 1526
2069 return make_string (target, o - target); 1527 return make_string (target, o - target);
@@ -2077,13 +1535,6 @@ file_name_absolute_p (filename)
2077{ 1535{
2078 return 1536 return
2079 (IS_DIRECTORY_SEP (*filename) || *filename == '~' 1537 (IS_DIRECTORY_SEP (*filename) || *filename == '~'
2080#ifdef VMS
2081 /* ??? This criterion is probably wrong for '<'. */
2082 || index (filename, ':') || index (filename, '<')
2083 || (*filename == '[' && (filename[1] != '-'
2084 || (filename[2] != '.' && filename[2] != ']'))
2085 && filename[1] != '.')
2086#endif /* VMS */
2087#ifdef DOS_NT 1538#ifdef DOS_NT
2088 || (IS_DRIVE (*filename) && IS_DEVICE_SEP (filename[1]) 1539 || (IS_DRIVE (*filename) && IS_DEVICE_SEP (filename[1])
2089 && IS_DIRECTORY_SEP (filename[2])) 1540 && IS_DIRECTORY_SEP (filename[2]))
@@ -2100,9 +1551,6 @@ search_embedded_absfilename (nm, endp)
2100 for (p = nm + 1; p < endp; p++) 1551 for (p = nm + 1; p < endp; p++)
2101 { 1552 {
2102 if ((0 1553 if ((0
2103#ifdef VMS
2104 || p[-1] == ':' || p[-1] == ']' || p[-1] == '>'
2105#endif /* VMS */
2106 || IS_DIRECTORY_SEP (p[-1])) 1554 || IS_DIRECTORY_SEP (p[-1]))
2107 && file_name_absolute_p (p) 1555 && file_name_absolute_p (p)
2108#if defined (WINDOWSNT) || defined(CYGWIN) 1556#if defined (WINDOWSNT) || defined(CYGWIN)
@@ -2112,11 +1560,7 @@ search_embedded_absfilename (nm, endp)
2112#endif /* not (WINDOWSNT || CYGWIN) */ 1560#endif /* not (WINDOWSNT || CYGWIN) */
2113 ) 1561 )
2114 { 1562 {
2115 for (s = p; *s && (!IS_DIRECTORY_SEP (*s) 1563 for (s = p; *s && (!IS_DIRECTORY_SEP (*s)); s++);
2116#ifdef VMS
2117 && *s != ':'
2118#endif /* VMS */
2119 ); s++);
2120 if (p[0] == '~' && s > p + 1) /* we've got "/~something/" */ 1564 if (p[0] == '~' && s > p + 1) /* we've got "/~something/" */
2121 { 1565 {
2122 unsigned char *o = alloca (s - p + 1); 1566 unsigned char *o = alloca (s - p + 1);
@@ -2147,10 +1591,7 @@ DEFUN ("substitute-in-file-name", Fsubstitute_in_file_name,
2147the value of that variable. The variable name should be terminated 1591the value of that variable. The variable name should be terminated
2148with a character not a letter, digit or underscore; otherwise, enclose 1592with a character not a letter, digit or underscore; otherwise, enclose
2149the entire variable name in braces. 1593the entire variable name in braces.
2150If `/~' appears, all of FILENAME through that `/' is discarded. 1594If `/~' appears, all of FILENAME through that `/' is discarded. */)
2151
2152On VMS, `$' substitution is not done; this function does little and only
2153duplicates what `expand-file-name' does. */)
2154 (filename) 1595 (filename)
2155 Lisp_Object filename; 1596 Lisp_Object filename;
2156{ 1597{
@@ -2189,9 +1630,6 @@ duplicates what `expand-file-name' does. */)
2189 (make_specified_string (p, -1, endp - p, 1630 (make_specified_string (p, -1, endp - p,
2190 STRING_MULTIBYTE (filename))); 1631 STRING_MULTIBYTE (filename)));
2191 1632
2192#ifdef VMS
2193 return filename;
2194#else
2195 1633
2196 /* See if any variables are substituted into the string 1634 /* See if any variables are substituted into the string
2197 and find the total length of their values in `total' */ 1635 and find the total length of their values in `total' */
@@ -2333,7 +1771,6 @@ duplicates what `expand-file-name' does. */)
2333 error ("Substituting nonexistent environment variable \"%s\"", target); 1771 error ("Substituting nonexistent environment variable \"%s\"", target);
2334 1772
2335 /* NOTREACHED */ 1773 /* NOTREACHED */
2336#endif /* not VMS */
2337 return Qnil; 1774 return Qnil;
2338} 1775}
2339 1776
@@ -2347,13 +1784,7 @@ expand_and_dir_to_file (filename, defdir)
2347 register Lisp_Object absname; 1784 register Lisp_Object absname;
2348 1785
2349 absname = Fexpand_file_name (filename, defdir); 1786 absname = Fexpand_file_name (filename, defdir);
2350#ifdef VMS 1787
2351 {
2352 register int c = SREF (absname, SBYTES (absname) - 1);
2353 if (c == ':' || c == ']' || c == '>')
2354 absname = Fdirectory_file_name (absname);
2355 }
2356#else
2357 /* Remove final slash, if any (unless this is the root dir). 1788 /* Remove final slash, if any (unless this is the root dir).
2358 stat behaves differently depending! */ 1789 stat behaves differently depending! */
2359 if (SCHARS (absname) > 1 1790 if (SCHARS (absname) > 1
@@ -2361,7 +1792,6 @@ expand_and_dir_to_file (filename, defdir)
2361 && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname)-2))) 1792 && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname)-2)))
2362 /* We cannot take shortcuts; they might be wrong for magic file names. */ 1793 /* We cannot take shortcuts; they might be wrong for magic file names. */
2363 absname = Fdirectory_file_name (absname); 1794 absname = Fdirectory_file_name (absname);
2364#endif
2365 return absname; 1795 return absname;
2366} 1796}
2367 1797
@@ -2554,10 +1984,6 @@ uid and gid of FILE to NEWNAME. */)
2554 } 1984 }
2555#endif /* S_ISREG && S_ISLNK */ 1985#endif /* S_ISREG && S_ISLNK */
2556 1986
2557#ifdef VMS
2558 /* Create the copy file with the same record format as the input file */
2559 ofd = sys_creat (SDATA (encoded_newname), 0666, ifd);
2560#else
2561#ifdef MSDOS 1987#ifdef MSDOS
2562 /* System's default file type was set to binary by _fmode in emacs.c. */ 1988 /* System's default file type was set to binary by _fmode in emacs.c. */
2563 ofd = emacs_open (SDATA (encoded_newname), 1989 ofd = emacs_open (SDATA (encoded_newname),
@@ -2570,7 +1996,6 @@ uid and gid of FILE to NEWNAME. */)
2570 | (NILP (ok_if_already_exists) ? O_EXCL : 0), 1996 | (NILP (ok_if_already_exists) ? O_EXCL : 0),
2571 0666); 1997 0666);
2572#endif /* not MSDOS */ 1998#endif /* not MSDOS */
2573#endif /* VMS */
2574 if (ofd < 0) 1999 if (ofd < 0)
2575 report_file_error ("Opening output file", Fcons (newname, Qnil)); 2000 report_file_error ("Opening output file", Fcons (newname, Qnil));
2576 2001
@@ -2960,33 +2385,6 @@ This happens for interactive use with M-x. */)
2960#endif /* S_IFLNK */ 2385#endif /* S_IFLNK */
2961} 2386}
2962 2387
2963#ifdef VMS
2964
2965DEFUN ("define-logical-name", Fdefine_logical_name, Sdefine_logical_name,
2966 2, 2, "sDefine logical name: \nsDefine logical name %s as: ",
2967 doc: /* Define the job-wide logical name NAME to have the value STRING.
2968If STRING is nil or a null string, the logical name NAME is deleted. */)
2969 (name, string)
2970 Lisp_Object name;
2971 Lisp_Object string;
2972{
2973 CHECK_STRING (name);
2974 if (NILP (string))
2975 delete_logical_name (SDATA (name));
2976 else
2977 {
2978 CHECK_STRING (string);
2979
2980 if (SCHARS (string) == 0)
2981 delete_logical_name (SDATA (name));
2982 else
2983 define_logical_name (SDATA (name), SDATA (string));
2984 }
2985
2986 return string;
2987}
2988#endif /* VMS */
2989
2990 2388
2991DEFUN ("file-name-absolute-p", Ffile_name_absolute_p, Sfile_name_absolute_p, 2389DEFUN ("file-name-absolute-p", Ffile_name_absolute_p, Sfile_name_absolute_p,
2992 1, 1, 0, 2390 1, 1, 0,
@@ -3182,10 +2580,6 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
3182 ? Qt : Qnil); 2580 ? Qt : Qnil);
3183 2581
3184 dir = Ffile_name_directory (absname); 2582 dir = Ffile_name_directory (absname);
3185#ifdef VMS
3186 if (!NILP (dir))
3187 dir = Fdirectory_file_name (dir);
3188#endif /* VMS */
3189#ifdef MSDOS 2583#ifdef MSDOS
3190 if (!NILP (dir)) 2584 if (!NILP (dir))
3191 dir = Fdirectory_file_name (dir); 2585 dir = Fdirectory_file_name (dir);
@@ -3823,10 +3217,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
3823 3217
3824 record_unwind_protect (close_file_unwind, make_number (fd)); 3218 record_unwind_protect (close_file_unwind, make_number (fd));
3825 3219
3826 /* Supposedly happens on VMS. */
3827 /* Can happen on any platform that uses long as type of off_t, but allows 3220 /* Can happen on any platform that uses long as type of off_t, but allows
3828 file sizes to exceed 2Gb. VMS is no longer officially supported, so 3221 file sizes to exceed 2Gb, so give a suitable message. */
3829 give a message suitable for the latter case. */
3830 if (! not_regular && st.st_size < 0) 3222 if (! not_regular && st.st_size < 0)
3831 error ("Maximum buffer size exceeded"); 3223 error ("Maximum buffer size exceeded");
3832 3224
@@ -4995,9 +4387,6 @@ This does code conversion according to the value of
4995 struct stat st; 4387 struct stat st;
4996 int count = SPECPDL_INDEX (); 4388 int count = SPECPDL_INDEX ();
4997 int count1; 4389 int count1;
4998#ifdef VMS
4999 unsigned char *fname = 0; /* If non-0, original filename (must rename) */
5000#endif /* VMS */
5001 Lisp_Object handler; 4390 Lisp_Object handler;
5002 Lisp_Object visit_file; 4391 Lisp_Object visit_file;
5003 Lisp_Object annotations; 4392 Lisp_Object annotations;
@@ -5131,52 +4520,6 @@ This does code conversion according to the value of
5131#endif /* not DOS_NT */ 4520#endif /* not DOS_NT */
5132 4521
5133 if (desc < 0 && (NILP (append) || errno == ENOENT)) 4522 if (desc < 0 && (NILP (append) || errno == ENOENT))
5134#ifdef VMS
5135 if (auto_saving) /* Overwrite any previous version of autosave file */
5136 {
5137 vms_truncate (fn); /* if fn exists, truncate to zero length */
5138 desc = emacs_open (fn, O_RDWR, 0);
5139 if (desc < 0)
5140 desc = creat_copy_attrs (STRINGP (current_buffer->filename)
5141 ? SDATA (current_buffer->filename) : 0,
5142 fn);
5143 }
5144 else /* Write to temporary name and rename if no errors */
5145 {
5146 Lisp_Object temp_name;
5147 temp_name = Ffile_name_directory (filename);
5148
5149 if (!NILP (temp_name))
5150 {
5151 temp_name = Fmake_temp_name (concat2 (temp_name,
5152 build_string ("$$SAVE$$")));
5153 fname = SDATA (filename);
5154 fn = SDATA (temp_name);
5155 desc = creat_copy_attrs (fname, fn);
5156 if (desc < 0)
5157 {
5158 /* If we can't open the temporary file, try creating a new
5159 version of the original file. VMS "creat" creates a
5160 new version rather than truncating an existing file. */
5161 fn = fname;
5162 fname = 0;
5163 desc = creat (fn, 0666);
5164#if 0 /* This can clobber an existing file and fail to replace it,
5165 if the user runs out of space. */
5166 if (desc < 0)
5167 {
5168 /* We can't make a new version;
5169 try to truncate and rewrite existing version if any. */
5170 vms_truncate (fn);
5171 desc = emacs_open (fn, O_RDWR, 0);
5172 }
5173#endif
5174 }
5175 }
5176 else
5177 desc = creat (fn, 0666);
5178 }
5179#else /* not VMS */
5180#ifdef DOS_NT 4523#ifdef DOS_NT
5181 desc = emacs_open (fn, 4524 desc = emacs_open (fn,
5182 O_WRONLY | O_CREAT | buffer_file_type 4525 O_WRONLY | O_CREAT | buffer_file_type
@@ -5187,7 +4530,6 @@ This does code conversion according to the value of
5187 | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), 4530 | (EQ (mustbenew, Qexcl) ? O_EXCL : 0),
5188 auto_saving ? auto_save_mode_bits : 0666); 4531 auto_saving ? auto_save_mode_bits : 0666);
5189#endif /* not DOS_NT */ 4532#endif /* not DOS_NT */
5190#endif /* not VMS */
5191 4533
5192 if (desc < 0) 4534 if (desc < 0)
5193 { 4535 {
@@ -5222,25 +4564,6 @@ This does code conversion according to the value of
5222 4564
5223 UNGCPRO; 4565 UNGCPRO;
5224 4566
5225#ifdef VMS
5226/*
5227 * Kludge Warning: The VMS C RTL likes to insert carriage returns
5228 * if we do writes that don't end with a carriage return. Furthermore
5229 * it cannot handle writes of more then 16K. The modified
5230 * version of "sys_write" in SYSDEP.C (see comment there) copes with
5231 * this EXCEPT for the last record (if it doesn't end with a carriage
5232 * return). This implies that if your buffer doesn't end with a carriage
5233 * return, you get one free... tough. However it also means that if
5234 * we make two calls to sys_write (a la the following code) you can
5235 * get one at the gap as well. The easiest way to fix this (honest)
5236 * is to move the gap to the next newline (or the end of the buffer).
5237 * Thus this change.
5238 *
5239 * Yech!
5240 */
5241 if (GPT > BEG && GPT_ADDR[-1] != '\n')
5242 move_gap (find_next_newline (GPT, 1));
5243#else
5244#if 0 4567#if 0
5245 /* The new encoding routine doesn't require the following. */ 4568 /* The new encoding routine doesn't require the following. */
5246 4569
@@ -5257,7 +4580,6 @@ This does code conversion according to the value of
5257 SET_PT_BOTH (opoint, opoint_byte); 4580 SET_PT_BOTH (opoint, opoint_byte);
5258 } 4581 }
5259#endif 4582#endif
5260#endif
5261 4583
5262 failure = 0; 4584 failure = 0;
5263 immediate_quit = 1; 4585 immediate_quit = 1;
@@ -5318,29 +4640,14 @@ This does code conversion according to the value of
5318 but who knows about all the other machines with NFS?) */ 4640 but who knows about all the other machines with NFS?) */
5319#if 0 4641#if 0
5320 4642
5321 /* On VMS, must do the stat after the close
5322 since closing changes the modtime. */
5323#ifndef VMS
5324 /* Recall that #if defined does not work on VMS. */
5325#define FOO 4643#define FOO
5326 fstat (desc, &st); 4644 fstat (desc, &st);
5327#endif 4645#endif
5328#endif
5329 4646
5330 /* NFS can report a write failure now. */ 4647 /* NFS can report a write failure now. */
5331 if (emacs_close (desc) < 0) 4648 if (emacs_close (desc) < 0)
5332 failure = 1, save_errno = errno; 4649 failure = 1, save_errno = errno;
5333 4650
5334#ifdef VMS
5335 /* If we wrote to a temporary name and had no errors, rename to real name. */
5336 if (fname)
5337 {
5338 if (!failure)
5339 failure = (rename (fn, fname) != 0), save_errno = errno;
5340 fn = fname;
5341 }
5342#endif /* VMS */
5343
5344#ifndef FOO 4651#ifndef FOO
5345 stat (fn, &st); 4652 stat (fn, &st);
5346#endif 4653#endif
@@ -6256,11 +5563,6 @@ of file names regardless of the current language environment. */);
6256 Fput (Qfile_date_error, Qerror_message, 5563 Fput (Qfile_date_error, Qerror_message,
6257 build_string ("Cannot set file date")); 5564 build_string ("Cannot set file date"));
6258 5565
6259 DEFVAR_BOOL ("vms-stmlf-recfm", &vms_stmlf_recfm,
6260 doc: /* *Non-nil means write new files with record format `stmlf'.
6261nil means use format `var'. This variable is meaningful only on VMS. */);
6262 vms_stmlf_recfm = 0;
6263
6264 DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char, 5566 DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char,
6265 doc: /* Directory separator character for built-in functions that return file names. 5567 doc: /* Directory separator character for built-in functions that return file names.
6266The value is always ?/. Don't use this variable, just use `/'. */); 5568The value is always ?/. Don't use this variable, just use `/'. */);
@@ -6376,9 +5678,6 @@ When non-nil, the function `move-file-to-trash' will be used by
6376 defsubr (&Srename_file); 5678 defsubr (&Srename_file);
6377 defsubr (&Sadd_name_to_file); 5679 defsubr (&Sadd_name_to_file);
6378 defsubr (&Smake_symbolic_link); 5680 defsubr (&Smake_symbolic_link);
6379#ifdef VMS
6380 defsubr (&Sdefine_logical_name);
6381#endif /* VMS */
6382 defsubr (&Sfile_name_absolute_p); 5681 defsubr (&Sfile_name_absolute_p);
6383 defsubr (&Sfile_exists_p); 5682 defsubr (&Sfile_exists_p);
6384 defsubr (&Sfile_executable_p); 5683 defsubr (&Sfile_executable_p);
diff --git a/src/floatfns.c b/src/floatfns.c
index 8ee28210e43..d454d6e3cf1 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -101,16 +101,6 @@ extern int errno;
101#endif 101#endif
102#endif 102#endif
103 103
104/* Avoid traps on VMS from sinh and cosh.
105 All the other functions set errno instead. */
106
107#ifdef VMS
108#undef cosh
109#undef sinh
110#define cosh(x) ((exp(x)+exp(-x))*0.5)
111#define sinh(x) ((exp(x)-exp(-x))*0.5)
112#endif /* VMS */
113
114#ifdef FLOAT_CATCH_SIGILL 104#ifdef FLOAT_CATCH_SIGILL
115static SIGTYPE float_error (); 105static SIGTYPE float_error ();
116#endif 106#endif
diff --git a/src/getpagesize.h b/src/getpagesize.h
index 928e0440cce..1d29be0d45e 100644
--- a/src/getpagesize.h
+++ b/src/getpagesize.h
@@ -19,10 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#ifndef HAVE_GETPAGESIZE 20#ifndef HAVE_GETPAGESIZE
21 21
22# ifdef VMS
23# define getpagesize() 512
24# endif
25
26# ifdef HAVE_UNISTD_H 22# ifdef HAVE_UNISTD_H
27# include <unistd.h> 23# include <unistd.h>
28# endif 24# endif
diff --git a/src/ioctl.h b/src/ioctl.h
deleted file mode 100644
index 34f2a9aa644..00000000000
--- a/src/ioctl.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/* Emacs ioctl emulation for VMS */
2
3/* arch-tag: 48595931-af6e-407d-95c7-484059087767
4 (do not change this comment) */
diff --git a/src/keyboard.c b/src/keyboard.c
index a61eb836f26..51e228b37b0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -51,9 +51,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#include "msdos.h" 51#include "msdos.h"
52#include <time.h> 52#include <time.h>
53#else /* not MSDOS */ 53#else /* not MSDOS */
54#ifndef VMS
55#include <sys/ioctl.h> 54#include <sys/ioctl.h>
56#endif
57#endif /* not MSDOS */ 55#endif /* not MSDOS */
58 56
59#include "syssignal.h" 57#include "syssignal.h"
@@ -4015,9 +4013,6 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
4015 /* One way or another, wait until input is available; then, if 4013 /* One way or another, wait until input is available; then, if
4016 interrupt handlers have not read it, read it now. */ 4014 interrupt handlers have not read it, read it now. */
4017 4015
4018#ifdef OLDVMS
4019 wait_for_kbd_input ();
4020#else
4021/* Note SIGIO has been undef'd if FIONREAD is missing. */ 4016/* Note SIGIO has been undef'd if FIONREAD is missing. */
4022#ifdef SIGIO 4017#ifdef SIGIO
4023 gobble_input (0); 4018 gobble_input (0);
@@ -4048,7 +4043,6 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
4048 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) 4043 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
4049 /* Pass 1 for EXPECT since we just waited to have input. */ 4044 /* Pass 1 for EXPECT since we just waited to have input. */
4050 read_avail_input (1); 4045 read_avail_input (1);
4051#endif /* not VMS */
4052 } 4046 }
4053 4047
4054 if (CONSP (Vunread_command_events)) 4048 if (CONSP (Vunread_command_events))
@@ -6907,7 +6901,6 @@ gobble_input (expected)
6907 xd_read_queued_messages (); 6901 xd_read_queued_messages ();
6908#endif /* HAVE_DBUS */ 6902#endif /* HAVE_DBUS */
6909 6903
6910#ifndef VMS
6911#ifdef SIGIO 6904#ifdef SIGIO
6912 if (interrupt_input) 6905 if (interrupt_input)
6913 { 6906 {
@@ -6930,7 +6923,6 @@ gobble_input (expected)
6930 } 6923 }
6931 else 6924 else
6932#endif 6925#endif
6933#endif
6934 read_avail_input (expected); 6926 read_avail_input (expected);
6935#endif 6927#endif
6936} 6928}
@@ -6980,17 +6972,11 @@ record_asynch_buffer_change ()
6980 } 6972 }
6981} 6973}
6982 6974
6983#ifndef VMS
6984
6985/* Read any terminal input already buffered up by the system 6975/* Read any terminal input already buffered up by the system
6986 into the kbd_buffer, but do not wait. 6976 into the kbd_buffer, but do not wait.
6987 6977
6988 EXPECTED should be nonzero if the caller knows there is some input. 6978 EXPECTED should be nonzero if the caller knows there is some input.
6989 6979
6990 Except on VMS, all input is read by this function.
6991 If interrupt_input is nonzero, this function MUST be called
6992 only when SIGIO is blocked.
6993
6994 Returns the number of keyboard chars read, or -1 meaning 6980 Returns the number of keyboard chars read, or -1 meaning
6995 this is a bad time to try to read input. */ 6981 this is a bad time to try to read input. */
6996 6982
@@ -7238,7 +7224,6 @@ tty_read_avail_input (struct terminal *terminal,
7238 7224
7239 return nread; 7225 return nread;
7240} 7226}
7241#endif /* not VMS */
7242 7227
7243void 7228void
7244handle_async_input () 7229handle_async_input ()
@@ -11011,19 +10996,11 @@ handle_interrupt ()
11011 */ 10996 */
11012 sys_suspend (); 10997 sys_suspend ();
11013#else 10998#else
11014#ifdef VMS
11015 if (sys_suspend () == -1)
11016 {
11017 printf ("Not running as a subprocess;\n");
11018 printf ("you can continue or abort.\n");
11019 }
11020#else /* not VMS */
11021 /* Perhaps should really fork an inferior shell? 10999 /* Perhaps should really fork an inferior shell?
11022 But that would not provide any way to get back 11000 But that would not provide any way to get back
11023 to the original shell, ever. */ 11001 to the original shell, ever. */
11024 printf ("No support for stopping a process on this operating system;\n"); 11002 printf ("No support for stopping a process on this operating system;\n");
11025 printf ("you can continue or abort.\n"); 11003 printf ("you can continue or abort.\n");
11026#endif /* not VMS */
11027#endif /* not SIGTSTP */ 11004#endif /* not SIGTSTP */
11028#ifdef MSDOS 11005#ifdef MSDOS
11029 /* We must remain inside the screen area when the internal terminal 11006 /* We must remain inside the screen area when the internal terminal
@@ -11062,11 +11039,7 @@ handle_interrupt ()
11062#ifdef MSDOS 11039#ifdef MSDOS
11063 printf ("\r\nAbort? (y or n) "); 11040 printf ("\r\nAbort? (y or n) ");
11064#else /* not MSDOS */ 11041#else /* not MSDOS */
11065#ifdef VMS
11066 printf ("Abort (and enter debugger)? (y or n) ");
11067#else /* not VMS */
11068 printf ("Abort (and dump core)? (y or n) "); 11042 printf ("Abort (and dump core)? (y or n) ");
11069#endif /* not VMS */
11070#endif /* not MSDOS */ 11043#endif /* not MSDOS */
11071 fflush (stdout); 11044 fflush (stdout);
11072 if (((c = getchar ()) & ~040) == 'Y') 11045 if (((c = getchar ()) & ~040) == 'Y')
@@ -11169,11 +11142,6 @@ See also `current-input-mode'. */)
11169 new_interrupt_input = 0; 11142 new_interrupt_input = 0;
11170#endif /* not SIGIO */ 11143#endif /* not SIGIO */
11171 11144
11172/* Our VMS input only works by interrupts, as of now. */
11173#ifdef VMS
11174 new_interrupt_input = 1;
11175#endif
11176
11177 if (new_interrupt_input != interrupt_input) 11145 if (new_interrupt_input != interrupt_input)
11178 { 11146 {
11179#ifdef POLL_FOR_INPUT 11147#ifdef POLL_FOR_INPUT
@@ -11589,11 +11557,6 @@ init_keyboard ()
11589 interrupt_input = 0; 11557 interrupt_input = 0;
11590#endif 11558#endif
11591 11559
11592/* Our VMS input only works by interrupts, as of now. */
11593#ifdef VMS
11594 interrupt_input = 1;
11595#endif
11596
11597 sigfree (); 11560 sigfree ();
11598 dribble = 0; 11561 dribble = 0;
11599 11562
diff --git a/src/lread.c b/src/lread.c
index 872b6cfc2fc..f36162b1a85 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1342,11 +1342,7 @@ complete_filename_p (pathname)
1342 register const unsigned char *s = SDATA (pathname); 1342 register const unsigned char *s = SDATA (pathname);
1343 return (IS_DIRECTORY_SEP (s[0]) 1343 return (IS_DIRECTORY_SEP (s[0])
1344 || (SCHARS (pathname) > 2 1344 || (SCHARS (pathname) > 2
1345 && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2])) 1345 && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2])));
1346#ifdef VMS
1347 || index (s, ':')
1348#endif /* VMS */
1349 );
1350} 1346}
1351 1347
1352DEFUN ("locate-file-internal", Flocate_file_internal, Slocate_file_internal, 2, 4, 0, 1348DEFUN ("locate-file-internal", Flocate_file_internal, Slocate_file_internal, 2, 4, 0,
@@ -3719,9 +3715,7 @@ oblookup (obarray, ptr, size, size_byte)
3719 } 3715 }
3720 /* This is sometimes needed in the middle of GC. */ 3716 /* This is sometimes needed in the middle of GC. */
3721 obsize &= ~ARRAY_MARK_FLAG; 3717 obsize &= ~ARRAY_MARK_FLAG;
3722 /* Combining next two lines breaks VMS C 2.3. */ 3718 hash = hash_string (ptr, size_byte) % obsize;
3723 hash = hash_string (ptr, size_byte);
3724 hash %= obsize;
3725 bucket = XVECTOR (obarray)->contents[hash]; 3719 bucket = XVECTOR (obarray)->contents[hash];
3726 oblookup_last_bucket_number = hash; 3720 oblookup_last_bucket_number = hash;
3727 if (EQ (bucket, make_number (0))) 3721 if (EQ (bucket, make_number (0)))
diff --git a/src/m/vax.h b/src/m/vax.h
index 8b0593c028d..bfb0dee5f23 100644
--- a/src/m/vax.h
+++ b/src/m/vax.h
@@ -25,11 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25NOTE-START 25NOTE-START
26The vax (-machine=vax) runs zillions of different operating systems. 26The vax (-machine=vax) runs zillions of different operating systems.
27 27
28Vax running VMS (-opsystem=vms)
29
30 18.36 believed to work. Addition of features is necessary to make
31 this Emacs version more usable.
32
33NOTE-END */ 28NOTE-END */
34 29
35/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 30/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
@@ -57,18 +52,6 @@ NOTE-END */
57 52
58#endif /* BSD_SYSTEM */ 53#endif /* BSD_SYSTEM */
59 54
60#ifdef VMS
61
62/* Data type of load average, as read out of driver. */
63
64#define LOAD_AVE_TYPE float
65
66/* Convert that into an integer that is 100 for a load average of 1.0 */
67
68#define LOAD_AVE_CVT(x) ((int) ((x) * 100.0))
69
70#endif /* VMS */
71
72#ifdef BSD4_2 55#ifdef BSD4_2
73#define HAVE_FTIME 56#define HAVE_FTIME
74#endif 57#endif
diff --git a/src/ndir.h b/src/ndir.h
index d254b5cf603..d7bac9d3fae 100644
--- a/src/ndir.h
+++ b/src/ndir.h
@@ -7,30 +7,13 @@
7 * copyright, constituting the only possible expression of the 7 * copyright, constituting the only possible expression of the
8 * algorithm in this format. 8 * algorithm in this format.
9 */ 9 */
10#ifdef VMS
11#ifndef FAB$C_BID
12#include <fab.h>
13#endif
14#ifndef NAM$C_BID
15#include <nam.h>
16#endif
17#ifndef RMS$_SUC
18#include <rmsdef.h>
19#endif
20#include "vmsdir.h"
21#endif /* VMS */
22 10
23#define DIRBLKSIZ 512 /* size of directory block */ 11#define DIRBLKSIZ 512 /* size of directory block */
24#ifdef VMS
25#define MAXNAMLEN (DIR$S_NAME + 7) /* 80 plus room for version #. */
26#define MAXFULLSPEC NAM$C_MAXRSS /* Maximum full spec */
27#else
28#ifdef WINDOWSNT 12#ifdef WINDOWSNT
29#define MAXNAMLEN 255 13#define MAXNAMLEN 255
30#else /* not WINDOWSNT */ 14#else /* not WINDOWSNT */
31#define MAXNAMLEN 15 /* maximum filename length */ 15#define MAXNAMLEN 15 /* maximum filename length */
32#endif /* not WINDOWSNT */ 16#endif /* not WINDOWSNT */
33#endif /* VMS */
34 /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */ 17 /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */
35 18
36struct direct /* data from readdir() */ 19struct direct /* data from readdir() */
diff --git a/src/param.h b/src/param.h
deleted file mode 100644
index 5e80bf9e548..00000000000
--- a/src/param.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/* This is so that Emacs can run on VMS... */
2#define EXEC_PAGESIZE 512
3
4/* arch-tag: a6daea28-33a6-4dd3-97d8-5ee1a12f09d3
5 (do not change this comment) */
diff --git a/src/print.c b/src/print.c
index b9d2e12be15..90b46496eff 100644
--- a/src/print.c
+++ b/src/print.c
@@ -167,11 +167,6 @@ extern int noninteractive_need_newline;
167 167
168extern int minibuffer_auto_raise; 168extern int minibuffer_auto_raise;
169 169
170#ifdef MAX_PRINT_CHARS
171static int print_chars;
172static int max_print;
173#endif /* MAX_PRINT_CHARS */
174
175void print_interval (); 170void print_interval ();
176 171
177/* GDB resets this to zero on W32 to disable OutputDebugString calls. */ 172/* GDB resets this to zero on W32 to disable OutputDebugString calls. */
@@ -309,11 +304,6 @@ printchar (ch, fun)
309 unsigned int ch; 304 unsigned int ch;
310 Lisp_Object fun; 305 Lisp_Object fun;
311{ 306{
312#ifdef MAX_PRINT_CHARS
313 if (max_print)
314 print_chars++;
315#endif /* MAX_PRINT_CHARS */
316
317 if (!NILP (fun) && !EQ (fun, Qt)) 307 if (!NILP (fun) && !EQ (fun, Qt))
318 call1 (fun, make_number (ch)); 308 call1 (fun, make_number (ch));
319 else 309 else
@@ -382,11 +372,6 @@ strout (ptr, size, size_byte, printcharfun, multibyte)
382 bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte); 372 bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte);
383 print_buffer_pos += size; 373 print_buffer_pos += size;
384 print_buffer_pos_byte += size_byte; 374 print_buffer_pos_byte += size_byte;
385
386#ifdef MAX_PRINT_CHARS
387 if (max_print)
388 print_chars += size;
389#endif /* MAX_PRINT_CHARS */
390 } 375 }
391 else if (noninteractive && EQ (printcharfun, Qt)) 376 else if (noninteractive && EQ (printcharfun, Qt))
392 { 377 {
@@ -419,11 +404,6 @@ strout (ptr, size, size_byte, printcharfun, multibyte)
419 insert_char (ch); 404 insert_char (ch);
420 } 405 }
421 } 406 }
422
423#ifdef MAX_PRINT_CHARS
424 if (max_print)
425 print_chars += size;
426#endif /* MAX_PRINT_CHARS */
427 } 407 }
428 else 408 else
429 { 409 {
@@ -764,9 +744,6 @@ is used instead. */)
764{ 744{
765 PRINTDECLARE; 745 PRINTDECLARE;
766 746
767#ifdef MAX_PRINT_CHARS
768 max_print = 0;
769#endif /* MAX_PRINT_CHARS */
770 if (NILP (printcharfun)) 747 if (NILP (printcharfun))
771 printcharfun = Vstandard_output; 748 printcharfun = Vstandard_output;
772 PRINTPREPARE; 749 PRINTPREPARE;
@@ -900,10 +877,6 @@ is used instead. */)
900 PRINTDECLARE; 877 PRINTDECLARE;
901 struct gcpro gcpro1; 878 struct gcpro gcpro1;
902 879
903#ifdef MAX_PRINT_CHARS
904 print_chars = 0;
905 max_print = MAX_PRINT_CHARS;
906#endif /* MAX_PRINT_CHARS */
907 if (NILP (printcharfun)) 880 if (NILP (printcharfun))
908 printcharfun = Vstandard_output; 881 printcharfun = Vstandard_output;
909 GCPRO1 (object); 882 GCPRO1 (object);
@@ -912,10 +885,6 @@ is used instead. */)
912 print (object, printcharfun, 1); 885 print (object, printcharfun, 1);
913 PRINTCHAR ('\n'); 886 PRINTCHAR ('\n');
914 PRINTFINISH; 887 PRINTFINISH;
915#ifdef MAX_PRINT_CHARS
916 max_print = 0;
917 print_chars = 0;
918#endif /* MAX_PRINT_CHARS */
919 UNGCPRO; 888 UNGCPRO;
920 return object; 889 return object;
921} 890}
@@ -1614,14 +1583,6 @@ print_object (obj, printcharfun, escapeflag)
1614 1583
1615 print_depth++; 1584 print_depth++;
1616 1585
1617#ifdef MAX_PRINT_CHARS
1618 if (max_print && print_chars > max_print)
1619 {
1620 PRINTCHAR ('\n');
1621 print_chars = 0;
1622 }
1623#endif /* MAX_PRINT_CHARS */
1624
1625 switch (XTYPE (obj)) 1586 switch (XTYPE (obj))
1626 { 1587 {
1627 case Lisp_Int: 1588 case Lisp_Int:
diff --git a/src/process.c b/src/process.c
index 3d64ff2cdd0..f343ccc0cc4 100644
--- a/src/process.c
+++ b/src/process.c
@@ -159,11 +159,7 @@ extern Lisp_Object QCfilter;
159#endif /* HAVE_SOCKETS */ 159#endif /* HAVE_SOCKETS */
160 160
161/* Define first descriptor number available for subprocesses. */ 161/* Define first descriptor number available for subprocesses. */
162#ifdef VMS
163#define FIRST_PROC_DESC 1
164#else /* Not VMS */
165#define FIRST_PROC_DESC 3 162#define FIRST_PROC_DESC 3
166#endif
167 163
168/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals 164/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
169 testing SIGCHLD. */ 165 testing SIGCHLD. */
@@ -192,9 +188,6 @@ extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
192#ifndef USE_CRT_DLL 188#ifndef USE_CRT_DLL
193extern int errno; 189extern int errno;
194#endif 190#endif
195#ifdef VMS
196extern char *sys_errlist[];
197#endif
198 191
199#ifndef HAVE_H_ERRNO 192#ifndef HAVE_H_ERRNO
200extern int h_errno; 193extern int h_errno;
@@ -1417,12 +1410,7 @@ list_processes_1 (query_only)
1417 { 1410 {
1418 Lisp_Object tem; 1411 Lisp_Object tem;
1419 tem = Fcar (Fcdr (p->status)); 1412 tem = Fcar (Fcdr (p->status));
1420#ifdef VMS 1413 Fprinc (symbol, Qnil);
1421 if (XINT (tem) < NSIG)
1422 write_string (sys_errlist [XINT (tem)], -1);
1423 else
1424#endif
1425 Fprinc (symbol, Qnil);
1426 } 1414 }
1427 else if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1415 else if (NETCONN1_P (p) || SERIALCONN1_P (p))
1428 { 1416 {
@@ -1587,12 +1575,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1587 register Lisp_Object *args; 1575 register Lisp_Object *args;
1588{ 1576{
1589 Lisp_Object buffer, name, program, proc, current_dir, tem; 1577 Lisp_Object buffer, name, program, proc, current_dir, tem;
1590#ifdef VMS
1591 register unsigned char *new_argv;
1592 int len;
1593#else
1594 register unsigned char **new_argv; 1578 register unsigned char **new_argv;
1595#endif
1596 register int i; 1579 register int i;
1597 int count = SPECPDL_INDEX (); 1580 int count = SPECPDL_INDEX ();
1598 1581
@@ -1709,28 +1692,6 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1709 XPROCESS (proc)->encode_coding_system = val; 1692 XPROCESS (proc)->encode_coding_system = val;
1710 } 1693 }
1711 1694
1712#ifdef VMS
1713 /* Make a one member argv with all args concatenated
1714 together separated by a blank. */
1715 len = SBYTES (program) + 2;
1716 for (i = 3; i < nargs; i++)
1717 {
1718 tem = args[i];
1719 CHECK_STRING (tem);
1720 len += SBYTES (tem) + 1; /* count the blank */
1721 }
1722 new_argv = (unsigned char *) alloca (len);
1723 strcpy (new_argv, SDATA (program));
1724 for (i = 3; i < nargs; i++)
1725 {
1726 tem = args[i];
1727 CHECK_STRING (tem);
1728 strcat (new_argv, " ");
1729 strcat (new_argv, SDATA (tem));
1730 }
1731 /* Need to add code here to check for program existence on VMS */
1732
1733#else /* not VMS */
1734 new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *)); 1695 new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
1735 1696
1736 /* If program file name is not absolute, search our path for it. 1697 /* If program file name is not absolute, search our path for it.
@@ -1782,7 +1743,6 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1782 new_argv[i - 2] = SDATA (tem); 1743 new_argv[i - 2] = SDATA (tem);
1783 } 1744 }
1784 new_argv[i - 2] = 0; 1745 new_argv[i - 2] = 0;
1785#endif /* not VMS */
1786 1746
1787 XPROCESS (proc)->decoding_buf = make_uninit_string (0); 1747 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1788 XPROCESS (proc)->decoding_carryover = 0; 1748 XPROCESS (proc)->decoding_carryover = 0;
@@ -1841,7 +1801,6 @@ create_process_sigchld ()
1841#endif 1801#endif
1842#endif 1802#endif
1843 1803
1844#ifndef VMS /* VMS version of this function is in vmsproc.c. */
1845void 1804void
1846create_process (process, new_argv, current_dir) 1805create_process (process, new_argv, current_dir)
1847 Lisp_Object process; 1806 Lisp_Object process;
@@ -2285,7 +2244,6 @@ create_process (process, new_argv, current_dir)
2285 if (pid < 0) 2244 if (pid < 0)
2286 report_file_error ("Doing vfork", Qnil); 2245 report_file_error ("Doing vfork", Qnil);
2287} 2246}
2288#endif /* not VMS */
2289 2247
2290 2248
2291#ifdef HAVE_SOCKETS 2249#ifdef HAVE_SOCKETS
@@ -4098,19 +4056,9 @@ deactivate_process (proc)
4098 { 4056 {
4099 /* Beware SIGCHLD hereabouts. */ 4057 /* Beware SIGCHLD hereabouts. */
4100 flush_pending_output (inchannel); 4058 flush_pending_output (inchannel);
4101#ifdef VMS
4102 {
4103 VMS_PROC_STUFF *get_vms_process_pointer (), *vs;
4104 sys$dassgn (outchannel);
4105 vs = get_vms_process_pointer (p->pid);
4106 if (vs)
4107 give_back_vms_process_stuff (vs);
4108 }
4109#else
4110 emacs_close (inchannel); 4059 emacs_close (inchannel);
4111 if (outchannel >= 0 && outchannel != inchannel) 4060 if (outchannel >= 0 && outchannel != inchannel)
4112 emacs_close (outchannel); 4061 emacs_close (outchannel);
4113#endif
4114 4062
4115 p->infd = -1; 4063 p->infd = -1;
4116 p->outfd = -1; 4064 p->outfd = -1;
@@ -5231,37 +5179,6 @@ read_process_output (proc, channel)
5231 int carryover = p->decoding_carryover; 5179 int carryover = p->decoding_carryover;
5232 int readmax = 4096; 5180 int readmax = 4096;
5233 5181
5234#ifdef VMS
5235 VMS_PROC_STUFF *vs, *get_vms_process_pointer();
5236
5237 vs = get_vms_process_pointer (p->pid);
5238 if (vs)
5239 {
5240 if (!vs->iosb[0])
5241 return (0); /* Really weird if it does this */
5242 if (!(vs->iosb[0] & 1))
5243 return -1; /* I/O error */
5244 }
5245 else
5246 error ("Could not get VMS process pointer");
5247 chars = vs->inputBuffer;
5248 nbytes = clean_vms_buffer (chars, vs->iosb[1]);
5249 if (nbytes <= 0)
5250 {
5251 start_vms_process_read (vs); /* Crank up the next read on the process */
5252 return 1; /* Nothing worth printing, say we got 1 */
5253 }
5254 if (carryover > 0)
5255 {
5256 /* The data carried over in the previous decoding (which are at
5257 the tail of decoding buffer) should be prepended to the new
5258 data read to decode all together. */
5259 chars = (char *) alloca (nbytes + carryover);
5260 bcopy (SDATA (p->decoding_buf), buf, carryover);
5261 bcopy (vs->inputBuffer, chars + carryover, nbytes);
5262 }
5263#else /* not VMS */
5264
5265 chars = (char *) alloca (carryover + readmax); 5182 chars = (char *) alloca (carryover + readmax);
5266 if (carryover) 5183 if (carryover)
5267 /* See the comment above. */ 5184 /* See the comment above. */
@@ -5318,7 +5235,6 @@ read_process_output (proc, channel)
5318 else 5235 else
5319 nbytes = nbytes + 1; 5236 nbytes = nbytes + 1;
5320 } 5237 }
5321#endif /* not VMS */
5322 5238
5323 p->decoding_carryover = 0; 5239 p->decoding_carryover = 0;
5324 5240
@@ -5441,9 +5357,6 @@ read_process_output (proc, channel)
5441 if (waiting_for_user_input_p == -1) 5357 if (waiting_for_user_input_p == -1)
5442 record_asynch_buffer_change (); 5358 record_asynch_buffer_change ();
5443 5359
5444#ifdef VMS
5445 start_vms_process_read (vs);
5446#endif
5447 unbind_to (count, Qnil); 5360 unbind_to (count, Qnil);
5448 return nbytes; 5361 return nbytes;
5449 } 5362 }
@@ -5566,9 +5479,6 @@ read_process_output (proc, channel)
5566 SET_PT_BOTH (opoint, opoint_byte); 5479 SET_PT_BOTH (opoint, opoint_byte);
5567 set_buffer_internal (old); 5480 set_buffer_internal (old);
5568 } 5481 }
5569#ifdef VMS
5570 start_vms_process_read (vs);
5571#endif
5572 return nbytes; 5482 return nbytes;
5573} 5483}
5574 5484
@@ -5620,10 +5530,6 @@ send_process (proc, buf, len, object)
5620 5530
5621 GCPRO1 (object); 5531 GCPRO1 (object);
5622 5532
5623#ifdef VMS
5624 VMS_PROC_STUFF *vs, *get_vms_process_pointer();
5625#endif /* VMS */
5626
5627 if (p->raw_status_new) 5533 if (p->raw_status_new)
5628 update_status (p); 5534 update_status (p);
5629 if (! EQ (p->status, Qrun)) 5535 if (! EQ (p->status, Qrun))
@@ -5704,14 +5610,6 @@ send_process (proc, buf, len, object)
5704 buf = SDATA (coding->dst_object); 5610 buf = SDATA (coding->dst_object);
5705 } 5611 }
5706 5612
5707#ifdef VMS
5708 vs = get_vms_process_pointer (p->pid);
5709 if (vs == 0)
5710 error ("Could not find this process: %x", p->pid);
5711 else if (write_to_vms_process (vs, buf, len))
5712 ;
5713#else /* not VMS */
5714
5715 if (pty_max_bytes == 0) 5613 if (pty_max_bytes == 0)
5716 { 5614 {
5717#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON) 5615#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON)
@@ -5873,23 +5771,16 @@ send_process (proc, buf, len, object)
5873 Fprocess_send_eof (proc); 5771 Fprocess_send_eof (proc);
5874 } 5772 }
5875 } 5773 }
5876#endif /* not VMS */
5877 else 5774 else
5878 { 5775 {
5879 signal (SIGPIPE, old_sigpipe); 5776 signal (SIGPIPE, old_sigpipe);
5880#ifndef VMS
5881 proc = process_sent_to; 5777 proc = process_sent_to;
5882 p = XPROCESS (proc); 5778 p = XPROCESS (proc);
5883#endif
5884 p->raw_status_new = 0; 5779 p->raw_status_new = 0;
5885 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil)); 5780 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil));
5886 p->tick = ++process_tick; 5781 p->tick = ++process_tick;
5887 deactivate_process (proc); 5782 deactivate_process (proc);
5888#ifdef VMS
5889 error ("Error writing to process %s; closed it", SDATA (p->name));
5890#else
5891 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); 5783 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
5892#endif
5893 } 5784 }
5894 5785
5895 UNGCPRO; 5786 UNGCPRO;
@@ -6193,20 +6084,8 @@ process_send_signal (process, signo, current_group, nomsg)
6193 break; 6084 break;
6194#endif /* ! defined (SIGCONT) */ 6085#endif /* ! defined (SIGCONT) */
6195 case SIGINT: 6086 case SIGINT:
6196#ifdef VMS
6197 send_process (proc, "\003", 1, Qnil); /* ^C */
6198 goto whoosh;
6199#endif
6200 case SIGQUIT: 6087 case SIGQUIT:
6201#ifdef VMS
6202 send_process (proc, "\031", 1, Qnil); /* ^Y */
6203 goto whoosh;
6204#endif
6205 case SIGKILL: 6088 case SIGKILL:
6206#ifdef VMS
6207 sys$forcex (&(p->pid), 0, 1);
6208 whoosh:
6209#endif
6210 flush_pending_output (p->infd); 6089 flush_pending_output (p->infd);
6211 break; 6090 break;
6212 } 6091 }
@@ -6547,9 +6426,6 @@ process has been transmitted to the serial port. */)
6547 send_process (proc, "", 0, Qnil); 6426 send_process (proc, "", 0, Qnil);
6548 } 6427 }
6549 6428
6550#ifdef VMS
6551 send_process (proc, "\032", 1, Qnil); /* ^z */
6552#else
6553 if (XPROCESS (proc)->pty_flag) 6429 if (XPROCESS (proc)->pty_flag)
6554 send_process (proc, "\004", 1, Qnil); 6430 send_process (proc, "\004", 1, Qnil);
6555 else if (EQ (XPROCESS (proc)->type, Qserial)) 6431 else if (EQ (XPROCESS (proc)->type, Qserial))
@@ -6594,7 +6470,6 @@ process has been transmitted to the serial port. */)
6594 6470
6595 XPROCESS (proc)->outfd = new_outfd; 6471 XPROCESS (proc)->outfd = new_outfd;
6596 } 6472 }
6597#endif /* VMS */
6598 return process; 6473 return process;
6599} 6474}
6600 6475
diff --git a/src/process.h b/src/process.h
index 29cf38a2a4f..3f50fc5a146 100644
--- a/src/process.h
+++ b/src/process.h
@@ -152,7 +152,7 @@ extern int synch_process_termsig;
152extern int synch_process_retcode; 152extern int synch_process_retcode;
153 153
154/* The name of the file open to get a null file, or a data sink. 154/* The name of the file open to get a null file, or a data sink.
155 VMS, MS-DOS, and OS/2 redefine this. */ 155 MS-DOS, and OS/2 redefine this. */
156#ifndef NULL_DEVICE 156#ifndef NULL_DEVICE
157#define NULL_DEVICE "/dev/null" 157#define NULL_DEVICE "/dev/null"
158#endif 158#endif
diff --git a/src/s/msdos.h b/src/s/msdos.h
index 2d29a5548b7..7699f80d192 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -40,7 +40,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
40 40
41#define DOS_NT /* MSDOS or WINDOWSNT */ 41#define DOS_NT /* MSDOS or WINDOWSNT */
42#undef BSD_SYSTEM 42#undef BSD_SYSTEM
43#undef VMS
44 43
45/* SYSTEM_TYPE should indicate the kind of system you are using. 44/* SYSTEM_TYPE should indicate the kind of system you are using.
46 It sets the Lisp variable system-type. */ 45 It sets the Lisp variable system-type. */
diff --git a/src/s/template.h b/src/s/template.h
index ce5c8fdbe5c..f7a7d7f0af1 100644
--- a/src/s/template.h
+++ b/src/s/template.h
@@ -31,7 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31/* #define BSD4_2 */ 31/* #define BSD4_2 */
32/* #define BSD4_3 */ 32/* #define BSD4_3 */
33/* #define BSD_SYSTEM */ 33/* #define BSD_SYSTEM */
34/* #define VMS */
35 34
36/* SYSTEM_TYPE should indicate the kind of system you are using. 35/* SYSTEM_TYPE should indicate the kind of system you are using.
37 It sets the Lisp variable system-type. */ 36 It sets the Lisp variable system-type. */
@@ -93,13 +92,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
93 92
94#define HAVE_PTYS 93#define HAVE_PTYS
95 94
96/*
97 * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
98 * The 4.2 opendir, etc., library functions.
99 */
100
101#define NONSYSTEM_DIR_LIBRARY
102
103/* Define this symbol if your system has the functions bcopy, etc. */ 95/* Define this symbol if your system has the functions bcopy, etc. */
104 96
105#define BSTRING 97#define BSTRING
diff --git a/src/s/vms.h b/src/s/vms.h
deleted file mode 100644
index e95e5f217ae..00000000000
--- a/src/s/vms.h
+++ /dev/null
@@ -1,192 +0,0 @@
1/* system description header for VMS
2 Copyright (C) 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
3 2008 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20/*
21 * Define symbols to identify the version of Unix this is.
22 * Define all the symbols that apply correctly.
23 */
24
25#ifndef VMS /* Decus cpp doesn't define this but VAX C does */
26#define VMS
27#endif /* VMS */
28/* Note that this file is used indirectly via vms4-0.h, or some other
29 such file. These other files define a symbol VMS4_0, VMS4_2, etc. */
30
31/* SYSTEM_TYPE should indicate the kind of system you are using.
32 It sets the Lisp variable system-type. */
33
34#define SYSTEM_TYPE "vax-vms"
35
36/* Letter to use in finding device name of first pty,
37 if system supports pty's. 'a' means it is /dev/ptya0 */
38
39#define FIRST_PTY_LETTER 'a'
40
41/*
42 * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
43 * The 4.2 opendir, etc., library functions.
44 */
45
46#define NONSYSTEM_DIR_LIBRARY
47
48/* Define the maximum record length for print strings, if needed. */
49
50#define MAX_PRINT_CHARS 300
51
52
53/* Here, on a separate page, add any special hacks needed
54 to make Emacs work on this system. For example,
55 you might define certain system call names that don't
56 exist on your system, or that do different things on
57 your system and must be used only through an encapsulation
58 (Which you should place, by convention, in sysdep.c). */
59
60/* In olden days, VMS filenames did not support hyphen (i.e., the "-"
61 character). You can #undef this in vmsX-Y.h for newer versions. */
62
63#define NO_HYPHENS_IN_FILENAMES
64
65/* Do you have the sharable library bug? If you link with a sharable
66 library that contains psects with the NOSHR attribute and also refer to
67 those psects in your program, the linker give you a private version of
68 the psect which is not related to the version used by the sharable
69 library. The end result is that your references to variables in that
70 psect have absolutely nothing to do with library references to what is
71 supposed to be the same variable. If you intend to link with the standard
72 C library (NOT the sharable one) you don't need to define this. (This
73 is NOT fixed in V4.4...) */
74
75#define SHARABLE_LIB_BUG
76
77/* Partially due to the above mentioned bug and also so that we don't need
78 to require that people have a sharable C library, the default for Emacs
79 is to link with the non-shared library. If you want to link with the
80 shared library, define this and remake xmakefile and fileio.c. This allows
81 us to ship a guaranteed executable image. */
82
83#define LINK_CRTL_SHARE
84
85/* Define this if you want to read the file SYS$SYSTEM:SYSUAF.DAT for user
86 information. If you do use this, you must either make SYSUAF.DAT world
87 readable or install Emacs with SYSPRV. */
88
89/* #define READ_SYSUAF */
90
91/* Traditionally, filenames on VMS are always upper case. */
92
93#define FILE_SYSTEM_CASE Fupcase
94
95/* On VMS these have a different name */
96
97#define index strchr
98#define rindex strrchr
99#define unlink delete
100
101#ifndef __GNUC__
102extern double mth$dmod(double, double);
103#endif
104
105/* Some time routines are missing in the VAX C RTL, or needs some
106 extra bit of code */
107#define tzset sys_tzset
108#define localtime sys_localtime
109#define gmtime sys_gmtime
110
111/* On later versions of VMS these exist in the C run time library, but
112 we are using our own implementations. Hide their names to avoid
113 linker errors */
114#define rename sys_rename
115#define execvp sys_execvp
116#define system sys_system
117
118#ifndef GNU_MALLOC
119/* Hide these names so that we don't get linker errors */
120#define malloc sys_malloc
121#define free sys_free
122#define realloc sys_realloc
123#define calloc sys_calloc
124
125/* Don't use the standard brk and sbrk */
126#define sbrk sys_sbrk
127#define brk sys_brk
128#endif
129
130/* On VMS we want to avoid reading and writing very large amounts of
131 data at once, so we redefine read and write here. */
132
133#define read sys_read
134#define write sys_write
135
136/* sys_creat just calls the real creat with additional args of
137 "rfm=var", "rat=cr" to get "normal" VMS files... */
138#define creat sys_creat
139
140/* fwrite forces an RMS PUT on every call. This is abysmally slow, so
141 we emulate fwrite with fputc, which forces buffering and is much
142 faster! */
143#define fwrite sys_fwrite
144
145/* getuid only returns the member number, which is not unique on most VMS
146 systems. We emulate it with (getgid()<<16 | getuid()). */
147#define getuid sys_getuid
148
149/* If user asks for TERM, check first for EMACS_TERM. */
150#define getenv sys_getenv
151
152/* Standard C abort is less useful than it should be. */
153#define abort sys_abort
154
155/* Case conflicts with C library fread. */
156#define Fread F_read
157
158/* Case conflicts with C library srandom. */
159#define Srandom S_random
160
161/* Cause initialization of vmsfns.c to be run. */
162#define SYMS_SYSTEM syms_of_vmsfns ()
163
164/* VAXCRTL access doesn't deal with SYSPRV very well (among other oddities...)
165 Here, we use $CHKPRO to really determine access. */
166#define access sys_access
167
168#define PAGESIZE 512
169
170#define _longjmp longjmp
171#define _setjmp setjmp
172
173globalref char sdata[];
174#define DATA_START (((int) sdata + 511) & ~511)
175#define TEXT_START 512
176
177#define PURESIZE 330000
178
179/* Stdio FILE type has extra indirect on VMS, so must alter this macro. */
180
181#define PENDING_OUTPUT_COUNT(FILE) ((*(FILE))->_ptr - (*(FILE))->_base)
182
183#define NULL_DEVICE "NLA0:"
184
185/* Case conflict with Xlib XFree () */
186#define xfree emacs_xfree
187
188/* What separator do we use in paths? */
189#define SEPCHAR ','
190
191/* arch-tag: 76bc2b70-46d1-4334-8f12-955c0d0ca6d4
192 (do not change this comment) */
diff --git a/src/sysdep.c b/src/sysdep.c
index 908375d344d..8da7d6a4784 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -90,32 +90,7 @@ extern int errno;
90#endif 90#endif
91#endif 91#endif
92 92
93#ifdef VMS
94#include <rms.h>
95#include <ttdef.h>
96#include <tt2def.h>
97#include <iodef.h>
98#include <ssdef.h>
99#include <descrip.h>
100#include <fibdef.h>
101#include <atrdef.h>
102#include <ctype.h>
103#include <string.h>
104#ifdef __GNUC__
105#include <sys/file.h> 93#include <sys/file.h>
106#else
107#include <file.h>
108#endif
109#undef F_SETFL
110#ifndef RAB$C_BID
111#include <rab.h>
112#endif
113#define MAXIOSIZE (32 * PAGESIZE) /* Don't I/O more than 32 blocks at a time */
114#endif /* VMS */
115
116#ifndef VMS
117#include <sys/file.h>
118#endif /* not VMS */
119 94
120#ifdef HAVE_FCNTL_H 95#ifdef HAVE_FCNTL_H
121#include <fcntl.h> 96#include <fcntl.h>
@@ -159,10 +134,6 @@ int _cdecl _getpid (void);
159extern char *getwd (char *); 134extern char *getwd (char *);
160#endif 135#endif
161 136
162#ifdef NONSYSTEM_DIR_LIBRARY
163#include "ndir.h"
164#endif /* NONSYSTEM_DIR_LIBRARY */
165
166#include "syssignal.h" 137#include "syssignal.h"
167#include "systime.h" 138#include "systime.h"
168#ifdef HAVE_UTIME_H 139#ifdef HAVE_UTIME_H
@@ -297,12 +268,6 @@ discard_tty_input ()
297 if (noninteractive) 268 if (noninteractive)
298 return; 269 return;
299 270
300#ifdef VMS
301 end_kbd_input ();
302 SYS$QIOW (0, fileno (CURTTY()->input), IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0,
303 &buf.main, 0, 0, terminator_mask, 0, 0);
304 queue_kbd_input ();
305#else /* not VMS */
306#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ 271#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
307 while (dos_keyread () != -1) 272 while (dos_keyread () != -1)
308 ; 273 ;
@@ -319,7 +284,6 @@ discard_tty_input ()
319 } 284 }
320 } 285 }
321#endif /* not MSDOS */ 286#endif /* not MSDOS */
322#endif /* not VMS */
323#endif /* not WINDOWSNT */ 287#endif /* not WINDOWSNT */
324} 288}
325 289
@@ -357,20 +321,13 @@ init_baud_rate (int fd)
357#ifdef DOS_NT 321#ifdef DOS_NT
358 emacs_ospeed = 15; 322 emacs_ospeed = 15;
359#else /* not DOS_NT */ 323#else /* not DOS_NT */
360#ifdef VMS
361 struct sensemode sg;
362
363 SYS$QIOW (0, fd, IO$_SENSEMODE, &sg, 0, 0,
364 &sg.class, 12, 0, 0, 0, 0 );
365 emacs_ospeed = sg.xmit_baud;
366#else /* not VMS */
367#ifdef HAVE_TERMIOS 324#ifdef HAVE_TERMIOS
368 struct termios sg; 325 struct termios sg;
369 326
370 sg.c_cflag = B9600; 327 sg.c_cflag = B9600;
371 tcgetattr (fd, &sg); 328 tcgetattr (fd, &sg);
372 emacs_ospeed = cfgetospeed (&sg); 329 emacs_ospeed = cfgetospeed (&sg);
373#else /* neither VMS nor TERMIOS */ 330#else /* not TERMIOS */
374#ifdef HAVE_TERMIO 331#ifdef HAVE_TERMIO
375 struct termio sg; 332 struct termio sg;
376 333
@@ -381,7 +338,7 @@ init_baud_rate (int fd)
381 ioctl (fd, TCGETA, &sg); 338 ioctl (fd, TCGETA, &sg);
382#endif 339#endif
383 emacs_ospeed = sg.c_cflag & CBAUD; 340 emacs_ospeed = sg.c_cflag & CBAUD;
384#else /* neither VMS nor TERMIOS nor TERMIO */ 341#else /* neither TERMIOS nor TERMIO */
385 struct sgttyb sg; 342 struct sgttyb sg;
386 343
387 sg.sg_ospeed = B9600; 344 sg.sg_ospeed = B9600;
@@ -390,7 +347,6 @@ init_baud_rate (int fd)
390 emacs_ospeed = sg.sg_ospeed; 347 emacs_ospeed = sg.sg_ospeed;
391#endif /* not HAVE_TERMIO */ 348#endif /* not HAVE_TERMIO */
392#endif /* not HAVE_TERMIOS */ 349#endif /* not HAVE_TERMIOS */
393#endif /* not VMS */
394#endif /* not DOS_NT */ 350#endif /* not DOS_NT */
395 } 351 }
396 352
@@ -443,12 +399,6 @@ wait_for_termination (pid)
443 while (1) 399 while (1)
444 { 400 {
445#ifdef subprocesses 401#ifdef subprocesses
446#ifdef VMS
447 int status;
448
449 status = SYS$FORCEX (&pid, 0, 0);
450 break;
451#else /* not VMS */
452#if defined (BSD_SYSTEM) || defined (HPUX) 402#if defined (BSD_SYSTEM) || defined (HPUX)
453 /* Note that kill returns -1 even if the process is just a zombie now. 403 /* Note that kill returns -1 even if the process is just a zombie now.
454 But inevitably a SIGCHLD interrupt should be generated 404 But inevitably a SIGCHLD interrupt should be generated
@@ -503,7 +453,6 @@ wait_for_termination (pid)
503#endif /* not HAVE_SYSV_SIGPAUSE */ 453#endif /* not HAVE_SYSV_SIGPAUSE */
504#endif /* not POSIX_SIGNALS */ 454#endif /* not POSIX_SIGNALS */
505#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ 455#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
506#endif /* not VMS */
507#else /* not subprocesses */ 456#else /* not subprocesses */
508#if __DJGPP__ > 1 457#if __DJGPP__ > 1
509 break; 458 break;
@@ -545,7 +494,6 @@ flush_pending_output (channel)
545#endif 494#endif
546} 495}
547 496
548#ifndef VMS
549/* Set up the terminal at the other end of a pseudo-terminal that 497/* Set up the terminal at the other end of a pseudo-terminal that
550 we will be controlling an inferior through. 498 we will be controlling an inferior through.
551 It should not echo or do line-editing, since that is done 499 It should not echo or do line-editing, since that is done
@@ -643,7 +591,6 @@ child_setup_tty (out)
643 591
644#endif /* not DOS_NT */ 592#endif /* not DOS_NT */
645} 593}
646#endif /* not VMS */
647 594
648#endif /* subprocesses */ 595#endif /* subprocesses */
649 596
@@ -662,47 +609,6 @@ static void restore_signal_handlers P_ ((struct save_signal *));
662void 609void
663sys_suspend () 610sys_suspend ()
664{ 611{
665#ifdef VMS
666 /* "Foster" parentage allows emacs to return to a subprocess that attached
667 to the current emacs as a cheaper than starting a whole new process. This
668 is set up by KEPTEDITOR.COM. */
669 unsigned long parent_id, foster_parent_id;
670 char *fpid_string;
671
672 fpid_string = getenv ("EMACS_PARENT_PID");
673 if (fpid_string != NULL)
674 {
675 sscanf (fpid_string, "%x", &foster_parent_id);
676 if (foster_parent_id != 0)
677 parent_id = foster_parent_id;
678 else
679 parent_id = getppid ();
680 }
681 else
682 parent_id = getppid ();
683
684 xfree (fpid_string); /* On VMS, this was malloc'd */
685
686 if (parent_id && parent_id != 0xffffffff)
687 {
688 SIGTYPE (*oldsig)() = (int) signal (SIGINT, SIG_IGN);
689 int status = LIB$ATTACH (&parent_id) & 1;
690 signal (SIGINT, oldsig);
691 return status;
692 }
693 else
694 {
695 struct {
696 int l;
697 char *a;
698 } d_prompt;
699 d_prompt.l = sizeof ("Emacs: "); /* Our special prompt */
700 d_prompt.a = "Emacs: "; /* Just a reminder */
701 LIB$SPAWN (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &d_prompt, 0);
702 return 1;
703 }
704 return -1;
705#else
706#if defined (SIGTSTP) && !defined (MSDOS) 612#if defined (SIGTSTP) && !defined (MSDOS)
707 613
708 { 614 {
@@ -724,7 +630,6 @@ sys_suspend ()
724 630
725#endif /* no USG_JOBCTRL */ 631#endif /* no USG_JOBCTRL */
726#endif /* no SIGTSTP */ 632#endif /* no SIGTSTP */
727#endif /* not VMS */
728} 633}
729 634
730/* Fork a subshell. */ 635/* Fork a subshell. */
@@ -732,7 +637,6 @@ sys_suspend ()
732void 637void
733sys_subshell () 638sys_subshell ()
734{ 639{
735#ifndef VMS
736#ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */ 640#ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */
737 int st; 641 int st;
738 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */ 642 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */
@@ -858,7 +762,6 @@ sys_subshell ()
858#endif 762#endif
859 restore_signal_handlers (saved_handlers); 763 restore_signal_handlers (saved_handlers);
860 synch_process_alive = 0; 764 synch_process_alive = 0;
861#endif /* !VMS */
862} 765}
863 766
864static void 767static void
@@ -1076,14 +979,6 @@ emacs_get_tty (fd, settings)
1076 return -1; 979 return -1;
1077 980
1078#else 981#else
1079#ifdef VMS
1080 /* Vehemently Monstrous System? :-) */
1081 if (! (SYS$QIOW (0, fd, IO$_SENSEMODE, settings, 0, 0,
1082 &settings->main.class, 12, 0, 0, 0, 0)
1083 & 1))
1084 return -1;
1085
1086#else
1087#ifndef DOS_NT 982#ifndef DOS_NT
1088 /* I give up - I hope you have the BSD ioctls. */ 983 /* I give up - I hope you have the BSD ioctls. */
1089 if (ioctl (fd, TIOCGETP, &settings->main) < 0) 984 if (ioctl (fd, TIOCGETP, &settings->main) < 0)
@@ -1091,7 +986,6 @@ emacs_get_tty (fd, settings)
1091#endif /* not DOS_NT */ 986#endif /* not DOS_NT */
1092#endif 987#endif
1093#endif 988#endif
1094#endif
1095 989
1096 /* Suivant - Do we have to get struct ltchars data? */ 990 /* Suivant - Do we have to get struct ltchars data? */
1097#ifdef HAVE_LTCHARS 991#ifdef HAVE_LTCHARS
@@ -1168,14 +1062,6 @@ emacs_set_tty (fd, settings, flushp)
1168 return -1; 1062 return -1;
1169 1063
1170#else 1064#else
1171#ifdef VMS
1172 /* Vehemently Monstrous System? :-) */
1173 if (! (SYS$QIOW (0, fd, IO$_SETMODE, &input_iosb, 0, 0,
1174 &settings->main.class, 12, 0, 0, 0, 0)
1175 & 1))
1176 return -1;
1177
1178#else
1179#ifndef DOS_NT 1065#ifndef DOS_NT
1180 /* I give up - I hope you have the BSD ioctls. */ 1066 /* I give up - I hope you have the BSD ioctls. */
1181 if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0) 1067 if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0)
@@ -1184,7 +1070,6 @@ emacs_set_tty (fd, settings, flushp)
1184 1070
1185#endif 1071#endif
1186#endif 1072#endif
1187#endif
1188 1073
1189 /* Suivant - Do we have to get struct ltchars data? */ 1074 /* Suivant - Do we have to get struct ltchars data? */
1190#ifdef HAVE_LTCHARS 1075#ifdef HAVE_LTCHARS
@@ -1253,25 +1138,6 @@ init_sys_modes (tty_out)
1253 if (!tty_out->output) 1138 if (!tty_out->output)
1254 return; /* The tty is suspended. */ 1139 return; /* The tty is suspended. */
1255 1140
1256#ifdef VMS
1257 if (!input_ef)
1258 input_ef = get_kbd_event_flag ();
1259 /* LIB$GET_EF (&input_ef); */
1260 SYS$CLREF (input_ef);
1261 waiting_for_ast = 0;
1262 if (!timer_ef)
1263 timer_ef = get_timer_event_flag ();
1264 /* LIB$GET_EF (&timer_ef); */
1265 SYS$CLREF (timer_ef);
1266 if (input_ef / 32 != timer_ef / 32)
1267 croak ("Input and timer event flags in different clusters.");
1268 timer_eflist = ((unsigned) 1 << (input_ef % 32)) |
1269 ((unsigned) 1 << (timer_ef % 32));
1270#ifndef VMS4_4
1271 sys_access_reinit ();
1272#endif
1273#endif /* VMS */
1274
1275#ifdef BSD_PGRPS 1141#ifdef BSD_PGRPS
1276#if 0 1142#if 0
1277 /* read_socket_hook is not global anymore. I think doing this 1143 /* read_socket_hook is not global anymore. I think doing this
@@ -1431,16 +1297,6 @@ init_sys_modes (tty_out)
1431 tty.main.c_iflag &= ~BRKINT; 1297 tty.main.c_iflag &= ~BRKINT;
1432#endif 1298#endif
1433#else /* if not HAVE_TERMIO */ 1299#else /* if not HAVE_TERMIO */
1434#ifdef VMS
1435 tty.main.tt_char |= TT$M_NOECHO;
1436 if (meta_key)
1437 tty.main.tt_char |= TT$M_EIGHTBIT;
1438 if (tty_out->flow_control)
1439 tty.main.tt_char |= TT$M_TTSYNC;
1440 else
1441 tty.main.tt_char &= ~TT$M_TTSYNC;
1442 tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON;
1443#else /* not VMS (BSD, that is) */
1444#ifndef DOS_NT 1300#ifndef DOS_NT
1445 XSETINT (Vtty_erase_char, tty.main.sg_erase); 1301 XSETINT (Vtty_erase_char, tty.main.sg_erase);
1446 tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); 1302 tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
@@ -1448,7 +1304,6 @@ init_sys_modes (tty_out)
1448 tty.main.sg_flags |= ANYP; 1304 tty.main.sg_flags |= ANYP;
1449 tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; 1305 tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
1450#endif /* not DOS_NT */ 1306#endif /* not DOS_NT */
1451#endif /* not VMS (BSD, that is) */
1452#endif /* not HAVE_TERMIO */ 1307#endif /* not HAVE_TERMIO */
1453 1308
1454 /* If going to use CBREAK mode, we must request C-g to interrupt 1309 /* If going to use CBREAK mode, we must request C-g to interrupt
@@ -1500,14 +1355,6 @@ init_sys_modes (tty_out)
1500#endif 1355#endif
1501#endif 1356#endif
1502 1357
1503#ifdef VMS
1504/* Appears to do nothing when in PASTHRU mode.
1505 SYS$QIOW (0, fileno (tty_out->input), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0,
1506 interrupt_signal, oob_chars, 0, 0, 0, 0);
1507*/
1508 queue_kbd_input (0);
1509#endif /* VMS */
1510
1511#ifdef F_SETFL 1358#ifdef F_SETFL
1512#ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */ 1359#ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */
1513 if (interrupt_input) 1360 if (interrupt_input)
@@ -1529,9 +1376,6 @@ init_sys_modes (tty_out)
1529#endif /* F_GETOWN */ 1376#endif /* F_GETOWN */
1530#endif /* F_SETFL */ 1377#endif /* F_SETFL */
1531 1378
1532#ifdef VMS /* VMS sometimes has this symbol but lacks setvbuf. */
1533#undef _IOFBF
1534#endif
1535#ifdef _IOFBF 1379#ifdef _IOFBF
1536 /* This symbol is defined on recent USG systems. 1380 /* This symbol is defined on recent USG systems.
1537 Someone says without this call USG won't really buffer the file 1381 Someone says without this call USG won't really buffer the file
@@ -1625,22 +1469,6 @@ get_tty_size (int fd, int *widthp, int *heightp)
1625 } 1469 }
1626 1470
1627#else 1471#else
1628#ifdef VMS
1629
1630 /* Use a fresh channel since the current one may have stale info
1631 (for example, from prior to a suspend); and to avoid a dependency
1632 in the init sequence. */
1633 int chan;
1634 struct sensemode tty;
1635
1636 SYS$ASSIGN (&input_dsc, &chan, 0, 0);
1637 SYS$QIOW (0, chan, IO$_SENSEMODE, &tty, 0, 0,
1638 &tty.class, 12, 0, 0, 0, 0);
1639 SYS$DASSGN (chan);
1640 *widthp = tty.scr_wid;
1641 *heightp = tty.scr_len;
1642
1643#else
1644#ifdef MSDOS 1472#ifdef MSDOS
1645 *widthp = ScreenCols (); 1473 *widthp = ScreenCols ();
1646 *heightp = ScreenRows (); 1474 *heightp = ScreenRows ();
@@ -1648,7 +1476,6 @@ get_tty_size (int fd, int *widthp, int *heightp)
1648 *widthp = 0; 1476 *widthp = 0;
1649 *heightp = 0; 1477 *heightp = 0;
1650#endif 1478#endif
1651#endif /* not VMS */
1652#endif /* not SunOS-style */ 1479#endif /* not SunOS-style */
1653#endif /* not BSD-style */ 1480#endif /* not BSD-style */
1654} 1481}
@@ -1822,270 +1649,7 @@ setup_pty (fd)
1822} 1649}
1823#endif /* HAVE_PTYS */ 1650#endif /* HAVE_PTYS */
1824 1651
1825#ifdef VMS 1652#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC)
1826
1827/* Assigning an input channel is done at the start of Emacs execution.
1828 This is called each time Emacs is resumed, also, but does nothing
1829 because input_chain is no longer zero. */
1830
1831void
1832init_vms_input ()
1833{
1834 int status;
1835
1836 if (fileno (CURTTY ()->input)) == 0)
1837 {
1838 status = SYS$ASSIGN (&input_dsc, &fileno (CURTTY ()->input)), 0, 0);
1839 if (! (status & 1))
1840 LIB$STOP (status);
1841 }
1842}
1843
1844/* Deassigning the input channel is done before exiting. */
1845
1846void
1847stop_vms_input ()
1848{
1849 return SYS$DASSGN (fileno (CURTTY ()->input)));
1850}
1851
1852short input_buffer;
1853
1854/* Request reading one character into the keyboard buffer.
1855 This is done as soon as the buffer becomes empty. */
1856
1857void
1858queue_kbd_input ()
1859{
1860 int status;
1861 extern kbd_input_ast ();
1862
1863 waiting_for_ast = 0;
1864 stop_input = 0;
1865 status = SYS$QIO (0, fileno (CURTTY()->input), IO$_READVBLK,
1866 &input_iosb, kbd_input_ast, 1,
1867 &input_buffer, 1, 0, terminator_mask, 0, 0);
1868}
1869
1870int input_count;
1871
1872/* Ast routine that is called when keyboard input comes in
1873 in accord with the SYS$QIO above. */
1874
1875void
1876kbd_input_ast ()
1877{
1878 register int c = -1;
1879 int old_errno = errno;
1880 extern EMACS_TIME *input_available_clear_time;
1881
1882 if (waiting_for_ast)
1883 SYS$SETEF (input_ef);
1884 waiting_for_ast = 0;
1885 input_count++;
1886#ifdef ASTDEBUG
1887 if (input_count == 25)
1888 exit (1);
1889 printf ("Ast # %d,", input_count);
1890 printf (" iosb = %x, %x, %x, %x",
1891 input_iosb.offset, input_iosb.status, input_iosb.termlen,
1892 input_iosb.term);
1893#endif
1894 if (input_iosb.offset)
1895 {
1896 c = input_buffer;
1897#ifdef ASTDEBUG
1898 printf (", char = 0%o", c);
1899#endif
1900 }
1901#ifdef ASTDEBUG
1902 printf ("\n");
1903 fflush (stdout);
1904 sleep (1);
1905#endif
1906 if (! stop_input)
1907 queue_kbd_input ();
1908 if (c >= 0)
1909 {
1910 struct input_event e;
1911 EVENT_INIT (e);
1912
1913 e.kind = ASCII_KEYSTROKE_EVENT;
1914 XSETINT (e.code, c);
1915 e.frame_or_window = selected_frame;
1916 kbd_buffer_store_event (&e);
1917 }
1918 if (input_available_clear_time)
1919 EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
1920 errno = old_errno;
1921}
1922
1923/* Wait until there is something in kbd_buffer. */
1924
1925void
1926wait_for_kbd_input ()
1927{
1928 extern int have_process_input, process_exited;
1929
1930 /* If already something, avoid doing system calls. */
1931 if (detect_input_pending ())
1932 {
1933 return;
1934 }
1935 /* Clear a flag, and tell ast routine above to set it. */
1936 SYS$CLREF (input_ef);
1937 waiting_for_ast = 1;
1938 /* Check for timing error: ast happened while we were doing that. */
1939 if (!detect_input_pending ())
1940 {
1941 /* No timing error: wait for flag to be set. */
1942 set_waiting_for_input (0);
1943 SYS$WFLOR (input_ef, input_eflist);
1944 clear_waiting_for_input ();
1945 if (!detect_input_pending ())
1946 /* Check for subprocess input availability */
1947 {
1948 int dsp = have_process_input || process_exited;
1949
1950 SYS$CLREF (process_ef);
1951 if (have_process_input)
1952 process_command_input ();
1953 if (process_exited)
1954 process_exit ();
1955 if (dsp)
1956 {
1957 update_mode_lines++;
1958 prepare_menu_bars ();
1959 redisplay_preserve_echo_area (18);
1960 }
1961 }
1962 }
1963 waiting_for_ast = 0;
1964}
1965
1966/* Get rid of any pending QIO, when we are about to suspend
1967 or when we want to throw away pending input.
1968 We wait for a positive sign that the AST routine has run
1969 and therefore there is no I/O request queued when we return.
1970 SYS$SETAST is used to avoid a timing error. */
1971
1972void
1973end_kbd_input ()
1974{
1975#ifdef ASTDEBUG
1976 printf ("At end_kbd_input.\n");
1977 fflush (stdout);
1978 sleep (1);
1979#endif
1980 if (LIB$AST_IN_PROG ()) /* Don't wait if suspending from kbd_buffer_store_event! */
1981 {
1982 SYS$CANCEL (fileno (CURTTY()->input));
1983 return;
1984 }
1985
1986 SYS$SETAST (0);
1987 /* Clear a flag, and tell ast routine above to set it. */
1988 SYS$CLREF (input_ef);
1989 waiting_for_ast = 1;
1990 stop_input = 1;
1991 SYS$CANCEL (fileno (CURTTY()->input));
1992 SYS$SETAST (1);
1993 SYS$WAITFR (input_ef);
1994 waiting_for_ast = 0;
1995}
1996
1997/* Wait for either input available or time interval expiry. */
1998
1999void
2000input_wait_timeout (timeval)
2001 int timeval; /* Time to wait, in seconds */
2002{
2003 int time [2];
2004 static int zero = 0;
2005 static int large = -10000000;
2006
2007 LIB$EMUL (&timeval, &large, &zero, time); /* Convert to VMS format */
2008
2009 /* If already something, avoid doing system calls. */
2010 if (detect_input_pending ())
2011 {
2012 return;
2013 }
2014 /* Clear a flag, and tell ast routine above to set it. */
2015 SYS$CLREF (input_ef);
2016 waiting_for_ast = 1;
2017 /* Check for timing error: ast happened while we were doing that. */
2018 if (!detect_input_pending ())
2019 {
2020 /* No timing error: wait for flag to be set. */
2021 SYS$CANTIM (1, 0);
2022 if (SYS$SETIMR (timer_ef, time, 0, 1) & 1) /* Set timer */
2023 SYS$WFLOR (timer_ef, timer_eflist); /* Wait for timer expiry or input */
2024 }
2025 waiting_for_ast = 0;
2026}
2027
2028/* The standard `sleep' routine works some other way
2029 and it stops working if you have ever quit out of it.
2030 This one continues to work. */
2031
2032sys_sleep (timeval)
2033 int timeval;
2034{
2035 int time [2];
2036 static int zero = 0;
2037 static int large = -10000000;
2038
2039 LIB$EMUL (&timeval, &large, &zero, time); /* Convert to VMS format */
2040
2041 SYS$CANTIM (1, 0);
2042 if (SYS$SETIMR (timer_ef, time, 0, 1) & 1) /* Set timer */
2043 SYS$WAITFR (timer_ef); /* Wait for timer expiry only */
2044}
2045
2046void
2047init_sigio (fd)
2048 int fd;
2049{
2050 request_sigio ();
2051}
2052
2053reset_sigio (fd)
2054 int fd;
2055{
2056 unrequest_sigio ();
2057}
2058
2059void
2060request_sigio ()
2061{
2062 if (noninteractive)
2063 return;
2064 croak ("request sigio");
2065}
2066
2067void
2068unrequest_sigio ()
2069{
2070 if (noninteractive)
2071 return;
2072 croak ("unrequest sigio");
2073}
2074
2075#endif /* VMS */
2076
2077/* Note that VMS compiler won't accept defined (CANNOT_DUMP). */
2078#ifndef CANNOT_DUMP
2079#define NEED_STARTS
2080#endif
2081
2082#ifndef SYSTEM_MALLOC
2083#ifndef NEED_STARTS
2084#define NEED_STARTS
2085#endif
2086#endif
2087
2088#ifdef NEED_STARTS
2089/* Some systems that cannot dump also cannot implement these. */ 1653/* Some systems that cannot dump also cannot implement these. */
2090 1654
2091/* 1655/*
@@ -2167,12 +1731,10 @@ start_of_data ()
2167 1731
2168extern Lisp_Object Vsystem_name; 1732extern Lisp_Object Vsystem_name;
2169 1733
2170#ifndef VMS
2171#ifdef HAVE_SOCKETS 1734#ifdef HAVE_SOCKETS
2172#include <sys/socket.h> 1735#include <sys/socket.h>
2173#include <netdb.h> 1736#include <netdb.h>
2174#endif /* HAVE_SOCKETS */ 1737#endif /* HAVE_SOCKETS */
2175#endif /* not VMS */
2176 1738
2177#ifdef TRY_AGAIN 1739#ifdef TRY_AGAIN
2178#ifndef HAVE_H_ERRNO 1740#ifndef HAVE_H_ERRNO
@@ -2183,15 +1745,6 @@ extern int h_errno;
2183void 1745void
2184init_system_name () 1746init_system_name ()
2185{ 1747{
2186#ifdef VMS
2187 char *sp, *end;
2188 if ((sp = egetenv ("SYS$NODE")) == 0)
2189 Vsystem_name = build_string ("vax-vms");
2190 else if ((end = index (sp, ':')) == 0)
2191 Vsystem_name = build_string (sp);
2192 else
2193 Vsystem_name = make_string (sp, end - sp);
2194#else
2195#ifndef HAVE_GETHOSTNAME 1748#ifndef HAVE_GETHOSTNAME
2196 struct utsname uts; 1749 struct utsname uts;
2197 uname (&uts); 1750 uname (&uts);
@@ -2307,7 +1860,6 @@ init_system_name ()
2307#endif /* HAVE_SOCKETS */ 1860#endif /* HAVE_SOCKETS */
2308 Vsystem_name = build_string (hostname); 1861 Vsystem_name = build_string (hostname);
2309#endif /* HAVE_GETHOSTNAME */ 1862#endif /* HAVE_GETHOSTNAME */
2310#endif /* VMS */
2311 { 1863 {
2312 unsigned char *p; 1864 unsigned char *p;
2313 for (p = SDATA (Vsystem_name); *p; p++) 1865 for (p = SDATA (Vsystem_name); *p; p++)
@@ -2317,7 +1869,6 @@ init_system_name ()
2317} 1869}
2318 1870
2319#ifndef MSDOS 1871#ifndef MSDOS
2320#ifndef VMS
2321#if !defined (HAVE_SELECT) 1872#if !defined (HAVE_SELECT)
2322 1873
2323#include "sysselect.h" 1874#include "sysselect.h"
@@ -2557,7 +2108,6 @@ read_input_waiting ()
2557#endif 2108#endif
2558 2109
2559#endif /* not HAVE_SELECT */ 2110#endif /* not HAVE_SELECT */
2560#endif /* not VMS */
2561#endif /* not MSDOS */ 2111#endif /* not MSDOS */
2562 2112
2563/* POSIX signals support - DJB */ 2113/* POSIX signals support - DJB */
@@ -2888,112 +2438,6 @@ get_random ()
2888#endif /* need at least 2 */ 2438#endif /* need at least 2 */
2889 return val & ((1L << VALBITS) - 1); 2439 return val & ((1L << VALBITS) - 1);
2890} 2440}
2891
2892#ifdef VMS
2893
2894#ifdef getenv
2895/* If any place else asks for the TERM variable,
2896 allow it to be overridden with the EMACS_TERM variable
2897 before attempting to translate the logical name TERM. As a last
2898 resort, ask for VAX C's special idea of the TERM variable. */
2899#undef getenv
2900char *
2901sys_getenv (name)
2902 char *name;
2903{
2904 register char *val;
2905 static char buf[256];
2906 static struct dsc$descriptor_s equiv
2907 = {sizeof (buf), DSC$K_DTYPE_T, DSC$K_CLASS_S, buf};
2908 static struct dsc$descriptor_s d_name
2909 = {0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
2910 short eqlen;
2911
2912 if (!strcmp (name, "TERM"))
2913 {
2914 val = (char *) getenv ("EMACS_TERM");
2915 if (val)
2916 return val;
2917 }
2918
2919 d_name.dsc$w_length = strlen (name);
2920 d_name.dsc$a_pointer = name;
2921 if (LIB$SYS_TRNLOG (&d_name, &eqlen, &equiv) == 1)
2922 {
2923 char *str = (char *) xmalloc (eqlen + 1);
2924 bcopy (buf, str, eqlen);
2925 str[eqlen] = '\0';
2926 /* This is a storage leak, but a pain to fix. With luck,
2927 no one will ever notice. */
2928 return str;
2929 }
2930 return (char *) getenv (name);
2931}
2932#endif /* getenv */
2933
2934#ifdef abort
2935/* Since VMS doesn't believe in core dumps, the only way to debug this beast is
2936 to force a call on the debugger from within the image. */
2937#undef abort
2938sys_abort ()
2939{
2940 reset_all_sys_modes ();
2941 LIB$SIGNAL (SS$_DEBUG);
2942}
2943#endif /* abort */
2944#endif /* VMS */
2945
2946#ifdef VMS
2947#ifdef LINK_CRTL_SHARE
2948#ifdef SHARABLE_LIB_BUG
2949/* Variables declared noshare and initialized in sharable libraries
2950 cannot be shared. The VMS linker incorrectly forces you to use a private
2951 version which is uninitialized... If not for this "feature", we
2952 could use the C library definition of sys_nerr and sys_errlist. */
2953int sys_nerr = 35;
2954char *sys_errlist[] =
2955 {
2956 "error 0",
2957 "not owner",
2958 "no such file or directory",
2959 "no such process",
2960 "interrupted system call",
2961 "i/o error",
2962 "no such device or address",
2963 "argument list too long",
2964 "exec format error",
2965 "bad file number",
2966 "no child process",
2967 "no more processes",
2968 "not enough memory",
2969 "permission denied",
2970 "bad address",
2971 "block device required",
2972 "mount devices busy",
2973 "file exists",
2974 "cross-device link",
2975 "no such device",
2976 "not a directory",
2977 "is a directory",
2978 "invalid argument",
2979 "file table overflow",
2980 "too many open files",
2981 "not a typewriter",
2982 "text file busy",
2983 "file too big",
2984 "no space left on device",
2985 "illegal seek",
2986 "read-only file system",
2987 "too many links",
2988 "broken pipe",
2989 "math argument",
2990 "result too large",
2991 "I/O stream empty",
2992 "vax/vms specific error code nontranslatable error"
2993 };
2994#endif /* SHARABLE_LIB_BUG */
2995#endif /* LINK_CRTL_SHARE */
2996#endif /* VMS */
2997 2441
2998#ifndef HAVE_STRERROR 2442#ifndef HAVE_STRERROR
2999#ifndef WINDOWSNT 2443#ifndef WINDOWSNT
@@ -3225,7 +2669,6 @@ dup2 (oldd, newd)
3225 */ 2669 */
3226 2670
3227#ifdef subprocesses 2671#ifdef subprocesses
3228#ifndef VMS
3229#ifndef HAVE_GETTIMEOFDAY 2672#ifndef HAVE_GETTIMEOFDAY
3230#ifdef HAVE_TIMEVAL 2673#ifdef HAVE_TIMEVAL
3231 2674
@@ -3246,8 +2689,7 @@ gettimeofday (tp, tzp)
3246 2689
3247#endif 2690#endif
3248#endif 2691#endif
3249#endif 2692#endif /* subprocess && !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL */
3250#endif /* subprocess && !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL && !VMS */
3251 2693
3252/* 2694/*
3253 * This function will go away as soon as all the stubs fixed. (fnf) 2695 * This function will go away as soon as all the stubs fixed. (fnf)
@@ -3292,150 +2734,6 @@ closedir (DIR *dirp /* stream from opendir */)
3292#endif /* not HAVE_CLOSEDIR */ 2734#endif /* not HAVE_CLOSEDIR */
3293#endif /* SYSV_SYSTEM_DIR */ 2735#endif /* SYSV_SYSTEM_DIR */
3294 2736
3295#ifdef NONSYSTEM_DIR_LIBRARY
3296
3297DIR *
3298opendir (filename)
3299 char *filename; /* name of directory */
3300{
3301 register DIR *dirp; /* -> malloc'ed storage */
3302 register int fd; /* file descriptor for read */
3303 struct stat sbuf; /* result of fstat */
3304
3305 fd = emacs_open (filename, O_RDONLY, 0);
3306 if (fd < 0)
3307 return 0;
3308
3309 BLOCK_INPUT;
3310 if (fstat (fd, &sbuf) < 0
3311 || (sbuf.st_mode & S_IFMT) != S_IFDIR
3312 || (dirp = (DIR *) xmalloc (sizeof (DIR))) == 0)
3313 {
3314 emacs_close (fd);
3315 UNBLOCK_INPUT;
3316 return 0; /* bad luck today */
3317 }
3318 UNBLOCK_INPUT;
3319
3320 dirp->dd_fd = fd;
3321 dirp->dd_loc = dirp->dd_size = 0; /* refill needed */
3322
3323 return dirp;
3324}
3325
3326void
3327closedir (dirp)
3328 register DIR *dirp; /* stream from opendir */
3329{
3330 emacs_close (dirp->dd_fd);
3331 xfree ((char *) dirp);
3332}
3333
3334
3335#ifndef VMS
3336#define DIRSIZ 14
3337struct olddir
3338 {
3339 ino_t od_ino; /* inode */
3340 char od_name[DIRSIZ]; /* filename */
3341 };
3342#endif /* not VMS */
3343
3344struct direct dir_static; /* simulated directory contents */
3345
3346/* ARGUSED */
3347struct direct *
3348readdir (dirp)
3349 register DIR *dirp; /* stream from opendir */
3350{
3351#ifndef VMS
3352 register struct olddir *dp; /* -> directory data */
3353#else /* VMS */
3354 register struct dir$_name *dp; /* -> directory data */
3355 register struct dir$_version *dv; /* -> version data */
3356#endif /* VMS */
3357
3358 for (; ;)
3359 {
3360 if (dirp->dd_loc >= dirp->dd_size)
3361 dirp->dd_loc = dirp->dd_size = 0;
3362
3363 if (dirp->dd_size == 0 /* refill buffer */
3364 && (dirp->dd_size = emacs_read (dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ)) <= 0)
3365 return 0;
3366
3367#ifndef VMS
3368 dp = (struct olddir *) &dirp->dd_buf[dirp->dd_loc];
3369 dirp->dd_loc += sizeof (struct olddir);
3370
3371 if (dp->od_ino != 0) /* not deleted entry */
3372 {
3373 dir_static.d_ino = dp->od_ino;
3374 strncpy (dir_static.d_name, dp->od_name, DIRSIZ);
3375 dir_static.d_name[DIRSIZ] = '\0';
3376 dir_static.d_namlen = strlen (dir_static.d_name);
3377 dir_static.d_reclen = sizeof (struct direct)
3378 - MAXNAMLEN + 3
3379 + dir_static.d_namlen - dir_static.d_namlen % 4;
3380 return &dir_static; /* -> simulated structure */
3381 }
3382#else /* VMS */
3383 dp = (struct dir$_name *) dirp->dd_buf;
3384 if (dirp->dd_loc == 0)
3385 dirp->dd_loc = (dp->dir$b_namecount&1) ? dp->dir$b_namecount + 1
3386 : dp->dir$b_namecount;
3387 dv = (struct dir$_version *)&dp->dir$t_name[dirp->dd_loc];
3388 dir_static.d_ino = dv->dir$w_fid_num;
3389 dir_static.d_namlen = dp->dir$b_namecount;
3390 dir_static.d_reclen = sizeof (struct direct)
3391 - MAXNAMLEN + 3
3392 + dir_static.d_namlen - dir_static.d_namlen % 4;
3393 strncpy (dir_static.d_name, dp->dir$t_name, dp->dir$b_namecount);
3394 dir_static.d_name[dir_static.d_namlen] = '\0';
3395 dirp->dd_loc = dirp->dd_size; /* only one record at a time */
3396 return &dir_static;
3397#endif /* VMS */
3398 }
3399}
3400
3401#ifdef VMS
3402/* readdirver is just like readdir except it returns all versions of a file
3403 as separate entries. */
3404
3405/* ARGUSED */
3406struct direct *
3407readdirver (dirp)
3408 register DIR *dirp; /* stream from opendir */
3409{
3410 register struct dir$_name *dp; /* -> directory data */
3411 register struct dir$_version *dv; /* -> version data */
3412
3413 if (dirp->dd_loc >= dirp->dd_size - sizeof (struct dir$_name))
3414 dirp->dd_loc = dirp->dd_size = 0;
3415
3416 if (dirp->dd_size == 0 /* refill buffer */
3417 && (dirp->dd_size = sys_read (dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ)) <= 0)
3418 return 0;
3419
3420 dp = (struct dir$_name *) dirp->dd_buf;
3421 if (dirp->dd_loc == 0)
3422 dirp->dd_loc = (dp->dir$b_namecount & 1) ? dp->dir$b_namecount + 1
3423 : dp->dir$b_namecount;
3424 dv = (struct dir$_version *) &dp->dir$t_name[dirp->dd_loc];
3425 strncpy (dir_static.d_name, dp->dir$t_name, dp->dir$b_namecount);
3426 sprintf (&dir_static.d_name[dp->dir$b_namecount], ";%d", dv->dir$w_version);
3427 dir_static.d_namlen = strlen (dir_static.d_name);
3428 dir_static.d_ino = dv->dir$w_fid_num;
3429 dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3
3430 + dir_static.d_namlen - dir_static.d_namlen % 4;
3431 dirp->dd_loc = ((char *) (++dv) - dp->dir$t_name);
3432 return &dir_static;
3433}
3434
3435#endif /* VMS */
3436
3437#endif /* NONSYSTEM_DIR_LIBRARY */
3438
3439 2737
3440int 2738int
3441set_file_times (filename, atime, mtime) 2739set_file_times (filename, atime, mtime)
@@ -3586,1259 +2884,6 @@ rmdir (dpath)
3586} 2884}
3587#endif /* !HAVE_RMDIR */ 2885#endif /* !HAVE_RMDIR */
3588 2886
3589
3590
3591/* Functions for VMS */
3592#ifdef VMS
3593#include <acldef.h>
3594#include <chpdef.h>
3595#include <jpidef.h>
3596
3597/* Return as a string the VMS error string pertaining to STATUS.
3598 Reuses the same static buffer each time it is called. */
3599
3600char *
3601vmserrstr (status)
3602 int status; /* VMS status code */
3603{
3604 int bufadr[2];
3605 short len;
3606 static char buf[257];
3607
3608 bufadr[0] = sizeof buf - 1;
3609 bufadr[1] = (int) buf;
3610 if (! (SYS$GETMSG (status, &len, bufadr, 0x1, 0) & 1))
3611 return "untranslatable VMS error status";
3612 buf[len] = '\0';
3613 return buf;
3614}
3615
3616#ifdef access
3617#undef access
3618
3619/* The following is necessary because 'access' emulation by VMS C (2.0) does
3620 * not work correctly. (It also doesn't work well in version 2.3.)
3621 */
3622
3623#ifdef VMS4_4
3624
3625#define DESCRIPTOR(name,string) struct dsc$descriptor_s name = \
3626 { strlen (string), DSC$K_DTYPE_T, DSC$K_CLASS_S, string }
3627
3628typedef union {
3629 struct {
3630 unsigned short s_buflen;
3631 unsigned short s_code;
3632 char *s_bufadr;
3633 unsigned short *s_retlenadr;
3634 } s;
3635 int end;
3636} item;
3637#define buflen s.s_buflen
3638#define code s.s_code
3639#define bufadr s.s_bufadr
3640#define retlenadr s.s_retlenadr
3641
3642#define R_OK 4 /* test for read permission */
3643#define W_OK 2 /* test for write permission */
3644#define X_OK 1 /* test for execute (search) permission */
3645#define F_OK 0 /* test for presence of file */
3646
3647int
3648sys_access (path, mode)
3649 char *path;
3650 int mode;
3651{
3652 static char *user = NULL;
3653 char dir_fn[512];
3654
3655 /* translate possible directory spec into .DIR file name, so brain-dead
3656 * access can treat the directory like a file. */
3657 if (directory_file_name (path, dir_fn))
3658 path = dir_fn;
3659
3660 if (mode == F_OK)
3661 return access (path, mode);
3662 if (user == NULL && (user = (char *) getenv ("USER")) == NULL)
3663 return -1;
3664 {
3665 int stat;
3666 int flags;
3667 int acces;
3668 unsigned short int dummy;
3669 item itemlst[3];
3670 static int constant = ACL$C_FILE;
3671 DESCRIPTOR (path_desc, path);
3672 DESCRIPTOR (user_desc, user);
3673
3674 flags = 0;
3675 acces = 0;
3676 if ((mode & X_OK) && ((stat = access (path, mode)) < 0 || mode == X_OK))
3677 return stat;
3678 if (mode & R_OK)
3679 acces |= CHP$M_READ;
3680 if (mode & W_OK)
3681 acces |= CHP$M_WRITE;
3682 itemlst[0].buflen = sizeof (int);
3683 itemlst[0].code = CHP$_FLAGS;
3684 itemlst[0].bufadr = (char *) &flags;
3685 itemlst[0].retlenadr = &dummy;
3686 itemlst[1].buflen = sizeof (int);
3687 itemlst[1].code = CHP$_ACCESS;
3688 itemlst[1].bufadr = (char *) &acces;
3689 itemlst[1].retlenadr = &dummy;
3690 itemlst[2].end = CHP$_END;
3691 stat = SYS$CHECK_ACCESS (&constant, &path_desc, &user_desc, itemlst);
3692 return stat == SS$_NORMAL ? 0 : -1;
3693 }
3694}
3695
3696#else /* not VMS4_4 */
3697
3698#include <prvdef.h>
3699#define ACE$M_WRITE 2
3700#define ACE$C_KEYID 1
3701
3702static unsigned short memid, grpid;
3703static unsigned int uic;
3704
3705/* Called from init_sys_modes, so it happens not very often
3706 but at least each time Emacs is loaded. */
3707void
3708sys_access_reinit ()
3709{
3710 uic = 0;
3711}
3712
3713int
3714sys_access (filename, type)
3715 char * filename;
3716 int type;
3717{
3718 struct FAB fab;
3719 struct XABPRO xab;
3720 int status, size, i, typecode, acl_controlled;
3721 unsigned int *aclptr, *aclend, aclbuf[60];
3722 union prvdef prvmask;
3723
3724 /* Get UIC and GRP values for protection checking. */
3725 if (uic == 0)
3726 {
3727 status = LIB$GETJPI (&JPI$_UIC, 0, 0, &uic, 0, 0);
3728 if (! (status & 1))
3729 return -1;
3730 memid = uic & 0xFFFF;
3731 grpid = uic >> 16;
3732 }
3733
3734 if (type != 2) /* not checking write access */
3735 return access (filename, type);
3736
3737 /* Check write protection. */
3738
3739#define CHECKPRIV(bit) (prvmask.bit)
3740#define WRITABLE(field) (! ((xab.xab$w_pro >> field) & XAB$M_NOWRITE))
3741
3742 /* Find privilege bits */
3743 status = SYS$SETPRV (0, 0, 0, prvmask);
3744 if (! (status & 1))
3745 error ("Unable to find privileges: %s", vmserrstr (status));
3746 if (CHECKPRIV (PRV$V_BYPASS))
3747 return 0; /* BYPASS enabled */
3748 fab = cc$rms_fab;
3749 fab.fab$b_fac = FAB$M_GET;
3750 fab.fab$l_fna = filename;
3751 fab.fab$b_fns = strlen (filename);
3752 fab.fab$l_xab = &xab;
3753 xab = cc$rms_xabpro;
3754 xab.xab$l_aclbuf = aclbuf;
3755 xab.xab$w_aclsiz = sizeof (aclbuf);
3756 status = SYS$OPEN (&fab, 0, 0);
3757 if (! (status & 1))
3758 return -1;
3759 SYS$CLOSE (&fab, 0, 0);
3760 /* Check system access */
3761 if (CHECKPRIV (PRV$V_SYSPRV) && WRITABLE (XAB$V_SYS))
3762 return 0;
3763 /* Check ACL entries, if any */
3764 acl_controlled = 0;
3765 if (xab.xab$w_acllen > 0)
3766 {
3767 aclptr = aclbuf;
3768 aclend = &aclbuf[xab.xab$w_acllen / 4];
3769 while (*aclptr && aclptr < aclend)
3770 {
3771 size = (*aclptr & 0xff) / 4;
3772 typecode = (*aclptr >> 8) & 0xff;
3773 if (typecode == ACE$C_KEYID)
3774 for (i = size - 1; i > 1; i--)
3775 if (aclptr[i] == uic)
3776 {
3777 acl_controlled = 1;
3778 if (aclptr[1] & ACE$M_WRITE)
3779 return 0; /* Write access through ACL */
3780 }
3781 aclptr = &aclptr[size];
3782 }
3783 if (acl_controlled) /* ACL specified, prohibits write access */
3784 return -1;
3785 }
3786 /* No ACL entries specified, check normal protection */
3787 if (WRITABLE (XAB$V_WLD)) /* World writable */
3788 return 0;
3789 if (WRITABLE (XAB$V_GRP) &&
3790 (unsigned short) (xab.xab$l_uic >> 16) == grpid)
3791 return 0; /* Group writable */
3792 if (WRITABLE (XAB$V_OWN) &&
3793 (xab.xab$l_uic & 0xFFFF) == memid)
3794 return 0; /* Owner writable */
3795
3796 return -1; /* Not writable */
3797}
3798#endif /* not VMS4_4 */
3799#endif /* access */
3800
3801static char vtbuf[NAM$C_MAXRSS+1];
3802
3803/* translate a vms file spec to a unix path */
3804char *
3805sys_translate_vms (vfile)
3806 char * vfile;
3807{
3808 char * p;
3809 char * targ;
3810
3811 if (!vfile)
3812 return 0;
3813
3814 targ = vtbuf;
3815
3816 /* leading device or logical name is a root directory */
3817 if (p = strchr (vfile, ':'))
3818 {
3819 *targ++ = '/';
3820 while (vfile < p)
3821 *targ++ = *vfile++;
3822 vfile++;
3823 *targ++ = '/';
3824 }
3825 p = vfile;
3826 if (*p == '[' || *p == '<')
3827 {
3828 while (*++vfile != *p + 2)
3829 switch (*vfile)
3830 {
3831 case '.':
3832 if (vfile[-1] == *p)
3833 *targ++ = '.';
3834 *targ++ = '/';
3835 break;
3836
3837 case '-':
3838 *targ++ = '.';
3839 *targ++ = '.';
3840 break;
3841
3842 default:
3843 *targ++ = *vfile;
3844 break;
3845 }
3846 vfile++;
3847 *targ++ = '/';
3848 }
3849 while (*vfile)
3850 *targ++ = *vfile++;
3851
3852 return vtbuf;
3853}
3854
3855static char utbuf[NAM$C_MAXRSS+1];
3856
3857/* translate a unix path to a VMS file spec */
3858char *
3859sys_translate_unix (ufile)
3860 char * ufile;
3861{
3862 int slash_seen = 0;
3863 char *p;
3864 char * targ;
3865
3866 if (!ufile)
3867 return 0;
3868
3869 targ = utbuf;
3870
3871 if (*ufile == '/')
3872 {
3873 ufile++;
3874 }
3875
3876 while (*ufile)
3877 {
3878 switch (*ufile)
3879 {
3880 case '/':
3881 if (slash_seen)
3882 if (index (&ufile[1], '/'))
3883 *targ++ = '.';
3884 else
3885 *targ++ = ']';
3886 else
3887 {
3888 *targ++ = ':';
3889 if (index (&ufile[1], '/'))
3890 *targ++ = '[';
3891 slash_seen = 1;
3892 }
3893 break;
3894
3895 case '.':
3896 if (strncmp (ufile, "./", 2) == 0)
3897 {
3898 if (!slash_seen)
3899 {
3900 *targ++ = '[';
3901 slash_seen = 1;
3902 }
3903 ufile++; /* skip the dot */
3904 if (index (&ufile[1], '/'))
3905 *targ++ = '.';
3906 else
3907 *targ++ = ']';
3908 }
3909 else if (strncmp (ufile, "../", 3) == 0)
3910 {
3911 if (!slash_seen)
3912 {
3913 *targ++ = '[';
3914 slash_seen = 1;
3915 }
3916 *targ++ = '-';
3917 ufile += 2; /* skip the dots */
3918 if (index (&ufile[1], '/'))
3919 *targ++ = '.';
3920 else
3921 *targ++ = ']';
3922 }
3923 else
3924 *targ++ = *ufile;
3925 break;
3926
3927 default:
3928 *targ++ = *ufile;
3929 break;
3930 }
3931 ufile++;
3932 }
3933 *targ = '\0';
3934
3935 return utbuf;
3936}
3937
3938char *
3939getwd (pathname)
3940 char *pathname;
3941{
3942 char *ptr, *val;
3943 extern char *getcwd ();
3944
3945#define MAXPATHLEN 1024
3946
3947 ptr = xmalloc (MAXPATHLEN);
3948 val = getcwd (ptr, MAXPATHLEN);
3949 if (val == 0)
3950 {
3951 xfree (ptr);
3952 return val;
3953 }
3954 strcpy (pathname, ptr);
3955 xfree (ptr);
3956
3957 return pathname;
3958}
3959
3960int
3961getppid ()
3962{
3963 long item_code = JPI$_OWNER;
3964 unsigned long parent_id;
3965 int status;
3966
3967 if (((status = LIB$GETJPI (&item_code, 0, 0, &parent_id)) & 1) == 0)
3968 {
3969 errno = EVMSERR;
3970 vaxc$errno = status;
3971 return -1;
3972 }
3973 return parent_id;
3974}
3975
3976#undef getuid
3977unsigned
3978sys_getuid ()
3979{
3980 return (getgid () << 16) | getuid ();
3981}
3982
3983#undef read
3984int
3985sys_read (fildes, buf, nbyte)
3986 int fildes;
3987 char *buf;
3988 unsigned int nbyte;
3989{
3990 return read (fildes, buf, (nbyte < MAXIOSIZE ? nbyte : MAXIOSIZE));
3991}
3992
3993/*
3994 * VAX/VMS VAX C RTL really loses. It insists that records
3995 * end with a newline (carriage return) character, and if they
3996 * don't it adds one (nice of it isn't it!)
3997 *
3998 * Thus we do this stupidity below.
3999 */
4000
4001#undef write
4002int
4003sys_write (fildes, buf, nbytes)
4004 int fildes;
4005 char *buf;
4006 unsigned int nbytes;
4007{
4008 register char *p;
4009 register char *e;
4010 int sum = 0;
4011 struct stat st;
4012
4013 fstat (fildes, &st);
4014 p = buf;
4015 while (nbytes > 0)
4016 {
4017 int len, retval;
4018
4019 /* Handle fixed-length files with carriage control. */
4020 if (st.st_fab_rfm == FAB$C_FIX
4021 && ((st.st_fab_rat & (FAB$M_FTN | FAB$M_CR)) != 0))
4022 {
4023 len = st.st_fab_mrs;
4024 retval = write (fildes, p, min (len, nbytes));
4025 if (retval != len)
4026 return -1;
4027 retval++; /* This skips the implied carriage control */
4028 }
4029 else
4030 {
4031 e = p + min (MAXIOSIZE, nbytes) - 1;
4032 while (*e != '\n' && e > p) e--;
4033 if (p == e) /* Ok.. so here we add a newline... sigh. */
4034 e = p + min (MAXIOSIZE, nbytes) - 1;
4035 len = e + 1 - p;
4036 retval = write (fildes, p, len);
4037 if (retval != len)
4038 return -1;
4039 }
4040 p += retval;
4041 sum += retval;
4042 nbytes -= retval;
4043 }
4044 return sum;
4045}
4046
4047/* Create file NEW copying its attributes from file OLD. If
4048 OLD is 0 or does not exist, create based on the value of
4049 vms_stmlf_recfm. */
4050
4051/* Protection value the file should ultimately have.
4052 Set by create_copy_attrs, and use by rename_sansversions. */
4053static unsigned short int fab_final_pro;
4054
4055int
4056creat_copy_attrs (old, new)
4057 char *old, *new;
4058{
4059 struct FAB fab = cc$rms_fab;
4060 struct XABPRO xabpro;
4061 char aclbuf[256]; /* Choice of size is arbitrary. See below. */
4062 extern int vms_stmlf_recfm;
4063
4064 if (old)
4065 {
4066 fab.fab$b_fac = FAB$M_GET;
4067 fab.fab$l_fna = old;
4068 fab.fab$b_fns = strlen (old);
4069 fab.fab$l_xab = (char *) &xabpro;
4070 xabpro = cc$rms_xabpro;
4071 xabpro.xab$l_aclbuf = aclbuf;
4072 xabpro.xab$w_aclsiz = sizeof aclbuf;
4073 /* Call $OPEN to fill in the fab & xabpro fields. */
4074 if (SYS$OPEN (&fab, 0, 0) & 1)
4075 {
4076 SYS$CLOSE (&fab, 0, 0);
4077 fab.fab$l_alq = 0; /* zero the allocation quantity */
4078 if (xabpro.xab$w_acllen > 0)
4079 {
4080 if (xabpro.xab$w_acllen > sizeof aclbuf)
4081 /* If the acl buffer was too short, redo open with longer one.
4082 Wouldn't need to do this if there were some system imposed
4083 limit on the size of an ACL, but I can't find any such. */
4084 {
4085 xabpro.xab$l_aclbuf = (char *) alloca (xabpro.xab$w_acllen);
4086 xabpro.xab$w_aclsiz = xabpro.xab$w_acllen;
4087 if (SYS$OPEN (&fab, 0, 0) & 1)
4088 SYS$CLOSE (&fab, 0, 0);
4089 else
4090 old = 0;
4091 }
4092 }
4093 else
4094 xabpro.xab$l_aclbuf = 0;
4095 }
4096 else
4097 old = 0;
4098 }
4099 fab.fab$l_fna = new;
4100 fab.fab$b_fns = strlen (new);
4101 if (!old)
4102 {
4103 fab.fab$l_xab = 0;
4104 fab.fab$b_rfm = vms_stmlf_recfm ? FAB$C_STMLF : FAB$C_VAR;
4105 fab.fab$b_rat = FAB$M_CR;
4106 }
4107
4108 /* Set the file protections such that we will be able to manipulate
4109 this file. Once we are done writing and renaming it, we will set
4110 the protections back. */
4111 if (old)
4112 fab_final_pro = xabpro.xab$w_pro;
4113 else
4114 SYS$SETDFPROT (0, &fab_final_pro);
4115 xabpro.xab$w_pro &= 0xff0f; /* set O:rewd for now. This is set back later. */
4116
4117 /* Create the new file with either default attrs or attrs copied
4118 from old file. */
4119 if (!(SYS$CREATE (&fab, 0, 0) & 1))
4120 return -1;
4121 SYS$CLOSE (&fab, 0, 0);
4122 /* As this is a "replacement" for creat, return a file descriptor
4123 opened for writing. */
4124 return open (new, O_WRONLY);
4125}
4126
4127#ifdef creat
4128#undef creat
4129#include <varargs.h>
4130#ifdef __GNUC__
4131#ifndef va_count
4132#define va_count(X) ((X) = *(((int *) &(va_alist)) - 1))
4133#endif
4134#endif
4135
4136int
4137sys_creat (va_alist)
4138 va_dcl
4139{
4140 va_list list_incrementer;
4141 char *name;
4142 int mode;
4143 int rfd; /* related file descriptor */
4144 int fd; /* Our new file descriptor */
4145 int count;
4146 struct stat st_buf;
4147 char rfm[12];
4148 char rat[15];
4149 char mrs[13];
4150 char fsz[13];
4151 extern int vms_stmlf_recfm;
4152
4153 va_count (count);
4154 va_start (list_incrementer);
4155 name = va_arg (list_incrementer, char *);
4156 mode = va_arg (list_incrementer, int);
4157 if (count > 2)
4158 rfd = va_arg (list_incrementer, int);
4159 va_end (list_incrementer);
4160 if (count > 2)
4161 {
4162 /* Use information from the related file descriptor to set record
4163 format of the newly created file. */
4164 fstat (rfd, &st_buf);
4165 switch (st_buf.st_fab_rfm)
4166 {
4167 case FAB$C_FIX:
4168 strcpy (rfm, "rfm = fix");
4169 sprintf (mrs, "mrs = %d", st_buf.st_fab_mrs);
4170 strcpy (rat, "rat = ");
4171 if (st_buf.st_fab_rat & FAB$M_CR)
4172 strcat (rat, "cr");
4173 else if (st_buf.st_fab_rat & FAB$M_FTN)
4174 strcat (rat, "ftn");
4175 else if (st_buf.st_fab_rat & FAB$M_PRN)
4176 strcat (rat, "prn");
4177 if (st_buf.st_fab_rat & FAB$M_BLK)
4178 if (st_buf.st_fab_rat & (FAB$M_CR|FAB$M_FTN|FAB$M_PRN))
4179 strcat (rat, ", blk");
4180 else
4181 strcat (rat, "blk");
4182 return creat (name, 0, rfm, rat, mrs);
4183
4184 case FAB$C_VFC:
4185 strcpy (rfm, "rfm = vfc");
4186 sprintf (fsz, "fsz = %d", st_buf.st_fab_fsz);
4187 strcpy (rat, "rat = ");
4188 if (st_buf.st_fab_rat & FAB$M_CR)
4189 strcat (rat, "cr");
4190 else if (st_buf.st_fab_rat & FAB$M_FTN)
4191 strcat (rat, "ftn");
4192 else if (st_buf.st_fab_rat & FAB$M_PRN)
4193 strcat (rat, "prn");
4194 if (st_buf.st_fab_rat & FAB$M_BLK)
4195 if (st_buf.st_fab_rat & (FAB$M_CR|FAB$M_FTN|FAB$M_PRN))
4196 strcat (rat, ", blk");
4197 else
4198 strcat (rat, "blk");
4199 return creat (name, 0, rfm, rat, fsz);
4200
4201 case FAB$C_STM:
4202 strcpy (rfm, "rfm = stm");
4203 break;
4204
4205 case FAB$C_STMCR:
4206 strcpy (rfm, "rfm = stmcr");
4207 break;
4208
4209 case FAB$C_STMLF:
4210 strcpy (rfm, "rfm = stmlf");
4211 break;
4212
4213 case FAB$C_UDF:
4214 strcpy (rfm, "rfm = udf");
4215 break;
4216
4217 case FAB$C_VAR:
4218 strcpy (rfm, "rfm = var");
4219 break;
4220 }
4221 strcpy (rat, "rat = ");
4222 if (st_buf.st_fab_rat & FAB$M_CR)
4223 strcat (rat, "cr");
4224 else if (st_buf.st_fab_rat & FAB$M_FTN)
4225 strcat (rat, "ftn");
4226 else if (st_buf.st_fab_rat & FAB$M_PRN)
4227 strcat (rat, "prn");
4228 if (st_buf.st_fab_rat & FAB$M_BLK)
4229 if (st_buf.st_fab_rat & (FAB$M_CR|FAB$M_FTN|FAB$M_PRN))
4230 strcat (rat, ", blk");
4231 else
4232 strcat (rat, "blk");
4233 }
4234 else
4235 {
4236 strcpy (rfm, vms_stmlf_recfm ? "rfm = stmlf" : "rfm=var");
4237 strcpy (rat, "rat=cr");
4238 }
4239 /* Until the VAX C RTL fixes the many bugs with modes, always use
4240 mode 0 to get the user's default protection. */
4241 fd = creat (name, 0, rfm, rat);
4242 if (fd < 0 && errno == EEXIST)
4243 {
4244 if (unlink (name) < 0)
4245 report_file_error ("delete", build_string (name));
4246 fd = creat (name, 0, rfm, rat);
4247 }
4248 return fd;
4249}
4250#endif /* creat */
4251
4252/* fwrite to stdout is S L O W. Speed it up by using fputc...*/
4253int
4254sys_fwrite (ptr, size, num, fp)
4255 register char * ptr;
4256 FILE * fp;
4257{
4258 register int tot = num * size;
4259
4260 while (tot--)
4261 fputc (*ptr++, fp);
4262 return num;
4263}
4264
4265/*
4266 * The VMS C library routine creat actually creates a new version of an
4267 * existing file rather than truncating the old version. There are times
4268 * when this is not the desired behavior, for instance, when writing an
4269 * auto save file (you only want one version), or when you don't have
4270 * write permission in the directory containing the file (but the file
4271 * itself is writable). Hence this routine, which is equivalent to
4272 * "close (creat (fn, 0));" on Unix if fn already exists.
4273 */
4274int
4275vms_truncate (fn)
4276 char *fn;
4277{
4278 struct FAB xfab = cc$rms_fab;
4279 struct RAB xrab = cc$rms_rab;
4280 int status;
4281
4282 xfab.fab$l_fop = FAB$M_TEF; /* free allocated but unused blocks on close */
4283 xfab.fab$b_fac = FAB$M_TRN | FAB$M_GET; /* allow truncate and get access */
4284 xfab.fab$b_shr = FAB$M_NIL; /* allow no sharing - file must be locked */
4285 xfab.fab$l_fna = fn;
4286 xfab.fab$b_fns = strlen (fn);
4287 xfab.fab$l_dna = ";0"; /* default to latest version of the file */
4288 xfab.fab$b_dns = 2;
4289 xrab.rab$l_fab = &xfab;
4290
4291 /* This gibberish opens the file, positions to the first record, and
4292 deletes all records from there until the end of file. */
4293 if ((SYS$OPEN (&xfab) & 01) == 01)
4294 {
4295 if ((SYS$CONNECT (&xrab) & 01) == 01 &&
4296 (SYS$FIND (&xrab) & 01) == 01 &&
4297 (SYS$TRUNCATE (&xrab) & 01) == 01)
4298 status = 0;
4299 else
4300 status = -1;
4301 }
4302 else
4303 status = -1;
4304 SYS$CLOSE (&xfab);
4305 return status;
4306}
4307
4308/* Define this symbol to actually read SYSUAF.DAT. This requires either
4309 SYSPRV or a readable SYSUAF.DAT. */
4310
4311#ifdef READ_SYSUAF
4312/*
4313 * getuaf.c
4314 *
4315 * Routine to read the VMS User Authorization File and return
4316 * a specific user's record.
4317 */
4318
4319static struct UAF retuaf;
4320
4321struct UAF *
4322get_uaf_name (uname)
4323 char * uname;
4324{
4325 register status;
4326 struct FAB uaf_fab;
4327 struct RAB uaf_rab;
4328
4329 uaf_fab = cc$rms_fab;
4330 uaf_rab = cc$rms_rab;
4331 /* initialize fab fields */
4332 uaf_fab.fab$l_fna = "SYS$SYSTEM:SYSUAF.DAT";
4333 uaf_fab.fab$b_fns = 21;
4334 uaf_fab.fab$b_fac = FAB$M_GET;
4335 uaf_fab.fab$b_org = FAB$C_IDX;
4336 uaf_fab.fab$b_shr = FAB$M_GET|FAB$M_PUT|FAB$M_UPD|FAB$M_DEL;
4337 /* initialize rab fields */
4338 uaf_rab.rab$l_fab = &uaf_fab;
4339 /* open the User Authorization File */
4340 status = SYS$OPEN (&uaf_fab);
4341 if (!(status&1))
4342 {
4343 errno = EVMSERR;
4344 vaxc$errno = status;
4345 return 0;
4346 }
4347 status = SYS$CONNECT (&uaf_rab);
4348 if (!(status&1))
4349 {
4350 errno = EVMSERR;
4351 vaxc$errno = status;
4352 return 0;
4353 }
4354 /* read the requested record - index is in uname */
4355 uaf_rab.rab$l_kbf = uname;
4356 uaf_rab.rab$b_ksz = strlen (uname);
4357 uaf_rab.rab$b_rac = RAB$C_KEY;
4358 uaf_rab.rab$l_ubf = (char *)&retuaf;
4359 uaf_rab.rab$w_usz = sizeof retuaf;
4360 status = SYS$GET (&uaf_rab);
4361 if (!(status&1))
4362 {
4363 errno = EVMSERR;
4364 vaxc$errno = status;
4365 return 0;
4366 }
4367 /* close the User Authorization File */
4368 status = SYS$DISCONNECT (&uaf_rab);
4369 if (!(status&1))
4370 {
4371 errno = EVMSERR;
4372 vaxc$errno = status;
4373 return 0;
4374 }
4375 status = SYS$CLOSE (&uaf_fab);
4376 if (!(status&1))
4377 {
4378 errno = EVMSERR;
4379 vaxc$errno = status;
4380 return 0;
4381 }
4382 return &retuaf;
4383}
4384
4385struct UAF *
4386get_uaf_uic (uic)
4387 unsigned long uic;
4388{
4389 register status;
4390 struct FAB uaf_fab;
4391 struct RAB uaf_rab;
4392
4393 uaf_fab = cc$rms_fab;
4394 uaf_rab = cc$rms_rab;
4395 /* initialize fab fields */
4396 uaf_fab.fab$l_fna = "SYS$SYSTEM:SYSUAF.DAT";
4397 uaf_fab.fab$b_fns = 21;
4398 uaf_fab.fab$b_fac = FAB$M_GET;
4399 uaf_fab.fab$b_org = FAB$C_IDX;
4400 uaf_fab.fab$b_shr = FAB$M_GET|FAB$M_PUT|FAB$M_UPD|FAB$M_DEL;
4401 /* initialize rab fields */
4402 uaf_rab.rab$l_fab = &uaf_fab;
4403 /* open the User Authorization File */
4404 status = SYS$OPEN (&uaf_fab);
4405 if (!(status&1))
4406 {
4407 errno = EVMSERR;
4408 vaxc$errno = status;
4409 return 0;
4410 }
4411 status = SYS$CONNECT (&uaf_rab);
4412 if (!(status&1))
4413 {
4414 errno = EVMSERR;
4415 vaxc$errno = status;
4416 return 0;
4417 }
4418 /* read the requested record - index is in uic */
4419 uaf_rab.rab$b_krf = 1; /* 1st alternate key */
4420 uaf_rab.rab$l_kbf = (char *) &uic;
4421 uaf_rab.rab$b_ksz = sizeof uic;
4422 uaf_rab.rab$b_rac = RAB$C_KEY;
4423 uaf_rab.rab$l_ubf = (char *)&retuaf;
4424 uaf_rab.rab$w_usz = sizeof retuaf;
4425 status = SYS$GET (&uaf_rab);
4426 if (!(status&1))
4427 {
4428 errno = EVMSERR;
4429 vaxc$errno = status;
4430 return 0;
4431 }
4432 /* close the User Authorization File */
4433 status = SYS$DISCONNECT (&uaf_rab);
4434 if (!(status&1))
4435 {
4436 errno = EVMSERR;
4437 vaxc$errno = status;
4438 return 0;
4439 }
4440 status = SYS$CLOSE (&uaf_fab);
4441 if (!(status&1))
4442 {
4443 errno = EVMSERR;
4444 vaxc$errno = status;
4445 return 0;
4446 }
4447 return &retuaf;
4448}
4449
4450static struct passwd retpw;
4451
4452struct passwd *
4453cnv_uaf_pw (up)
4454 struct UAF * up;
4455{
4456 char * ptr;
4457
4458 /* copy these out first because if the username is 32 chars, the next
4459 section will overwrite the first byte of the UIC */
4460 retpw.pw_uid = up->uaf$w_mem;
4461 retpw.pw_gid = up->uaf$w_grp;
4462
4463 /* I suppose this is not the best style, to possibly overwrite one
4464 byte beyond the end of the field, but what the heck... */
4465 ptr = &up->uaf$t_username[UAF$S_USERNAME];
4466 while (ptr[-1] == ' ')
4467 ptr--;
4468 *ptr = '\0';
4469 strcpy (retpw.pw_name, up->uaf$t_username);
4470
4471 /* the rest of these are counted ascii strings */
4472 strncpy (retpw.pw_gecos, &up->uaf$t_owner[1], up->uaf$t_owner[0]);
4473 retpw.pw_gecos[up->uaf$t_owner[0]] = '\0';
4474 strncpy (retpw.pw_dir, &up->uaf$t_defdev[1], up->uaf$t_defdev[0]);
4475 retpw.pw_dir[up->uaf$t_defdev[0]] = '\0';
4476 strncat (retpw.pw_dir, &up->uaf$t_defdir[1], up->uaf$t_defdir[0]);
4477 retpw.pw_dir[up->uaf$t_defdev[0] + up->uaf$t_defdir[0]] = '\0';
4478 strncpy (retpw.pw_shell, &up->uaf$t_defcli[1], up->uaf$t_defcli[0]);
4479 retpw.pw_shell[up->uaf$t_defcli[0]] = '\0';
4480
4481 return &retpw;
4482}
4483#else /* not READ_SYSUAF */
4484static struct passwd retpw;
4485#endif /* not READ_SYSUAF */
4486
4487struct passwd *
4488getpwnam (name)
4489 char * name;
4490{
4491#ifdef READ_SYSUAF
4492 struct UAF *up;
4493#else
4494 char * user;
4495 char * dir;
4496 unsigned char * full;
4497#endif /* READ_SYSUAF */
4498 char *ptr = name;
4499
4500 while (*ptr)
4501 {
4502 if ('a' <= *ptr && *ptr <= 'z')
4503 *ptr -= 040;
4504 ptr++;
4505 }
4506#ifdef READ_SYSUAF
4507 if (!(up = get_uaf_name (name)))
4508 return 0;
4509 return cnv_uaf_pw (up);
4510#else
4511 if (strcmp (name, getenv ("USER")) == 0)
4512 {
4513 retpw.pw_uid = getuid ();
4514 retpw.pw_gid = getgid ();
4515 strcpy (retpw.pw_name, name);
4516 if (full = egetenv ("FULLNAME"))
4517 strcpy (retpw.pw_gecos, full);
4518 else
4519 *retpw.pw_gecos = '\0';
4520 strcpy (retpw.pw_dir, egetenv ("HOME"));
4521 *retpw.pw_shell = '\0';
4522 return &retpw;
4523 }
4524 else
4525 return 0;
4526#endif /* not READ_SYSUAF */
4527}
4528
4529struct passwd *
4530getpwuid (uid)
4531 unsigned long uid;
4532{
4533#ifdef READ_SYSUAF
4534 struct UAF * up;
4535
4536 if (!(up = get_uaf_uic (uid)))
4537 return 0;
4538 return cnv_uaf_pw (up);
4539#else
4540 if (uid == sys_getuid ())
4541 return getpwnam (egetenv ("USER"));
4542 else
4543 return 0;
4544#endif /* not READ_SYSUAF */
4545}
4546
4547/* return total address space available to the current process. This is
4548 the sum of the current p0 size, p1 size and free page table entries
4549 available. */
4550int
4551vlimit ()
4552{
4553 int item_code;
4554 unsigned long free_pages;
4555 unsigned long frep0va;
4556 unsigned long frep1va;
4557 register status;
4558
4559 item_code = JPI$_FREPTECNT;
4560 if (((status = LIB$GETJPI (&item_code, 0, 0, &free_pages)) & 1) == 0)
4561 {
4562 errno = EVMSERR;
4563 vaxc$errno = status;
4564 return -1;
4565 }
4566 free_pages *= 512;
4567
4568 item_code = JPI$_FREP0VA;
4569 if (((status = LIB$GETJPI (&item_code, 0, 0, &frep0va)) & 1) == 0)
4570 {
4571 errno = EVMSERR;
4572 vaxc$errno = status;
4573 return -1;
4574 }
4575 item_code = JPI$_FREP1VA;
4576 if (((status = LIB$GETJPI (&item_code, 0, 0, &frep1va)) & 1) == 0)
4577 {
4578 errno = EVMSERR;
4579 vaxc$errno = status;
4580 return -1;
4581 }
4582
4583 return free_pages + frep0va + (0x7fffffff - frep1va);
4584}
4585
4586int
4587define_logical_name (varname, string)
4588 char *varname;
4589 char *string;
4590{
4591 struct dsc$descriptor_s strdsc =
4592 {strlen (string), DSC$K_DTYPE_T, DSC$K_CLASS_S, string};
4593 struct dsc$descriptor_s envdsc =
4594 {strlen (varname), DSC$K_DTYPE_T, DSC$K_CLASS_S, varname};
4595 struct dsc$descriptor_s lnmdsc =
4596 {7, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"};
4597
4598 return LIB$SET_LOGICAL (&envdsc, &strdsc, &lnmdsc, 0, 0);
4599}
4600
4601int
4602delete_logical_name (varname)
4603 char *varname;
4604{
4605 struct dsc$descriptor_s envdsc =
4606 {strlen (varname), DSC$K_DTYPE_T, DSC$K_CLASS_S, varname};
4607 struct dsc$descriptor_s lnmdsc =
4608 {7, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"};
4609
4610 return LIB$DELETE_LOGICAL (&envdsc, &lnmdsc);
4611}
4612
4613int
4614ulimit ()
4615{
4616 return 0;
4617}
4618
4619int
4620setpgrp ()
4621{
4622 return 0;
4623}
4624
4625int
4626execvp ()
4627{
4628 error ("execvp system call not implemented");
4629 return -1;
4630}
4631
4632int
4633rename (from, to)
4634 char *from, *to;
4635{
4636 int status;
4637 struct FAB from_fab = cc$rms_fab, to_fab = cc$rms_fab;
4638 struct NAM from_nam = cc$rms_nam, to_nam = cc$rms_nam;
4639 char from_esn[NAM$C_MAXRSS];
4640 char to_esn[NAM$C_MAXRSS];
4641
4642 from_fab.fab$l_fna = from;
4643 from_fab.fab$b_fns = strlen (from);
4644 from_fab.fab$l_nam = &from_nam;
4645 from_fab.fab$l_fop = FAB$M_NAM;
4646
4647 from_nam.nam$l_esa = from_esn;
4648 from_nam.nam$b_ess = sizeof from_esn;
4649
4650 to_fab.fab$l_fna = to;
4651 to_fab.fab$b_fns = strlen (to);
4652 to_fab.fab$l_nam = &to_nam;
4653 to_fab.fab$l_fop = FAB$M_NAM;
4654
4655 to_nam.nam$l_esa = to_esn;
4656 to_nam.nam$b_ess = sizeof to_esn;
4657
4658 status = SYS$RENAME (&from_fab, 0, 0, &to_fab);
4659
4660 if (status & 1)
4661 return 0;
4662 else
4663 {
4664 if (status == RMS$_DEV)
4665 errno = EXDEV;
4666 else
4667 errno = EVMSERR;
4668 vaxc$errno = status;
4669 return -1;
4670 }
4671}
4672
4673/* This function renames a file like `rename', but it strips
4674 the version number from the "to" filename, such that the "to" file is
4675 will always be a new version. It also sets the file protection once it is
4676 finished. The protection that we will use is stored in fab_final_pro,
4677 and was set when we did a creat_copy_attrs to create the file that we
4678 are renaming.
4679
4680 We could use the chmod function, but Eunichs uses 3 bits per user category
4681 to describe the protection, and VMS uses 4 (write and delete are separate
4682 bits). To maintain portability, the VMS implementation of `chmod' wires
4683 the W and D bits together. */
4684
4685
4686static struct fibdef fib; /* We need this initialized to zero */
4687char vms_file_written[NAM$C_MAXRSS];
4688
4689int
4690rename_sans_version (from,to)
4691 char *from, *to;
4692{
4693 short int chan;
4694 int stat;
4695 short int iosb[4];
4696 int status;
4697 struct FAB to_fab = cc$rms_fab;
4698 struct NAM to_nam = cc$rms_nam;
4699 struct dsc$descriptor fib_d ={sizeof (fib),0,0,(char*) &fib};
4700 struct dsc$descriptor fib_attr[2]
4701 = {{sizeof (fab_final_pro),ATR$C_FPRO,0,(char*) &fab_final_pro},{0,0,0,0}};
4702 char to_esn[NAM$C_MAXRSS];
4703
4704 $DESCRIPTOR (disk,to_esn);
4705
4706 to_fab.fab$l_fna = to;
4707 to_fab.fab$b_fns = strlen (to);
4708 to_fab.fab$l_nam = &to_nam;
4709 to_fab.fab$l_fop = FAB$M_NAM;
4710
4711 to_nam.nam$l_esa = to_esn;
4712 to_nam.nam$b_ess = sizeof to_esn;
4713
4714 status = SYS$PARSE (&to_fab, 0, 0); /* figure out the full file name */
4715
4716 if (to_nam.nam$l_fnb && NAM$M_EXP_VER)
4717 *(to_nam.nam$l_ver) = '\0';
4718
4719 stat = rename (from, to_esn);
4720 if (stat < 0)
4721 return stat;
4722
4723 strcpy (vms_file_written, to_esn);
4724
4725 to_fab.fab$l_fna = vms_file_written; /* this points to the versionless name */
4726 to_fab.fab$b_fns = strlen (vms_file_written);
4727
4728 /* Now set the file protection to the correct value */
4729 SYS$OPEN (&to_fab, 0, 0); /* This fills in the nam$w_fid fields */
4730
4731 /* Copy these fields into the fib */
4732 fib.fib$r_fid_overlay.fib$w_fid[0] = to_nam.nam$w_fid[0];
4733 fib.fib$r_fid_overlay.fib$w_fid[1] = to_nam.nam$w_fid[1];
4734 fib.fib$r_fid_overlay.fib$w_fid[2] = to_nam.nam$w_fid[2];
4735
4736 SYS$CLOSE (&to_fab, 0, 0);
4737
4738 stat = SYS$ASSIGN (&disk, &chan, 0, 0); /* open a channel to the disk */
4739 if (!stat)
4740 LIB$SIGNAL (stat);
4741 stat = SYS$QIOW (0, chan, IO$_MODIFY, iosb, 0, 0, &fib_d,
4742 0, 0, 0, &fib_attr, 0);
4743 if (!stat)
4744 LIB$SIGNAL (stat);
4745 stat = SYS$DASSGN (chan);
4746 if (!stat)
4747 LIB$SIGNAL (stat);
4748 strcpy (vms_file_written, to_esn); /* We will write this to the terminal*/
4749 return 0;
4750}
4751
4752int
4753link (file, new)
4754 char * file, * new;
4755{
4756 register status;
4757 struct FAB fab;
4758 struct NAM nam;
4759 unsigned short fid[3];
4760 char esa[NAM$C_MAXRSS];
4761
4762 fab = cc$rms_fab;
4763 fab.fab$l_fop = FAB$M_OFP;
4764 fab.fab$l_fna = file;
4765 fab.fab$b_fns = strlen (file);
4766 fab.fab$l_nam = &nam;
4767
4768 nam = cc$rms_nam;
4769 nam.nam$l_esa = esa;
4770 nam.nam$b_ess = NAM$C_MAXRSS;
4771
4772 status = SYS$PARSE (&fab);
4773 if ((status & 1) == 0)
4774 {
4775 errno = EVMSERR;
4776 vaxc$errno = status;
4777 return -1;
4778 }
4779 status = SYS$SEARCH (&fab);
4780 if ((status & 1) == 0)
4781 {
4782 errno = EVMSERR;
4783 vaxc$errno = status;
4784 return -1;
4785 }
4786
4787 fid[0] = nam.nam$w_fid[0];
4788 fid[1] = nam.nam$w_fid[1];
4789 fid[2] = nam.nam$w_fid[2];
4790
4791 fab.fab$l_fna = new;
4792 fab.fab$b_fns = strlen (new);
4793
4794 status = SYS$PARSE (&fab);
4795 if ((status & 1) == 0)
4796 {
4797 errno = EVMSERR;
4798 vaxc$errno = status;
4799 return -1;
4800 }
4801
4802 nam.nam$w_fid[0] = fid[0];
4803 nam.nam$w_fid[1] = fid[1];
4804 nam.nam$w_fid[2] = fid[2];
4805
4806 nam.nam$l_esa = nam.nam$l_name;
4807 nam.nam$b_esl = nam.nam$b_name + nam.nam$b_type + nam.nam$b_ver;
4808
4809 status = SYS$ENTER (&fab);
4810 if ((status & 1) == 0)
4811 {
4812 errno = EVMSERR;
4813 vaxc$errno = status;
4814 return -1;
4815 }
4816
4817 return 0;
4818}
4819
4820void
4821croak (badfunc)
4822 char *badfunc;
4823{
4824 printf ("%s not yet implemented\r\n", badfunc);
4825 reset_all_sys_modes ();
4826 exit (1);
4827}
4828
4829long
4830random ()
4831{
4832 /* Arrange to return a range centered on zero. */
4833 return rand () - (1 << 30);
4834}
4835
4836void
4837srandom (seed)
4838{
4839 srand (seed);
4840}
4841#endif /* VMS */
4842 2887
4843#ifndef BSTRING 2888#ifndef BSTRING
4844 2889
@@ -4849,21 +2894,8 @@ bzero (b, length)
4849 register char *b; 2894 register char *b;
4850 register int length; 2895 register int length;
4851{ 2896{
4852#ifdef VMS
4853 short zero = 0;
4854 long max_str = 65535;
4855
4856 while (length > max_str) {
4857 (void) LIB$MOVC5 (&zero, &zero, &zero, &max_str, b);
4858 length -= max_str;
4859 b += max_str;
4860 }
4861 max_str = length;
4862 (void) LIB$MOVC5 (&zero, &zero, &zero, &max_str, b);
4863#else
4864 while (length-- > 0) 2897 while (length-- > 0)
4865 *b++ = 0; 2898 *b++ = 0;
4866#endif /* not VMS */
4867} 2899}
4868 2900
4869#endif /* no bzero */ 2901#endif /* no bzero */
@@ -4879,21 +2911,8 @@ bcopy (b1, b2, length)
4879 register char *b2; 2911 register char *b2;
4880 register int length; 2912 register int length;
4881{ 2913{
4882#ifdef VMS
4883 long max_str = 65535;
4884
4885 while (length > max_str) {
4886 (void) LIB$MOVC3 (&max_str, b1, b2);
4887 length -= max_str;
4888 b1 += max_str;
4889 b2 += max_str;
4890 }
4891 max_str = length;
4892 (void) LIB$MOVC3 (&length, b1, b2);
4893#else
4894 while (length-- > 0) 2914 while (length-- > 0)
4895 *b2++ = *b1++; 2915 *b2++ = *b1++;
4896#endif /* not VMS */
4897} 2916}
4898#endif /* (!defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY) */ 2917#endif /* (!defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY) */
4899 2918
@@ -4905,18 +2924,11 @@ bcmp (b1, b2, length) /* This could be a macro! */
4905 register char *b2; 2924 register char *b2;
4906 register int length; 2925 register int length;
4907{ 2926{
4908#ifdef VMS
4909 struct dsc$descriptor_s src1 = {length, DSC$K_DTYPE_T, DSC$K_CLASS_S, b1};
4910 struct dsc$descriptor_s src2 = {length, DSC$K_DTYPE_T, DSC$K_CLASS_S, b2};
4911
4912 return STR$COMPARE (&src1, &src2);
4913#else
4914 while (length-- > 0) 2927 while (length-- > 0)
4915 if (*b1++ != *b2++) 2928 if (*b1++ != *b2++)
4916 return 1; 2929 return 1;
4917 2930
4918 return 0; 2931 return 0;
4919#endif /* not VMS */
4920} 2932}
4921#endif /* no bcmp */ 2933#endif /* no bcmp */
4922#endif /* not BSTRING */ 2934#endif /* not BSTRING */
@@ -4930,12 +2942,8 @@ strsignal (code)
4930 2942
4931 if (0 <= code && code < NSIG) 2943 if (0 <= code && code < NSIG)
4932 { 2944 {
4933#ifdef VMS
4934 signame = sys_errlist[code];
4935#else
4936 /* Cast to suppress warning if the table has const char *. */ 2945 /* Cast to suppress warning if the table has const char *. */
4937 signame = (char *) sys_siglist[code]; 2946 signame = (char *) sys_siglist[code];
4938#endif
4939 } 2947 }
4940 2948
4941 return signame; 2949 return signame;
diff --git a/src/syssignal.h b/src/syssignal.h
index 1aaae5562ff..21df63959f5 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -192,13 +192,11 @@ extern SIGMASKTYPE sigprocmask_set;
192 192
193/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals 193/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
194 testing SIGCHLD. */ 194 testing SIGCHLD. */
195#ifndef VMS
196#ifdef SIGCLD 195#ifdef SIGCLD
197#ifndef SIGCHLD 196#ifndef SIGCHLD
198#define SIGCHLD SIGCLD 197#define SIGCHLD SIGCLD
199#endif /* SIGCHLD */ 198#endif /* SIGCHLD */
200#endif /* ! defined (SIGCLD) */ 199#endif /* ! defined (SIGCLD) */
201#endif /* VMS */
202 200
203#ifndef HAVE_STRSIGNAL 201#ifndef HAVE_STRSIGNAL
204/* strsignal is in sysdep.c */ 202/* strsignal is in sysdep.c */
diff --git a/src/systime.h b/src/systime.h
index e9161114afd..2a04beff757 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -42,12 +42,6 @@ extern char *tzname[]; /* RS6000 and others want it this way. */
42extern time_t timezone; 42extern time_t timezone;
43#endif 43#endif
44 44
45#ifdef VMS
46#ifdef VAXC
47#include "vmstime.h"
48#endif
49#endif
50
51/* On some configurations (hpux8.0, X11R4), sys/time.h and X11/Xos.h 45/* On some configurations (hpux8.0, X11R4), sys/time.h and X11/Xos.h
52 disagree about the name of the guard symbol. */ 46 disagree about the name of the guard symbol. */
53#ifdef HPUX 47#ifdef HPUX
diff --git a/src/systty.h b/src/systty.h
index 98f6ad493e6..b846a026232 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -40,46 +40,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
40#define INCLUDED_FCNTL 40#define INCLUDED_FCNTL
41#include <fcntl.h> 41#include <fcntl.h>
42#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ 42#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
43#ifndef VMS
44#ifndef DOS_NT 43#ifndef DOS_NT
45#include <sgtty.h> 44#include <sgtty.h>
46#endif /* not DOS_NT */ 45#endif /* not DOS_NT */
47#else /* VMS */
48#include <descrip.h>
49static struct iosb
50{
51 short status;
52 short offset;
53 short termlen;
54 short term;
55} input_iosb;
56
57extern int waiting_for_ast;
58extern int stop_input;
59extern int input_ef;
60extern int timer_ef;
61extern int process_ef;
62extern int input_eflist;
63extern int timer_eflist;
64
65static $DESCRIPTOR (input_dsc, "TT");
66static int terminator_mask[2] = { 0, 0 };
67
68static struct sensemode {
69 short status;
70 unsigned char xmit_baud;
71 unsigned char rcv_baud;
72 unsigned char crfill;
73 unsigned char lffill;
74 unsigned char parity;
75 unsigned char unused;
76 char class;
77 char type;
78 short scr_wid;
79 unsigned long tt_char : 24, scr_len : 8;
80 unsigned long tt2_char;
81} sensemode_iosb;
82#endif /* VMS */
83#endif /* not HAVE_TERMIOS */ 46#endif /* not HAVE_TERMIOS */
84#endif /* not HAVE_TERMIO */ 47#endif /* not HAVE_TERMIO */
85 48
@@ -250,9 +213,6 @@ struct emacs_tty {
250#ifdef HAVE_TERMIO 213#ifdef HAVE_TERMIO
251 struct termio main; 214 struct termio main;
252#else 215#else
253#ifdef VMS
254 struct sensemode main;
255#else
256#ifdef DOS_NT 216#ifdef DOS_NT
257 int main; 217 int main;
258#else /* not DOS_NT */ 218#else /* not DOS_NT */
@@ -260,7 +220,6 @@ struct emacs_tty {
260#endif /* not DOS_NT */ 220#endif /* not DOS_NT */
261#endif 221#endif
262#endif 222#endif
263#endif
264 223
265/* If we have TERMIOS, we don't need to do this - they're taken care of 224/* If we have TERMIOS, we don't need to do this - they're taken care of
266 by the tc*attr calls. */ 225 by the tc*attr calls. */
@@ -306,11 +265,6 @@ extern int emacs_set_tty P_ ((int, struct emacs_tty *, int));
306#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) 265#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
307 266
308#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ 267#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
309#ifdef VMS
310
311#define EMACS_TTY_TABS_OK(p) (((p)->main.tt_char & TT$M_MECHTAB) != 0)
312
313#else
314 268
315#ifdef DOS_NT 269#ifdef DOS_NT
316#define EMACS_TTY_TABS_OK(p) 0 270#define EMACS_TTY_TABS_OK(p) 0
@@ -318,7 +272,6 @@ extern int emacs_set_tty P_ ((int, struct emacs_tty *, int));
318#define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) 272#define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS)
319#endif /* not DOS_NT */ 273#endif /* not DOS_NT */
320 274
321#endif /* not def VMS */
322#endif /* not def HAVE_TERMIO */ 275#endif /* not def HAVE_TERMIO */
323#endif /* not def HAVE_TERMIOS */ 276#endif /* not def HAVE_TERMIOS */
324 277
diff --git a/src/syswait.h b/src/syswait.h
index d5ba3b968a5..f0d42095401 100644
--- a/src/syswait.h
+++ b/src/syswait.h
@@ -24,8 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#ifndef EMACS_SYSWAIT_H 24#ifndef EMACS_SYSWAIT_H
25#define EMACS_SYSWAIT_H 25#define EMACS_SYSWAIT_H
26 26
27#ifndef VMS
28
29#include <sys/types.h> 27#include <sys/types.h>
30 28
31#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */ 29#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */
@@ -57,21 +55,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
57#undef WRETCODE 55#undef WRETCODE
58#define WRETCODE(status) WEXITSTATUS (status) 56#define WRETCODE(status) WEXITSTATUS (status)
59 57
60#else /* VMS */
61
62#define WIFSTOPPED(w) 0
63#define WIFSIGNALED(w) 0
64#define WIFEXITED(w) ((w) != -1)
65#define WRETCODE(w) (w)
66#define WSTOPSIG(w) (w)
67#define WCOREDUMP(w) 0
68#define WTERMSIG(w) (w)
69#include <ssdef.h>
70#include <iodef.h>
71#include <clidef.h>
72#include "vmsproc.h"
73
74#endif /* VMS */
75 58
76#endif /* EMACS_SYSWAIT_H */ 59#endif /* EMACS_SYSWAIT_H */
77 60
diff --git a/src/temacs.opt b/src/temacs.opt
deleted file mode 100644
index a8aa50211b7..00000000000
--- a/src/temacs.opt
+++ /dev/null
@@ -1,60 +0,0 @@
1cluster=emacs,,,-
2DISPNEW.OBJ,-
3SCROLL.OBJ,-
4XDISP.OBJ,-
5WINDOW.OBJ,-
6TERM.OBJ,-
7CM.OBJ,-
8EMACS.OBJ,-
9KEYBOARD.OBJ,-
10MACROS.OBJ,-
11KEYMAP.OBJ,-
12SYSDEP.OBJ,-
13BUFFER.OBJ,-
14FILELOCK.OBJ,-
15INSDEL.OBJ,-
16MARKER.OBJ,-
17MINIBUF.OBJ,-
18FILEIO.OBJ,-
19DIRED.OBJ,-
20FILEMODE.OBJ,-
21CMDS.OBJ,-
22CASEFIDDLE.OBJ,-
23INDENT.OBJ,-
24SEARCH.OBJ,-
25REGEX.OBJ,-
26UNDO.OBJ,-
27ALLOC.OBJ,-
28DATA.OBJ,-
29DOC.OBJ,-
30EDITFNS.OBJ,-
31CALLINT.OBJ,-
32EVAL.OBJ,-
33FNS.OBJ,-
34PRINT.OBJ,-
35LREAD.OBJ,-
36ABBREV.OBJ,-
37SYNTAX.OBJ,-
38MOCKLISP.OBJ,-
39BYTECODE.OBJ,-
40PROCESS.OBJ,-
41CALLPROC.OBJ,-
42VMSFNS.OBJ,-
43VMSPROC.OBJ,-
44DOPRNT.OBJ,-
45vmsmap.obj,-
46termcap.obj,-
47tparam.obj,-
48lastfile.obj,-
49alloca.obj,-
50malloc.obj
51collect=non_saved_data,-
52stdin,-
53stdout,-
54stderr,-
55errno,-
56vaxc$errno,-
57sys_errlist,-
58sys_nerr,-
59environ
60sys$library:vaxcrtl/library
diff --git a/src/term.c b/src/term.c
index 0132443833d..c956766eb36 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3489,12 +3489,6 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3489 Down (tty) = tgetstr ("do", address); 3489 Down (tty) = tgetstr ("do", address);
3490 if (!Down (tty)) 3490 if (!Down (tty))
3491 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */ 3491 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */
3492#ifdef VMS
3493 /* VMS puts a carriage return before each linefeed,
3494 so it is not safe to use linefeeds. */
3495 if (Down (tty) && Down (tty)[0] == '\n' && Down (tty)[1] == '\0')
3496 Down (tty) = 0;
3497#endif /* VMS */
3498 if (tgetflag ("bs")) 3492 if (tgetflag ("bs"))
3499 Left (tty) = "\b"; /* can't possibly be longer! */ 3493 Left (tty) = "\b"; /* can't possibly be longer! */
3500 else /* (Actually, "bs" is obsolete...) */ 3494 else /* (Actually, "bs" is obsolete...) */
@@ -3610,15 +3604,6 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3610 3604
3611 TabWidth (tty) = tgetnum ("tw"); 3605 TabWidth (tty) = tgetnum ("tw");
3612 3606
3613#ifdef VMS
3614 /* These capabilities commonly use ^J.
3615 I don't know why, but sending them on VMS does not work;
3616 it causes following spaces to be lost, sometimes.
3617 For now, the simplest fix is to avoid using these capabilities ever. */
3618 if (Down (tty) && Down (tty)[0] == '\n')
3619 Down (tty) = 0;
3620#endif /* VMS */
3621
3622 if (!tty->TS_bell) 3607 if (!tty->TS_bell)
3623 tty->TS_bell = "\07"; 3608 tty->TS_bell = "\07";
3624 3609
@@ -3734,13 +3719,6 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3734 { 3719 {
3735 maybe_fatal (must_succeed, NULL, terminal, 3720 maybe_fatal (must_succeed, NULL, terminal,
3736 "Terminal type \"%s\" is not powerful enough to run Emacs", 3721 "Terminal type \"%s\" is not powerful enough to run Emacs",
3737#ifdef VMS
3738 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
3739It lacks the ability to position the cursor.\n\
3740If that is not the actual type of terminal you have, use either the\n\
3741DCL command `SET TERMINAL/DEVICE= ...' for DEC-compatible terminals,\n\
3742or `define EMACS_TERM \"terminal type\"' for non-DEC terminals.",
3743#else /* not VMS */
3744# ifdef TERMINFO 3722# ifdef TERMINFO
3745 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ 3723 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
3746It lacks the ability to position the cursor.\n\ 3724It lacks the ability to position the cursor.\n\
@@ -3756,7 +3734,6 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3756`setenv TERM ...') to specify the correct type. It may be necessary\n\ 3734`setenv TERM ...') to specify the correct type. It may be necessary\n\
3757to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", 3735to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3758# endif /* TERMINFO */ 3736# endif /* TERMINFO */
3759#endif /*VMS */
3760 terminal_type); 3737 terminal_type);
3761 } 3738 }
3762 3739
diff --git a/src/termcap.c b/src/termcap.c
index 291857697d8..2ad31d7b96a 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -349,13 +349,8 @@ char PC;
349 349
350static int speeds[] = 350static int speeds[] =
351 { 351 {
352#ifdef VMS
353 0, 50, 75, 110, 134, 150, -3, -6, -12, -18,
354 -20, -24, -36, -48, -72, -96, -192
355#else /* not VMS */
356 0, 50, 75, 110, 135, 150, -2, -3, -6, -12, 352 0, 50, 75, 110, 135, 150, -2, -3, -6, -12,
357 -18, -24, -48, -96, -192, -288, -384, -576, -1152 353 -18, -24, -48, -96, -192, -288, -384, -576, -1152
358#endif /* not VMS */
359 }; 354 };
360 355
361#endif /* not emacs */ 356#endif /* not emacs */
@@ -441,34 +436,6 @@ static char *gobble_line ();
441static int compare_contin (); 436static int compare_contin ();
442static int name_match (); 437static int name_match ();
443 438
444#ifdef VMS
445
446#include <rmsdef.h>
447#include <fab.h>
448#include <nam.h>
449#include <starlet.h>
450
451static int
452valid_filename_p (fn)
453 char *fn;
454{
455 struct FAB fab = cc$rms_fab;
456 struct NAM nam = cc$rms_nam;
457 char esa[NAM$C_MAXRSS];
458
459 fab.fab$l_fna = fn;
460 fab.fab$b_fns = strlen(fn);
461 fab.fab$l_nam = &nam;
462 fab.fab$l_fop = FAB$M_NAM;
463
464 nam.nam$l_esa = esa;
465 nam.nam$b_ess = sizeof esa;
466
467 return SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL;
468}
469
470#else /* !VMS */
471
472#ifdef MSDOS /* MW, May 1993 */ 439#ifdef MSDOS /* MW, May 1993 */
473static int 440static int
474valid_filename_p (fn) 441valid_filename_p (fn)
@@ -480,8 +447,6 @@ valid_filename_p (fn)
480#define valid_filename_p(fn) (*(fn) == '/') 447#define valid_filename_p(fn) (*(fn) == '/')
481#endif 448#endif
482 449
483#endif /* !VMS */
484
485/* Find the termcap entry data for terminal type NAME 450/* Find the termcap entry data for terminal type NAME
486 and store it in the block that BP points to. 451 and store it in the block that BP points to.
487 Record its address for future use. 452 Record its address for future use.
diff --git a/src/uaf.h b/src/uaf.h
deleted file mode 100644
index 2870eeafd91..00000000000
--- a/src/uaf.h
+++ /dev/null
@@ -1,298 +0,0 @@
1/* GNU Emacs VMS UAF definition file.
2 Copyright (C) 1986, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007, 2008 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20/*
21 * User Authorization File record formats
22 */
23#ifndef UAF$K_LENGTH
24
25struct UAF {
26#define UAF$C_USER_ID 1
27#define UAF$C_VERSION1 1
28#define UAF$C_KEYED_PART 52
29#define UAF$C_AD_II 0
30#define UAF$C_PURDY 1
31#define UAF$C_PURDY_V 2
32#define UAF$K_FIXED 644
33#define UAF$C_FIXED 644
34#define UAF$K_LENGTH 1412
35#define UAF$C_LENGTH 1412
36#define UAF$S_UAFDEF 1412
37#define UAF$B_RTYPE 0
38 char uaf$b_rtype;
39#define UAF$B_VERSION 1
40 char uaf$b_version;
41#define UAF$W_USRDATOFF 2
42 short uaf$w_usrdatoff;
43#define UAF$S_USERNAME 32
44#define UAF$T_USERNAME 4
45#define UAF$T_USERNAME_TAG 35
46 char uaf$t_username[UAF$S_USERNAME];
47#define UAF$L_UIC 36
48#define UAF$W_MEM 36
49#define UAF$W_GRP 38
50 union {
51 long uaf_l_uic;
52#define uaf$l_uic uaf_u_uic.uaf_l_uic
53 struct {
54 short uaf_w_mem;
55 short uaf_w_grp;
56#define uaf$w_mem uaf_u_uic.uaf_u_mem_grp.uaf_w_mem
57#define uaf$w_grp uaf_u_uic.uaf_u_mem_grp.uaf_w_grp
58 } uaf_u_mem_grp;
59 } uaf_u_uic;
60#define UAF$L_SUB_ID 40
61 long uaf$l_sub_id;
62#define UAF$S_PARENT_ID 8
63#define UAF$Q_PARENT_ID 44
64 char uaf$q_parent_id[UAF$S_PARENT_ID];
65#define UAF$S_ACCOUNT 32
66#define UAF$T_ACCOUNT 52
67 char uaf$t_account[UAF$S_ACCOUNT];
68#define UAF$S_OWNER 32
69#define UAF$T_OWNER 84
70 char uaf$t_owner[UAF$S_OWNER];
71#define UAF$S_DEFDEV 32
72#define UAF$T_DEFDEV 116
73 char uaf$t_defdev[UAF$S_DEFDEV];
74#define UAF$S_DEFDIR 64
75#define UAF$T_DEFDIR 148
76 char uaf$t_defdir[UAF$S_DEFDIR];
77#define UAF$S_LGICMD 64
78#define UAF$T_LGICMD 212
79 char uaf$t_lgicmd[UAF$S_LGICMD];
80#define UAF$S_DEFCLI 32
81#define UAF$T_DEFCLI 276
82 char uaf$t_defcli[UAF$S_DEFCLI];
83#define UAF$S_CLITABLES 32
84#define UAF$T_CLITABLES 308
85 char uaf$t_clitables[UAF$S_CLITABLES];
86#define UAF$S_PWD 8
87#define UAF$Q_PWD 340
88#define UAF$L_PWD 340
89 char uaf$q_pwd[UAF$S_PWD];
90#define uaf$l_pwd uaf$q_pwd[0]
91#define UAF$S_PWD2 8
92#define UAF$Q_PWD2 348
93 char uaf$q_pwd2[UAF$S_PWD2];
94#define UAF$W_LOGFAILS 356
95 short uaf$w_logfails;
96#define UAF$W_SALT 358
97 short uaf$w_salt;
98#define UAF$B_ENCRYPT 360
99 char uaf$b_encrypt;
100#define UAF$B_ENCRYPT2 361
101 char uaf$b_encrypt2;
102#define UAF$B_PWD_LENGTH 362
103 char uaf$b_pwd_length;
104#define UAF$S_EXPIRATION 8
105#define UAF$Q_EXPIRATION 364
106 char uaf$q_expiration[UAF$S_EXPIRATION];
107#define UAF$S_PWD_LIFETIME 8
108#define UAF$Q_PWD_LIFETIME 372
109 char uaf$q_pwd_lifetime[UAF$S_PWD_LIFETIME];
110#define UAF$S_PWD_DATE 8
111#define UAF$Q_PWD_DATE 380
112 char uaf$q_pwd_date[UAF$S_PWD_DATE];
113#define UAF$S_PWD2_DATE 8
114#define UAF$Q_PWD2_DATE 388
115 char uaf$q_pwd2_date[UAF$S_PWD2_DATE];
116#define UAF$S_LASTLOGIN_I 8
117#define UAF$Q_LASTLOGIN_I 396
118 char uaf$q_lastlogin_i[UAF$S_LASTLOGIN_I];
119#define UAF$S_LASTLOGIN_N 8
120#define UAF$Q_LASTLOGIN_N 404
121 char uaf$q_lastlogin_n[UAF$S_LASTLOGIN_N];
122#define UAF$S_PRIV 8
123#define UAF$Q_PRIV 412
124 char uaf$q_priv[UAF$S_PRIV];
125#define UAF$S_DEF_PRIV 8
126#define UAF$Q_DEF_PRIV 420
127 char uaf$q_def_priv[UAF$S_DEF_PRIV];
128#define UAF$S_MIN_CLASS 20
129#define UAF$R_MIN_CLASS 428
130 char uaf$r_min_class[UAF$S_MIN_CLASS];
131#define UAF$S_MAX_CLASS 20
132#define UAF$R_MAX_CLASS 448
133 char uaf$r_max_class[UAF$S_MAX_CLASS];
134#define UAF$L_FLAGS 468
135#define UAF$V_DISCTLY 0
136#define UAF$V_DEFCLI 1
137#define UAF$V_LOCKPWD 2
138#define UAF$V_CAPTIVE 3
139#define UAF$V_DISACNT 4
140#define UAF$V_DISWELCOM 5
141#define UAF$V_DISMAIL 6
142#define UAF$V_NOMAIL 7
143#define UAF$V_GENPWD 8
144#define UAF$V_PWD_EXPIRED 9
145#define UAF$V_PWD2_EXPIRED 10
146#define UAF$V_AUDIT 11
147#define UAF$V_DISREPORT 12
148#define UAF$V_DISRECONNECT 13
149 union {
150 unsigned long uaf_l_flags;
151#define uaf$l_flags uaf_u_flags.uaf_l_flags
152 struct {
153 unsigned long
154 uaf_v_disctly : 1,
155#define uaf$v_disctly uaf_u_flags.uaf_v_flags.uaf_v_disctly
156 uaf_v_defcli : 1,
157#define uaf$v_defcli uaf_u_flags.uaf_v_flags.uaf_v_discli
158 uaf_v_lockpwd : 1,
159#define uaf$v_lockpwd uaf_u_flags.uaf_v_flags.uaf_v_lockpwd
160 uaf_v_captive : 1,
161#define uaf$v_captive uaf_u_flags.uaf_v_flags.uaf_v_captive
162 uaf_v_disacnt : 1,
163#define uaf$v_disacnt uaf_u_flags.uaf_v_flags.uaf_v_disacnt
164 uaf_v_diswelcom : 1,
165#define uaf$v_diswelcom uaf_u_flags.uaf_v_flags.uaf_v_diswelcom
166 uaf_v_dismail : 1,
167#define uaf$v_dismail uaf_u_flags.uaf_v_flags.uaf_v_dismail
168 uaf_v_nomail : 1,
169#define uaf$v_nomail uaf_u_flags.uaf_v_flags.uaf_v_nomail
170 uaf_v_genpwd : 1,
171#define uaf$v_genpwd uaf_u_flags.uaf_v_flags.uaf_v_genpwd
172 uaf_v_pwd_expired : 1,
173#define uaf$v_pwd_expired uaf_u_flags.uaf_v_flags.uaf_v_pwd_expired
174 uaf_v_pwd2_expired : 1,
175#define uaf$v_pwd2_expired uaf_u_flags.uaf_v_flags.uaf_v_pwd2_expired
176 uaf_v_audit : 1,
177#define uaf$v_audit uaf_u_flags.uaf_v_flags.uaf_v_audit
178 uaf_v_disreport : 1,
179#define uaf$v_disreport uaf_u_flags.uaf_v_flags.uaf_v_disreport
180 uaf_v_disreconnect : 1;
181#define uaf$v_disreconnect uaf_u_flags.uaf_v_flags.uaf_v_disreconnect
182 } uaf_v_flags;
183 } uaf_u_flags;
184#define UAF$S_NETWORK_ACCESS_P 3
185#define UAF$B_NETWORK_ACCESS_P 472
186 char uaf$b_network_access_p[UAF$S_NETWORK_ACCESS_P];
187#define UAF$S_NETWORK_ACCESS_S 3
188#define UAF$B_NETWORK_ACCESS_S 475
189 char uaf$b_network_access_s[UAF$S_NETWORK_ACCESS_S];
190#define UAF$S_BATCH_ACCESS_P 3
191#define UAF$B_BATCH_ACCESS_P 478
192 char uaf$b_batch_access_p[UAF$S_BATCH_ACCESS_P];
193#define UAF$S_BATCH_ACCESS_S 3
194#define UAF$B_BATCH_ACCESS_S 481
195 char uaf$b_batch_access_s[UAF$S_BATCH_ACCESS_S];
196#define UAF$S_LOCAL_ACCESS_P 3
197#define UAF$B_LOCAL_ACCESS_P 484
198 char uaf$b_local_access_p[UAF$S_LOCAL_ACCESS_P];
199#define UAF$S_LOCAL_ACCESS_S 3
200#define UAF$B_LOCAL_ACCESS_S 487
201 char uaf$b_local_access_s[UAF$S_LOCAL_ACCESS_S];
202#define UAF$S_DIALUP_ACCESS_P 3
203#define UAF$B_DIALUP_ACCESS_P 490
204 char uaf$b_dialup_access_p[UAF$S_DIALUP_ACCESS_P];
205#define UAF$S_DIALUP_ACCESS_S 3
206#define UAF$B_DIALUP_ACCESS_S 493
207 char uaf$b_dialup_access_s[UAF$S_DIALUP_ACCESS_S];
208#define UAF$S_REMOTE_ACCESS_P 3
209#define UAF$B_REMOTE_ACCESS_P 496
210 char uaf$b_remote_access_p[UAF$S_REMOTE_ACCESS_P];
211#define UAF$S_REMOTE_ACCESS_S 3
212#define UAF$B_REMOTE_ACCESS_S 499
213 char uaf$b_remote_access_s[UAF$S_REMOTE_ACCESS_S];
214#define UAF$B_PRIMEDAYS 514
215#define UAF$V_MONDAY 0
216#define UAF$V_TUESDAY 1
217#define UAF$V_WEDNESDAY 2
218#define UAF$V_THURSDAY 3
219#define UAF$V_FRIDAY 4
220#define UAF$V_SATURDAY 5
221#define UAF$V_SUNDAY 6
222 union {
223 unsigned char uaf_b_primedays;
224#define uaf$b_primedays uaf_u_primedays.uaf_b_primedays
225 unsigned char
226 uaf_v_monday : 1,
227#define uaf$v_monday uaf_u_primedays.uaf_v_monday
228 uaf_v_tuesday : 1,
229#define uaf$v_tuesday uaf_u_primedays.uaf_v_tuesday
230 uaf_v_wednesday : 1,
231#define uaf$v_wednesday uaf_u_primedays.uaf_v_wednesday
232 uaf_v_thursday : 1,
233#define uaf$v_thursday uaf_u_primedays.uaf_v_thursday
234 uaf_v_friday : 1,
235#define uaf$v_friday uaf_u_primedays.uaf_v_friday
236 uaf_v_saturday : 1,
237#define uaf$v_saturday uaf_u_primedays.uaf_v_saturday
238 uav_v_sunday : 1;
239#define uaf$v_sunday uaf_u_primedays.uaf_v_sunday
240 } uaf_u_primedays;
241#define UAF$B_PRI 516
242 char uaf$b_pri;
243#define UAF$B_QUEPRI 517
244 char uaf$b_quepri;
245#define UAF$W_MAXJOBS 518
246 short uaf$w_maxjobs;
247#define UAF$W_MAXACCTJOBS 520
248 short uaf$w_maxacctjobs;
249#define UAF$W_MAXDETACH 522
250 short uaf$w_maxdetach;
251#define UAF$W_PRCCNT 524
252 short uaf$w_prccnt;
253#define UAF$W_BIOLM 526
254 short uaf$w_biolm;
255#define UAF$W_DIOLM 528
256 short uaf$w_diolm;
257#define UAF$W_TQCNT 530
258 short uaf$w_twcnt;
259#define UAF$W_ASTLM 532
260 short uaf$w_astlm;
261#define UAF$W_ENQLM 534
262 short uaf$w_enqlm;
263#define UAF$W_FILLM 536
264 short uaf$w_fillm;
265#define UAF$W_SHRFILLM 538
266 short uaf$w_shrfillm;
267#define UAF$L_WSQUOTA 540
268 long uaf$l_wsquota;
269#define UAF$L_DFWSCNT 544
270 long uaf$l_dfwscnt;
271#define UAF$L_WSEXTENT 548
272 long uaf$l_wsextent;
273#define UAF$L_PGFLQUOTA 552
274 long uaf$l_pgflquota;
275#define UAF$L_CPUTIM 556
276 long uaf$l_cputim;
277#define UAF$L_BYTLM 560
278 long uaf$l_bytlm;
279#define UAF$L_PBYTLM 564
280 long uaf$l_pbytlm;
281#define UAF$L_JTQUOTA 568
282 long uaf$l_jtquota;
283#define UAF$W_PROXY_LIM 572
284 short uaf$w_proxy_lim;
285#define UAF$W_PROXIES 574
286 short uaf$w_proxies;
287#define UAF$W_ACCOUNT_LIM 576
288 short uaf$w_account_lim;
289#define UAF$W_ACCOUNTS 578
290 short uaf$w_accounts;
291 char uaf$b_fixed[UAF$C_FIXED - UAF$W_ACCOUNTS + 2];
292 char uaf$b_usrdata[UAF$C_LENGTH - UAF$C_FIXED];
293};
294
295#endif /* not UAF$K_LENGTH */
296
297/* arch-tag: f95d73be-b0bf-46b7-adf7-89ce8846b062
298 (do not change this comment) */
diff --git a/src/vlimit.h b/src/vlimit.h
deleted file mode 100644
index 5885bee8d2d..00000000000
--- a/src/vlimit.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/* Dummy for Emacs so that we can run on VMS... */
2#define LIM_DATA 0
3
4/* arch-tag: 0c3436cb-5edc-447a-87af-acec402a65b9
5 (do not change this comment) */
diff --git a/src/xfns.c b/src/xfns.c
index 1af0e76caa1..e079ff60250 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -56,15 +56,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
56#include <sys/types.h> 56#include <sys/types.h>
57#include <sys/stat.h> 57#include <sys/stat.h>
58 58
59#ifndef VMS
60#if 1 /* Used to be #ifdef EMACS_BITMAP_FILES, but this should always work. */ 59#if 1 /* Used to be #ifdef EMACS_BITMAP_FILES, but this should always work. */
61#include "bitmaps/gray.xbm" 60#include "bitmaps/gray.xbm"
62#else 61#else
63#include <X11/bitmaps/gray> 62#include <X11/bitmaps/gray>
64#endif 63#endif
65#else
66#include "[.bitmaps]gray.xbm"
67#endif
68 64
69#ifdef USE_GTK 65#ifdef USE_GTK
70#include "gtkutil.h" 66#include "gtkutil.h"