comparison src/dired.c @ 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 8d43bfe19803
children 4e4ade70cf7e
comparison
equal deleted inserted replaced
1171:5c942f6b2d63 1172:c942305917c1
21 #include <stdio.h> 21 #include <stdio.h>
22 #include <sys/types.h> 22 #include <sys/types.h>
23 #include <sys/stat.h> 23 #include <sys/stat.h>
24 24
25 #include "config.h" 25 #include "config.h"
26
27 #ifdef VMS
28 #include <string.h>
29 #include <rms.h>
30 #include <rmsdef.h>
31 #endif
26 32
27 #ifdef SYSV_SYSTEM_DIR 33 #ifdef SYSV_SYSTEM_DIR
28 34
29 #include <dirent.h> 35 #include <dirent.h>
30 #define DIRENTRY struct dirent 36 #define DIRENTRY struct dirent
213 if (!NILP (handler)) 219 if (!NILP (handler))
214 return call3 (handler, Qfile_name_all_completions, file, dirname); 220 return call3 (handler, Qfile_name_all_completions, file, dirname);
215 221
216 return file_name_completion (file, dirname, 1, 0); 222 return file_name_completion (file, dirname, 1, 0);
217 } 223 }
218
219 #ifdef VMS
220
221 DEFUN ("file-name-all-versions", Ffile_name_all_versions,
222 Sfile_name_all_versions, 2, 2, 0,
223 "Return a list of all versions of file name FILE in directory DIR.")
224 (file, dirname)
225 Lisp_Object file, dirname;
226 {
227 return file_name_completion (file, dirname, 1, 1);
228 }
229
230 #endif /* VMS */
231 224
232 Lisp_Object 225 Lisp_Object
233 file_name_completion (file, dirname, all_flag, ver_flag) 226 file_name_completion (file, dirname, all_flag, ver_flag)
234 Lisp_Object file, dirname; 227 Lisp_Object file, dirname;
235 int all_flag, ver_flag; 228 int all_flag, ver_flag;
410 fullname[pos + len] = 0; 403 fullname[pos + len] = 0;
411 404
412 return stat (fullname, st_addr); 405 return stat (fullname, st_addr);
413 } 406 }
414 407
408 #ifdef VMS
409
410 DEFUN ("file-name-all-versions", Ffile_name_all_versions,
411 Sfile_name_all_versions, 2, 2, 0,
412 "Return a list of all versions of file name FILE in directory DIR.")
413 (file, dirname)
414 Lisp_Object file, dirname;
415 {
416 return file_name_completion (file, dirname, 1, 1);
417 }
418
419 DEFUN ("file-version-limit", Ffile_version_limit, Sfile_version_limit, 1, 1, 0,
420 "Return the maximum number of versions allowed for FILE.\n\
421 Returns nil if the file cannot be opened or if there is no version limit.")
422 (filename)
423 Lisp_Object filename;
424 {
425 Lisp_Object retval;
426 struct FAB fab;
427 struct RAB rab;
428 struct XABFHC xabfhc;
429 int status;
430
431 filename = Fexpand_file_name (filename, Qnil);
432 fab = cc$rms_fab;
433 xabfhc = cc$rms_xabfhc;
434 fab.fab$l_fna = XSTRING (filename)->data;
435 fab.fab$b_fns = strlen (fab.fab$l_fna);
436 fab.fab$l_xab = (char *) &xabfhc;
437 status = sys$open (&fab, 0, 0);
438 if (status != RMS$_NORMAL) /* Probably non-existent file */
439 return Qnil;
440 sys$close (&fab, 0, 0);
441 if (xabfhc.xab$w_verlimit == 32767)
442 return Qnil; /* No version limit */
443 else
444 return make_number (xabfhc.xab$w_verlimit);
445 }
446
447 #endif /* VMS */
448
415 Lisp_Object 449 Lisp_Object
416 make_time (time) 450 make_time (time)
417 int time; 451 int time;
418 { 452 {
419 return Fcons (make_number (time >> 16), 453 return Fcons (make_number (time >> 16),
510 544
511 defsubr (&Sdirectory_files); 545 defsubr (&Sdirectory_files);
512 defsubr (&Sfile_name_completion); 546 defsubr (&Sfile_name_completion);
513 #ifdef VMS 547 #ifdef VMS
514 defsubr (&Sfile_name_all_versions); 548 defsubr (&Sfile_name_all_versions);
549 defsubr (&Sfile_version_limit);
515 #endif /* VMS */ 550 #endif /* VMS */
516 defsubr (&Sfile_name_all_completions); 551 defsubr (&Sfile_name_all_completions);
517 defsubr (&Sfile_attributes); 552 defsubr (&Sfile_attributes);
518 553
519 #ifdef VMS 554 #ifdef VMS