1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

filetype support for RISC OS

This commit is contained in:
Stefan Bellon 2002-10-28 13:27:18 +00:00
parent 875363153e
commit 191795d14b
13 changed files with 153 additions and 35 deletions

View file

@ -1,3 +1,12 @@
2002-10-28 Stefan Bellon <sbellon@sbellon.de>
* 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 <wk@gnupg.org>
* secmem.c (lock_pool) [__CYGWIN__]: Don't print secmem warning.

View file

@ -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);
}

View file

@ -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)
{