changeset 1172:c942305917c1

[VMS]: Include string.h, rms.h, rmsdef.h. [VMS] (Ffile_version_limit): New function.
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Sep 1992 21:24:30 +0000
parents 5c942f6b2d63
children 4e4ade70cf7e
files src/dired.c
diffstat 1 files changed, 48 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/dired.c	Sat Sep 19 20:41:32 1992 +0000
+++ b/src/dired.c	Sat Sep 19 21:24:30 1992 +0000
@@ -24,6 +24,12 @@
 
 #include "config.h"
 
+#ifdef VMS
+#include <string.h>
+#include <rms.h>
+#include <rmsdef.h>
+#endif
+
 #ifdef SYSV_SYSTEM_DIR
 
 #include <dirent.h>
@@ -216,19 +222,6 @@
   return file_name_completion (file, dirname, 1, 0);
 }
 
-#ifdef VMS
-
-DEFUN ("file-name-all-versions", Ffile_name_all_versions,
-  Sfile_name_all_versions, 2, 2, 0,
-  "Return a list of all versions of file name FILE in directory DIR.")
-  (file, dirname)
-     Lisp_Object file, dirname;
-{
-  return file_name_completion (file, dirname, 1, 1);
-}
-
-#endif /* VMS */
-
 Lisp_Object
 file_name_completion (file, dirname, all_flag, ver_flag)
      Lisp_Object file, dirname;
@@ -412,6 +405,47 @@
   return stat (fullname, st_addr);
 }
 
+#ifdef VMS
+
+DEFUN ("file-name-all-versions", Ffile_name_all_versions,
+  Sfile_name_all_versions, 2, 2, 0,
+  "Return a list of all versions of file name FILE in directory DIR.")
+  (file, dirname)
+     Lisp_Object file, dirname;
+{
+  return file_name_completion (file, dirname, 1, 1);
+}
+
+DEFUN ("file-version-limit", Ffile_version_limit, Sfile_version_limit, 1, 1, 0,
+  "Return the maximum number of versions allowed for FILE.\n\
+Returns nil if the file cannot be opened or if there is no version limit.")
+  (filename)
+     Lisp_Object filename;
+{
+  Lisp_Object retval;
+  struct FAB    fab;
+  struct RAB    rab;
+  struct XABFHC xabfhc;
+  int status;
+
+  filename = Fexpand_file_name (filename, Qnil);
+  fab      = cc$rms_fab;
+  xabfhc   = cc$rms_xabfhc;
+  fab.fab$l_fna = XSTRING (filename)->data;
+  fab.fab$b_fns = strlen (fab.fab$l_fna);
+  fab.fab$l_xab = (char *) &xabfhc;
+  status = sys$open (&fab, 0, 0);
+  if (status != RMS$_NORMAL)	/* Probably non-existent file */
+    return Qnil;
+  sys$close (&fab, 0, 0);
+  if (xabfhc.xab$w_verlimit == 32767)
+    return Qnil;		/* No version limit */
+  else
+    return make_number (xabfhc.xab$w_verlimit);
+}
+
+#endif /* VMS */
+
 Lisp_Object
 make_time (time)
      int time;
@@ -512,6 +546,7 @@
   defsubr (&Sfile_name_completion);
 #ifdef VMS
   defsubr (&Sfile_name_all_versions);
+  defsubr (&Sfile_version_limit);
 #endif /* VMS */
   defsubr (&Sfile_name_all_completions);
   defsubr (&Sfile_attributes);