]> code.delx.au - gnu-emacs/blobdiff - src/dosfns.c
(x_draw_hollow_cursor): Delay obtaining the frame's DC to avoid
[gnu-emacs] / src / dosfns.c
index 857d16bd9b21babe1c0e0eae5a7404dac886770e..dd958041662bcd21df1e3a46a58f23f02c141cfd 100644 (file)
@@ -38,9 +38,12 @@ Boston, MA 02111-1307, USA.  */
 #include "dosfns.h"
 #include "msdos.h"
 #include "dispextern.h"
+#include "charset.h"
+#include "coding.h"
 #include <dpmi.h>
 #include <go32.h>
 #include <dirent.h>
+#include <sys/vfs.h>
 
 #ifndef __DJGPP_MINOR__
 # define __tb _go32_info_block.linear_address_of_transfer_buffer;
@@ -424,7 +427,10 @@ msdos_stdcolor_idx (const char *name)
     if (strcasecmp (name, vga_colors[i]) == 0)
       return i;
 
-  return FACE_TTY_DEFAULT_COLOR;
+  return
+    strcmp (name, unspecified_fg) == 0 ? FACE_TTY_DEFAULT_FG_COLOR
+    : strcmp (name, unspecified_bg) == 0 ? FACE_TTY_DEFAULT_BG_COLOR
+    : FACE_TTY_DEFAULT_COLOR;
 }
 
 /* Given a color index, return its standard name.  */
@@ -433,9 +439,14 @@ msdos_stdcolor_name (int idx)
 {
   extern Lisp_Object Qunspecified;
 
-  if (idx < 0 || idx >= sizeof (vga_colors) / sizeof (vga_colors[0]))
+  if (idx == FACE_TTY_DEFAULT_FG_COLOR)
+    return build_string (unspecified_fg);
+  else if (idx == FACE_TTY_DEFAULT_BG_COLOR)
+    return build_string (unspecified_bg);
+  else if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0]))
+    return build_string (vga_colors[idx]);
+  else
     return Qunspecified;       /* meaning the default */
-  return build_string (vga_colors[idx]);
 }
 
 /* Support for features that are available when we run in a DOS box
@@ -500,6 +511,32 @@ x_set_title (f, name)
 }
 #endif /* !HAVE_X_WINDOWS */
 \f
+DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
+  "Return storage information about the file system FILENAME is on.\n\
+Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total\n\
+storage of the file system, FREE is the free storage, and AVAIL is the\n\
+storage available to a non-superuser.  All 3 numbers are in bytes.\n\
+If the underlying system call fails, value is nil.")
+  (filename)
+  Lisp_Object filename;
+{
+  struct statfs stfs;
+  Lisp_Object encoded, value;
+
+  CHECK_STRING (filename, 0);
+  filename = Fexpand_file_name (filename, Qnil);
+  encoded = ENCODE_FILE (filename);
+
+  if (statfs (XSTRING (encoded)->data, &stfs))
+    value = Qnil;
+  else
+    value = list3 (make_float ((double) stfs.f_bsize * stfs.f_blocks),
+                  make_float ((double) stfs.f_bsize * stfs.f_bfree),
+                  make_float ((double) stfs.f_bsize * stfs.f_bavail));
+
+  return value;
+}
+\f
 void
 dos_cleanup (void)
 {
@@ -528,6 +565,7 @@ syms_of_dosfns ()
   defsubr (&Smsdos_set_keyboard);
   defsubr (&Sinsert_startup_screen);
   defsubr (&Smsdos_mouse_disable);
+  defsubr (&Sfile_system_info);
 #ifndef HAVE_X_WINDOWS
   defsubr (&Smsdos_mouse_p);
 #endif