diff options
| author | Eli Zaretskii | 2000-12-07 14:53:45 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-12-07 14:53:45 +0000 |
| commit | 76a76a577fdec682fb4c05fa611670fe88b84e8c (patch) | |
| tree | 57e4c0d213b2443be0edbf8075e0d0af6f572035 | |
| parent | fc3e23a4b48c917d37d6d3f7a72b297bf56bd23a (diff) | |
| download | emacs-76a76a577fdec682fb4c05fa611670fe88b84e8c.tar.gz emacs-76a76a577fdec682fb4c05fa611670fe88b84e8c.zip | |
(Ffile_system_info): New function.
(syms_of_dosfns): Defsubr it.
| -rw-r--r-- | src/dosfns.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/dosfns.c b/src/dosfns.c index 25aede212ef..dd958041662 100644 --- a/src/dosfns.c +++ b/src/dosfns.c | |||
| @@ -38,9 +38,12 @@ Boston, MA 02111-1307, USA. */ | |||
| 38 | #include "dosfns.h" | 38 | #include "dosfns.h" |
| 39 | #include "msdos.h" | 39 | #include "msdos.h" |
| 40 | #include "dispextern.h" | 40 | #include "dispextern.h" |
| 41 | #include "charset.h" | ||
| 42 | #include "coding.h" | ||
| 41 | #include <dpmi.h> | 43 | #include <dpmi.h> |
| 42 | #include <go32.h> | 44 | #include <go32.h> |
| 43 | #include <dirent.h> | 45 | #include <dirent.h> |
| 46 | #include <sys/vfs.h> | ||
| 44 | 47 | ||
| 45 | #ifndef __DJGPP_MINOR__ | 48 | #ifndef __DJGPP_MINOR__ |
| 46 | # define __tb _go32_info_block.linear_address_of_transfer_buffer; | 49 | # define __tb _go32_info_block.linear_address_of_transfer_buffer; |
| @@ -508,6 +511,32 @@ x_set_title (f, name) | |||
| 508 | } | 511 | } |
| 509 | #endif /* !HAVE_X_WINDOWS */ | 512 | #endif /* !HAVE_X_WINDOWS */ |
| 510 | 513 | ||
| 514 | DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0, | ||
| 515 | "Return storage information about the file system FILENAME is on.\n\ | ||
| 516 | Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total\n\ | ||
| 517 | storage of the file system, FREE is the free storage, and AVAIL is the\n\ | ||
| 518 | storage available to a non-superuser. All 3 numbers are in bytes.\n\ | ||
| 519 | If the underlying system call fails, value is nil.") | ||
| 520 | (filename) | ||
| 521 | Lisp_Object filename; | ||
| 522 | { | ||
| 523 | struct statfs stfs; | ||
| 524 | Lisp_Object encoded, value; | ||
| 525 | |||
| 526 | CHECK_STRING (filename, 0); | ||
| 527 | filename = Fexpand_file_name (filename, Qnil); | ||
| 528 | encoded = ENCODE_FILE (filename); | ||
| 529 | |||
| 530 | if (statfs (XSTRING (encoded)->data, &stfs)) | ||
| 531 | value = Qnil; | ||
| 532 | else | ||
| 533 | value = list3 (make_float ((double) stfs.f_bsize * stfs.f_blocks), | ||
| 534 | make_float ((double) stfs.f_bsize * stfs.f_bfree), | ||
| 535 | make_float ((double) stfs.f_bsize * stfs.f_bavail)); | ||
| 536 | |||
| 537 | return value; | ||
| 538 | } | ||
| 539 | |||
| 511 | void | 540 | void |
| 512 | dos_cleanup (void) | 541 | dos_cleanup (void) |
| 513 | { | 542 | { |
| @@ -536,6 +565,7 @@ syms_of_dosfns () | |||
| 536 | defsubr (&Smsdos_set_keyboard); | 565 | defsubr (&Smsdos_set_keyboard); |
| 537 | defsubr (&Sinsert_startup_screen); | 566 | defsubr (&Sinsert_startup_screen); |
| 538 | defsubr (&Smsdos_mouse_disable); | 567 | defsubr (&Smsdos_mouse_disable); |
| 568 | defsubr (&Sfile_system_info); | ||
| 539 | #ifndef HAVE_X_WINDOWS | 569 | #ifndef HAVE_X_WINDOWS |
| 540 | defsubr (&Smsdos_mouse_p); | 570 | defsubr (&Smsdos_mouse_p); |
| 541 | #endif | 571 | #endif |