aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog9
-rw-r--r--util/fileutil.c6
-rw-r--r--util/riscos.c48
3 files changed, 46 insertions, 17 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 5d4cb7de9..37f63e80a 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,12 @@
+2002-10-28 Stefan Bellon <[email protected]>
+
+ * fileutil.c (make_basename) [__riscos__]: Cut off RISC OS' filing
+ systems from filepath.
+
+ * riscos.c (riscos_get_filetype_from_string, riscos_get_filetype):
+ Added.
+ (riscos_set_filetype_by_number): Made public.
+
2002-10-21 Werner Koch <[email protected]>
* secmem.c (lock_pool) [__CYGWIN__]: Don't print secmem warning.
diff --git a/util/fileutil.c b/util/fileutil.c
index b63bbd3b0..b7e7f233b 100644
--- a/util/fileutil.c
+++ b/util/fileutil.c
@@ -44,10 +44,12 @@ make_basename(const char *filepath)
char *p;
if ( !(p=strrchr(filepath, DIRSEP_C)) )
- #ifdef HAVE_DRIVE_LETTERS
+#ifdef HAVE_DRIVE_LETTERS
if ( !(p=strrchr(filepath, '\\')) )
if ( !(p=strrchr(filepath, ':')) )
- #endif
+#elif defined(__riscos__)
+ if ( !(p=strrchr(filepath, ':')) )
+#endif
{
return m_strdup(filepath);
}
diff --git a/util/riscos.c b/util/riscos.c
index c64da3751..a66a05ad3 100644
--- a/util/riscos.c
+++ b/util/riscos.c
@@ -36,15 +36,9 @@
#define __UNIXLIB_INTERNALS
#include <unixlib/unix.h>
+#include <unixlib/swiparams.h>
#undef __UNIXLIB_INTERNALS
-/* RISC OS specific defines that are not yet in UnixLib */
-
-#define MimeMap_Translate 0x50B00
-#define MMM_TYPE_RISCOS 0
-#define MMM_TYPE_RISCOS_STRING 1
-#define MMM_TYPE_MIME 2
-#define MMM_TYPE_DOT_EXTN 3
/* RISC OS file open descriptor control list */
@@ -76,14 +70,6 @@ is_read_only(const char *filename)
return 0;
}
-static void
-riscos_set_filetype_by_number(const char *filename, int type)
-{
- if (_swix(OS_File, _INR(0,2), 18, filename, type))
- log_fatal("Can't set filetype for file %s!\n"
- "Is the file on a read-only file system?\n", filename);
-}
-
/* exported RISC OS functions */
void
@@ -93,6 +79,38 @@ riscos_global_defaults(void)
__feature_imagefs_is_file = 1;
}
+int
+riscos_get_filetype_from_string(const char *string, int len)
+{
+ int result = 0xfff;
+
+ if (string[len - 4] != ',')
+ return 0xfff;
+
+ sscanf(string+len-3, "%3x", &result);
+
+ return result;
+}
+
+int
+riscos_get_filetype(const char *filename)
+{
+ int result;
+
+ if (_swix(OS_File, _INR(0,1) | _OUT(6), 23, filename, &result))
+ log_fatal("Can't get filetype for file %s!\n", filename);
+
+ return result;
+}
+
+void
+riscos_set_filetype_by_number(const char *filename, int type)
+{
+ if (_swix(OS_File, _INR(0,2), 18, filename, type))
+ log_fatal("Can't set filetype for file %s!\n"
+ "Is the file on a read-only file system?\n", filename);
+}
+
void
riscos_set_filetype(const char *filename, const char *mimetype)
{