diff --git a/g10/ChangeLog b/g10/ChangeLog index ac1c06a9b..f5775660b 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,12 @@ +2002-06-20 Stefan Bellon + + * g10.c [__riscos__]: Added image file system feature. + + * gpgv.c [__riscos__]: Added image file system feature. + + * photoid.c (show_photos) [__riscos__]: Set RISC OS filetype of + photo id according to MIME type. + 2002-06-19 David Shaw * hkp.c (parse_hkp_index): Don't leak memory when failing out of a diff --git a/g10/g10.c b/g10/g10.c index f56cb619a..6a897bceb 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -30,6 +30,7 @@ #endif #ifdef __riscos__ #include +#include #endif /* __riscos__ */ #define INCLUDED_BY_MAIN_MODULE 1 @@ -875,6 +876,7 @@ main( int argc, char **argv ) #ifdef __riscos__ /* set global RISC OS specific properties */ __riscosify_control = __RISCOSIFY_NO_PROCESS; + __feature_imagefs_is_file = 1; opt.lock_once = 1; #endif /* __riscos__ */ diff --git a/g10/gpgv.c b/g10/gpgv.c index de4b1ba3b..ac7b47887 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -30,6 +30,7 @@ #endif #ifdef __riscos__ #include +#include #endif /* __riscos__ */ #define INCLUDED_BY_MAIN_MODULE 1 @@ -145,6 +146,7 @@ main( int argc, char **argv ) unsigned configlineno; #ifdef __riscos__ __riscosify_control = __RISCOSIFY_NO_PROCESS; + __feature_imagefs_is_file = 1; #endif /* __riscos__ */ log_set_name("gpgv"); diff --git a/g10/photoid.c b/g10/photoid.c index 5fd61fe75..13e4cd1c7 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -273,6 +273,11 @@ void show_photos(const struct user_attribute *attrs, goto fail; } +#ifdef __riscos__ + riscos_set_filetype(spawn->tempfile_in, + image_type_to_string(args.imagetype,2)); +#endif + m_free(name); fwrite(&attrs[i].data[offset],attrs[i].len-offset,1,spawn->tochild); diff --git a/include/ChangeLog b/include/ChangeLog index 8ea0354fb..81c7f9cf0 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2002-06-20 Stefan Bellon + + * util.h [__riscos__]: Added riscos_set_filetype(). + 2002-06-14 David Shaw * util.h: Add pop_strlist() from strgutil.c. diff --git a/include/util.h b/include/util.h index 42af78166..bfc77af91 100644 --- a/include/util.h +++ b/include/util.h @@ -260,6 +260,7 @@ int vasprintf ( char **result, const char *format, va_list args); #ifdef __riscos__ /* needed for strcasecmp() */ #include +void riscos_set_filetype(const char *filename, const char *mimetype); pid_t riscos_getpid(void); int riscos_kill(pid_t pid, int sig); int riscos_access(const char *path, int amode); diff --git a/util/ChangeLog b/util/ChangeLog index ec4a285b9..d4652935c 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2002-06-20 Stefan Bellon + + * riscos.c (riscos_set_filetype_by_number, riscos_set_filetype): + New. Set RISC OS filetype according to MIME type. + 2002-06-14 David Shaw * strgutil.c (pop_strlist): New function to pop the head off of a diff --git a/util/riscos.c b/util/riscos.c index 65b8d10bb..41f645f33 100644 --- a/util/riscos.c +++ b/util/riscos.c @@ -38,6 +38,14 @@ #include #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 */ struct fds_item { @@ -71,9 +79,37 @@ is_read_only(const char *filename) return 0; } +static void +riscos_set_filetype_by_number(const char *filename, int type) +{ + _kernel_swi_regs r; + + r.r[0] = 18; + r.r[1] = (int) filename; + r.r[2] = type; + + if (_kernel_swi(OS_File, &r, &r)) + 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 +riscos_set_filetype(const char *filename, const char *mimetype) +{ + _kernel_swi_regs r; + + r.r[0] = MMM_TYPE_MIME; + r.r[1] = (int) mimetype; + r.r[2] = MMM_TYPE_RISCOS; + + if (_kernel_swi(MimeMap_Translate, &r, &r)) + log_fatal("Can't translate MIME type %s!\n", mimetype); + + riscos_set_filetype_by_number(filename, r.r[3]); +} + pid_t riscos_getpid(void) {