diff --git a/g10/ChangeLog b/g10/ChangeLog index d50246f2b..699d0776c 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,11 +1,3 @@ -2002-10-28 Stefan Bellon - - * build-packet.c (calc_plaintext, do_plaintext): Added filetype - handling for RISC OS' file types. - - * plaintext.c (handle_plaintext) [__riscos__]: Added filetype - handling for RISC OS' file types. - 2002-10-23 Werner Koch * pubkey-enc.c (get_it): Fix segv, test for revoked only when PK diff --git a/g10/build-packet.c b/g10/build-packet.c index a1f93094e..da1cbbe39 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -528,14 +528,7 @@ do_pubkey_enc( IOBUF out, int ctb, PKT_pubkey_enc *enc ) static u32 calc_plaintext( PKT_plaintext *pt ) { -#ifndef __riscos__ return pt->len? (1 + 1 + pt->namelen + 4 + pt->len) : 0; -#else - /* Under RISC OS, we add ",xxx" to the file name in order to - be able to recreate the correct file type on the recipients' - side. Therefore we need 4 bytes more. */ - return pt->len? (1 + 1 + pt->namelen + 4 + pt->len + 4) : 0; -#endif } static int @@ -548,26 +541,9 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt ) write_header(out, ctb, calc_plaintext( pt ) ); iobuf_put(out, pt->mode ); -#ifndef __riscos__ iobuf_put(out, pt->namelen ); for(i=0; i < pt->namelen; i++ ) iobuf_put(out, pt->name[i] ); -#else - /* Under RISC OS, we add ",xxx" to the file name in order to - be able to recreate the correct file type on the recipients' - side. Therefore we need 4 bytes more. */ - iobuf_put(out, pt->namelen + 4); - for(i=0; i < pt->namelen; i++ ) - if( pt->name[i] != '/' ) - iobuf_put(out, pt->name[i] ); - else - iobuf_put(out, '.' ); - i = riscos_get_filetype( iobuf_get_real_fname( pt->buf ) ); - iobuf_put(out, ','); - iobuf_put(out, "0123456789abcdef"[(i >> 8) & 0xf]); - iobuf_put(out, "0123456789abcdef"[(i >> 4) & 0xf]); - iobuf_put(out, "0123456789abcdef"[(i >> 0) & 0xf]); -#endif if( write_32(out, pt->timestamp ) ) rc = G10ERR_WRITE_FILE; diff --git a/g10/plaintext.c b/g10/plaintext.c index ffb8a7053..b12fb0f11 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -25,7 +25,7 @@ #include #include #ifdef HAVE_DOSISH_SYSTEM -# include /* for setmode() */ + #include /* for setmode() */ #endif #include "util.h" @@ -55,9 +55,6 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, int rc = 0; int c; int convert = pt->mode == 't'; -#ifdef __riscos__ - int filetype = 0xfff; -#endif /* create the filename as C string */ if( nooutput ) @@ -78,29 +75,9 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, rc = G10ERR_CREATE_FILE; goto leave; } -#ifdef __riscos__ - /* If there's a ,xxx extension in the embedded filename, - get filetype from it and use it later on */ - filetype = riscos_get_filetype_from_string( pt->name, pt->namelen ); - c = riscos_get_filetype_from_string( fname, strlen(fname) ); - if( c != 0xfff && filetype == 0xfff) - filetype = c; -#endif } else { fname = make_printable_string( pt->name, pt->namelen, 0 ); -#ifdef __riscos__ - /* If there's a ,xxx extension in the embedded filename, - get filetype from it and use it later on, remove ,xxx from - actual filename */ - if( fname[strlen(fname) - 4] == ',' ) { - filetype = riscos_get_filetype_from_string( pt->name, pt->namelen ); - fname[strlen(fname) - 4] = 0; - } - for( c=0; fname[c]; ++c) - if( fname[c] == '.' ) - fname[c] = '/'; -#endif } if( nooutput ) @@ -108,9 +85,9 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, else if( !*fname || (*fname=='-' && !fname[1])) { /* no filename or "-" given; write to stdout */ fp = stdout; -#ifdef HAVE_DOSISH_SYSTEM + #ifdef HAVE_DOSISH_SYSTEM setmode ( fileno(fp) , O_BINARY ); -#endif + #endif } else { while( !overwrite_filep (fname) ) { @@ -136,9 +113,6 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, #endif /* __riscos__ */ goto leave; } -#ifdef __riscos__ - riscos_set_filetype_by_number(fname, filetype); -#endif if( !pt->is_partial ) { /* we have an actual length (which might be zero). */ @@ -153,10 +127,10 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, } if( mfx->md ) md_putc(mfx->md, c ); -#ifndef HAVE_DOSISH_SYSTEM + #ifndef HAVE_DOSISH_SYSTEM if( c == '\r' ) /* convert to native line ending */ continue; /* fixme: this hack might be too simple */ -#endif + #endif if( fp ) { if( putc( c, fp ) == EOF ) { log_error("Error writing to `%s': %s\n", @@ -200,10 +174,10 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, while( (c = iobuf_get(pt->buf)) != -1 ) { if( mfx->md ) md_putc(mfx->md, c ); -#ifndef HAVE_DOSISH_SYSTEM + #ifndef HAVE_DOSISH_SYSTEM if( convert && c == '\r' ) continue; /* fixme: this hack might be too simple */ -#endif + #endif if( fp ) { if( putc( c, fp ) == EOF ) { log_error("Error writing to `%s': %s\n", diff --git a/include/ChangeLog b/include/ChangeLog index 2fb44b8b0..d0394ef69 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,7 +1,3 @@ -2002-10-28 Stefan Bellon - - * util.h [__riscos__]: Added prototypes for new filetype support. - 2002-10-21 Werner Koch * util.h [__CYGWIN32__]: Don't need the registry prototypes. diff --git a/include/util.h b/include/util.h index 7b6c8755d..a053c68be 100644 --- a/include/util.h +++ b/include/util.h @@ -267,9 +267,6 @@ int vasprintf ( char **result, const char *format, va_list args); #include void riscos_global_defaults(void); #define RISCOS_GLOBAL_STATICS(a) const char *__dynamic_da_name = (a); -int riscos_get_filetype_from_string(const char *string, int len); -int riscos_get_filetype(const char *filename); -void riscos_set_filetype_by_number(const char *filename, int type); void riscos_set_filetype(const char *filename, const char *mimetype); pid_t riscos_getpid(void); int riscos_kill(pid_t pid, int sig); diff --git a/util/ChangeLog b/util/ChangeLog index 37f63e80a..368a9a5cd 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,11 +1,7 @@ 2002-10-28 Stefan Bellon * 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. + system from filepath. 2002-10-21 Werner Koch diff --git a/util/riscos.c b/util/riscos.c index a66a05ad3..62e2d0945 100644 --- a/util/riscos.c +++ b/util/riscos.c @@ -39,7 +39,6 @@ #include #undef __UNIXLIB_INTERNALS - /* RISC OS file open descriptor control list */ struct fds_item { @@ -70,6 +69,14 @@ 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 @@ -79,38 +86,6 @@ 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) {