diff options
author | Stefan Bellon <[email protected]> | 2002-10-28 13:26:44 +0000 |
---|---|---|
committer | Stefan Bellon <[email protected]> | 2002-10-28 13:26:44 +0000 |
commit | 557f65836d2ad527840db5ecd5550786db55b244 (patch) | |
tree | 84b6e6392fb4bf2614614634bc7f2a28fd30e2fb /g10/build-packet.c | |
parent | * gnupg.spec.in: Use new path for keyserver helpers, /usr/lib is no longer (diff) | |
download | gnupg-557f65836d2ad527840db5ecd5550786db55b244.tar.gz gnupg-557f65836d2ad527840db5ecd5550786db55b244.zip |
filetype support for RISC OS
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r-- | g10/build-packet.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c index da1cbbe39..a1f93094e 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -528,7 +528,14 @@ 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 @@ -541,9 +548,26 @@ 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; |