mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Applied Stefan's patches to support RISCOS.
This commit is contained in:
parent
aa1514852a
commit
23589ae0a2
1
AUTHORS
1
AUTHORS
@ -45,6 +45,7 @@ R
|
||||
g10/free-packet.c, g10/mdfilter.c, g10/plaintext.c, util/iobuf.c)
|
||||
|
||||
Stefan Bellon <sbellon@sbellon.de> Assignment
|
||||
(All patches to support RISCOS)
|
||||
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Translations [id]
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-08-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac: Create g10defs.h with EXTSEP_S et al.
|
||||
|
||||
2001-08-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac (VERSION,PACKAGE): Fixed quoting.
|
||||
|
3
NEWS
3
NEWS
@ -21,6 +21,9 @@
|
||||
|
||||
* RSA key generation.
|
||||
|
||||
* Merged Stefan's patches for RISCOS in. See comments in
|
||||
scripts/build-riscos.
|
||||
|
||||
|
||||
Noteworthy changes in version 1.0.6 (2001-05-29)
|
||||
------------------------------------------------
|
||||
|
@ -1,3 +1,18 @@
|
||||
2001-08-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Applied patches from Stefan Bellon <sbellon@sbellon.de> to support
|
||||
the RISCOS. Nearly all of these patches are identified by the
|
||||
__riscos__ macro.
|
||||
* blowfish.c, twofish.c: Added pragmas for use with a Norcraft
|
||||
compiler.
|
||||
* dynload.c, md5.c, rmd160.c, sha1.c: Minor patches for RISCOS.
|
||||
* rndriscos.c: New.
|
||||
* rnd-internal.h: Added prototype.
|
||||
* random.c (fast_random_poll): Use '#if defined' instead of just
|
||||
'defined'; needed for RISCOS.
|
||||
* primegen.c (gen_prime): count? are now ints for consistence
|
||||
with is_prime().
|
||||
|
||||
2001-08-08 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* rndw32.c (gather_random): Use toolhelp in addition to the NT
|
||||
|
@ -502,7 +502,10 @@ selftest(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __riscos__
|
||||
/* need to switch off CSE optimisation for Norcroft C (Acorn/Pace) */
|
||||
#pragma no_optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static int
|
||||
do_bf_setkey( BLOWFISH_context *c, byte *key, unsigned keylen )
|
||||
@ -587,6 +590,10 @@ do_bf_setkey( BLOWFISH_context *c, byte *key, unsigned keylen )
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __riscos__
|
||||
#pragma optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static int
|
||||
bf_setkey( BLOWFISH_context *c, byte *key, unsigned keylen )
|
||||
{
|
||||
|
@ -178,10 +178,10 @@ register_cipher_extension( const char *mainpgm, const char *fname )
|
||||
if( !mainpgm_path && mainpgm && *mainpgm )
|
||||
mainpgm_path = m_strdup(mainpgm);
|
||||
#endif
|
||||
if( *fname != '/' ) { /* do tilde expansion etc */
|
||||
if( *fname != DIRSEP_C ) { /* do tilde expansion etc */
|
||||
char *tmp;
|
||||
|
||||
if( strchr(fname, '/') )
|
||||
if( strchr(fname, DIRSEP_C) )
|
||||
tmp = make_filename(fname, NULL);
|
||||
else
|
||||
tmp = make_filename(GNUPG_LIBDIR, fname, NULL);
|
||||
@ -392,7 +392,13 @@ load_extension( EXTLIST el )
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __riscos__
|
||||
typedef
|
||||
const char *(*DIGESTS_CAST)(int, size_t*,byte**, int*, int*,
|
||||
void (**)(void*),
|
||||
void (**)(void*,byte*,size_t),
|
||||
void (**)(void*),byte *(**)(void*));
|
||||
#endif /* __riscos__ */
|
||||
|
||||
int
|
||||
enum_gnupgext_digests( void **enum_context,
|
||||
@ -435,7 +441,11 @@ enum_gnupgext_digests( void **enum_context,
|
||||
if( vers != 1 || class != 10 )
|
||||
continue;
|
||||
inner_loop:
|
||||
#ifndef __riscos__
|
||||
*r_get_info = ctx->sym;
|
||||
#else /* __riscos__ */
|
||||
*r_get_info = (DIGESTS_CAST) ctx->sym;
|
||||
#endif /* __riscos__ */
|
||||
while( (sym = (*r->enumfunc)(11, &ctx->seq2, &class, &vers)) ) {
|
||||
if( vers != 1 || class != 11 )
|
||||
continue;
|
||||
@ -451,6 +461,14 @@ enum_gnupgext_digests( void **enum_context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __riscos__
|
||||
typedef
|
||||
const char *(*CIPHERS_CAST)(int, size_t*, size_t*, size_t*,
|
||||
int (**)( void *, byte *, unsigned),
|
||||
void (**)( void *, byte *, byte *),
|
||||
void (**)( void *, byte *, byte *));
|
||||
#endif /* __riscos__ */
|
||||
|
||||
const char *
|
||||
enum_gnupgext_ciphers( void **enum_context, int *algo,
|
||||
size_t *keylen, size_t *blocksize, size_t *contextsize,
|
||||
@ -495,7 +513,11 @@ enum_gnupgext_ciphers( void **enum_context, int *algo,
|
||||
if( vers != 1 || class != 20 )
|
||||
continue;
|
||||
inner_loop:
|
||||
#ifndef __riscos__
|
||||
finfo = ctx->sym;
|
||||
#else /* __riscos__ */
|
||||
finfo = (CIPHERS_CAST) ctx->sym;
|
||||
#endif /* __riscos__ */
|
||||
while( (sym = (*r->enumfunc)(21, &ctx->seq2, &class, &vers)) ) {
|
||||
const char *algname;
|
||||
if( vers != 1 || class != 21 )
|
||||
@ -516,6 +538,19 @@ enum_gnupgext_ciphers( void **enum_context, int *algo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef __riscos__
|
||||
typedef
|
||||
const char *(*PUBKEYS_CAST)(int, int *, int *, int *, int *, int *,
|
||||
int (**)(int, unsigned, MPI *, MPI **),
|
||||
int (**)(int, MPI *),
|
||||
int (**)(int, MPI *, MPI , MPI *),
|
||||
int (**)(int, MPI *, MPI *, MPI *),
|
||||
int (**)(int, MPI *, MPI , MPI *),
|
||||
int (**)(int, MPI , MPI *, MPI *,
|
||||
int (*)(void*,MPI), void *),
|
||||
unsigned (**)( int , MPI *));
|
||||
#endif /* __riscos__ */
|
||||
|
||||
const char *
|
||||
enum_gnupgext_pubkeys( void **enum_context, int *algo,
|
||||
int *npkey, int *nskey, int *nenc, int *nsig, int *use,
|
||||
@ -568,7 +603,11 @@ enum_gnupgext_pubkeys( void **enum_context, int *algo,
|
||||
if( vers != 1 || class != 30 )
|
||||
continue;
|
||||
inner_loop:
|
||||
#ifndef __riscos__
|
||||
finfo = ctx->sym;
|
||||
#else /* __riscos__ */
|
||||
finfo = (PUBKEYS_CAST) ctx->sym;
|
||||
#endif /* __riscos__ */
|
||||
while( (sym = (*r->enumfunc)(31, &ctx->seq2, &class, &vers)) ) {
|
||||
const char *algname;
|
||||
if( vers != 1 || class != 31 )
|
||||
|
@ -401,7 +401,11 @@ gnupgext_enum_func( int what, int *sequence, int *class, int *vers )
|
||||
*vers = func_table[i].version;
|
||||
switch( *class ) {
|
||||
case 11: case 21: case 31: ret = &func_table[i].value; break;
|
||||
#ifndef __riscos__
|
||||
default: ret = func_table[i].func; break;
|
||||
#else /* __riscos__ */
|
||||
default: ret = (void *) func_table[i].func; break;
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
i++;
|
||||
} while( what && what != *class );
|
||||
|
@ -298,7 +298,7 @@ gen_prime( unsigned nbits, int secret, int randomlevel )
|
||||
MPI prime, ptest, pminus1, val_2, val_3, result;
|
||||
int i;
|
||||
unsigned x, step;
|
||||
unsigned count1, count2;
|
||||
int count1, count2;
|
||||
int *mods;
|
||||
|
||||
if( 0 && DBG_CIPHER )
|
||||
|
@ -26,5 +26,6 @@ void rndw32_constructor(void);
|
||||
void rndos2_constructor(void);
|
||||
void rndatari_constructor(void);
|
||||
void rndmvs_constructor(void);
|
||||
void rndriscos_constructor(void);
|
||||
|
||||
#endif /*G10_RAND_INTERNAL_H*/
|
||||
|
@ -568,19 +568,19 @@ fast_random_poll()
|
||||
}
|
||||
|
||||
/* fall back to the generic function */
|
||||
#if HAVE_GETHRTIME
|
||||
#ifdef HAVE_GETHRTIME
|
||||
{ hrtime_t tv;
|
||||
tv = gethrtime();
|
||||
add_randomness( &tv, sizeof(tv), 1 );
|
||||
}
|
||||
#elif HAVE_GETTIMEOFDAY
|
||||
#elif defined (HAVE_GETTIMEOFDAY)
|
||||
{ struct timeval tv;
|
||||
if( gettimeofday( &tv, NULL ) )
|
||||
BUG();
|
||||
add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), 1 );
|
||||
add_randomness( &tv.tv_usec, sizeof(tv.tv_usec), 1 );
|
||||
}
|
||||
#elif HAVE_CLOCK_GETTIME
|
||||
#elif defined (HAVE_CLOCK_GETTIME)
|
||||
{ struct timespec tv;
|
||||
if( clock_gettime( CLOCK_REALTIME, &tv ) == -1 )
|
||||
BUG();
|
||||
|
@ -625,7 +625,11 @@ gnupgext_enum_func( int what, int *sequence, int *class, int *vers )
|
||||
ret = &func_table[i].value;
|
||||
break;
|
||||
default:
|
||||
#ifndef __riscos__
|
||||
ret = func_table[i].func;
|
||||
#else /* __riscos__ */
|
||||
ret = (void *) func_table[i].func;
|
||||
#endif /* __riscos__ */
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
136
cipher/rndriscos.c
Normal file
136
cipher/rndriscos.c
Normal file
@ -0,0 +1,136 @@
|
||||
/* rndriscos.c - raw random number for RISC OS
|
||||
* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <kernel.h>
|
||||
#include <sys/swis.h>
|
||||
#include "util.h"
|
||||
#include "dynload.h"
|
||||
|
||||
static int init_device(void);
|
||||
static int gather_random(void (*add)(const void*, size_t, int), int requester,
|
||||
size_t length, int level);
|
||||
|
||||
#define CryptRandom_Byte 0x51980
|
||||
|
||||
/****************
|
||||
* Used to load the CryptRandom module if it isn't already loaded
|
||||
*/
|
||||
static int
|
||||
init_device(void)
|
||||
{
|
||||
_kernel_swi_regs r;
|
||||
|
||||
r.r[0] = 18;
|
||||
r.r[1] = (int) "CryptRandom";
|
||||
if (_kernel_swi(OS_Module, &r, &r)) {
|
||||
r.r[0] = 1;
|
||||
r.r[1] = (int) "GnuPG:CryptRand";
|
||||
if (_kernel_swi(OS_Module, &r, &r))
|
||||
g10_log_fatal("Can't load module CryptRandom.\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
*/
|
||||
static int
|
||||
gather_random(void (*add)(const void*, size_t, int), int requester,
|
||||
size_t length, int level)
|
||||
{
|
||||
static int initialized = 0;
|
||||
int n;
|
||||
byte buffer[768];
|
||||
_kernel_swi_regs r;
|
||||
_kernel_oserror *e;
|
||||
|
||||
if (!initialized)
|
||||
initialized = init_device();
|
||||
|
||||
while (length) {
|
||||
int nbytes = length < sizeof(buffer) ? length : sizeof(buffer);
|
||||
|
||||
for (n = 0; n < nbytes; n++) {
|
||||
if (e = _kernel_swi(CryptRandom_Byte, &r, &r))
|
||||
g10_log_fatal("CryptRandom module isn't working as expected!\n");
|
||||
buffer[n] = (byte) r.r[0];
|
||||
}
|
||||
|
||||
(*add)(buffer, n, requester);
|
||||
length -= n;
|
||||
}
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
return 0; /* success */
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef IS_MODULE
|
||||
static
|
||||
#endif
|
||||
const char * const gnupgext_version = "RNDRISCOS ($Revision$)";
|
||||
|
||||
static struct {
|
||||
int class;
|
||||
int version;
|
||||
void *func;
|
||||
} func_table[] = {
|
||||
{ 40, 1, (void *) gather_random },
|
||||
};
|
||||
|
||||
|
||||
#ifndef IS_MODULE
|
||||
static
|
||||
#endif
|
||||
void *
|
||||
gnupgext_enum_func( int what, int *sequence, int *class, int *vers )
|
||||
{
|
||||
void *ret;
|
||||
int i = *sequence;
|
||||
|
||||
do {
|
||||
if ( i >= DIM(func_table) || i < 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
*class = func_table[i].class;
|
||||
*vers = func_table[i].version;
|
||||
ret = func_table[i].func;
|
||||
i++;
|
||||
} while ( what && what != *class );
|
||||
|
||||
*sequence = i;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef IS_MODULE
|
||||
void
|
||||
rndriscos_constructor(void)
|
||||
{
|
||||
register_internal_cipher_extension( gnupgext_version,
|
||||
gnupgext_enum_func );
|
||||
}
|
||||
#endif
|
||||
|
@ -87,7 +87,7 @@ test_keys( RSA_secret_key *sk, unsigned nbits )
|
||||
|
||||
/****************
|
||||
* Generate a key pair with a key of size NBITS
|
||||
* Returns: 2 structures filles with all needed values
|
||||
* Returns: 2 structures filled with all needed values
|
||||
*/
|
||||
static void
|
||||
generate( RSA_secret_key *sk, unsigned nbits )
|
||||
|
@ -398,7 +398,11 @@ gnupgext_enum_func( int what, int *sequence, int *class, int *vers )
|
||||
ret = &func_table[i].value;
|
||||
break;
|
||||
default:
|
||||
#ifndef __riscos__
|
||||
ret = func_table[i].func;
|
||||
#else /* __riscos__ */
|
||||
ret = (void *) func_table[i].func;
|
||||
#endif /* __riscos__ */
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
@ -562,6 +562,11 @@ burn_stack (int bytes)
|
||||
/* Perform the key setup. Note that this works only with 128- and 256-bit
|
||||
* keys, despite the API that looks like it might support other sizes. */
|
||||
|
||||
#ifdef __riscos__
|
||||
/* need to switch off CSE optimisation for Norcroft C (Acorn/Pace) */
|
||||
#pragma no_optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static int
|
||||
do_twofish_setkey (TWOFISH_context *ctx, const byte *key, unsigned int keylen)
|
||||
{
|
||||
@ -697,6 +702,10 @@ do_twofish_setkey (TWOFISH_context *ctx, const byte *key, unsigned int keylen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __riscos__
|
||||
#pragma optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static int
|
||||
twofish_setkey (TWOFISH_context *ctx, const byte *key, unsigned int keylen)
|
||||
{
|
||||
@ -767,6 +776,11 @@ twofish_setkey (TWOFISH_context *ctx, const byte *key, unsigned int keylen)
|
||||
|
||||
/* Encrypt one block. in and out may be the same. */
|
||||
|
||||
#ifdef __riscos__
|
||||
/* need to switch off CSE optimisation for Norcroft C (Acorn/Pace) */
|
||||
#pragma no_optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static void
|
||||
do_twofish_encrypt (const TWOFISH_context *ctx, byte *out, const byte *in)
|
||||
{
|
||||
@ -799,6 +813,10 @@ do_twofish_encrypt (const TWOFISH_context *ctx, byte *out, const byte *in)
|
||||
OUTUNPACK (3, b, 7);
|
||||
}
|
||||
|
||||
#ifdef __riscos__
|
||||
#pragma optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static void
|
||||
twofish_encrypt (const TWOFISH_context *ctx, byte *out, const byte *in)
|
||||
{
|
||||
@ -808,6 +826,11 @@ twofish_encrypt (const TWOFISH_context *ctx, byte *out, const byte *in)
|
||||
|
||||
/* Decrypt one block. in and out may be the same. */
|
||||
|
||||
#ifdef __riscos__
|
||||
/* need to switch off CSE optimisation for Norcroft C (Acorn/Pace) - bug */
|
||||
#pragma no_optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static void
|
||||
do_twofish_decrypt (const TWOFISH_context *ctx, byte *out, const byte *in)
|
||||
{
|
||||
@ -840,6 +863,10 @@ do_twofish_decrypt (const TWOFISH_context *ctx, byte *out, const byte *in)
|
||||
OUTUNPACK (3, d, 3);
|
||||
}
|
||||
|
||||
#ifdef __riscos__
|
||||
#pragma optimise_cse
|
||||
#endif /* __riscos__ */
|
||||
|
||||
static void
|
||||
twofish_decrypt (const TWOFISH_context *ctx, byte *out, const byte *in)
|
||||
{
|
||||
@ -1093,7 +1120,11 @@ gnupgext_enum_func ( int what, int *sequence, int *class, int *vers )
|
||||
ret = &func_table[i].value;
|
||||
break;
|
||||
default:
|
||||
#ifndef __riscos__
|
||||
ret = func_table[i].func;
|
||||
#else /* __riscos__ */
|
||||
ret = (void *) func_table[i].func;
|
||||
#endif /* __riscos__ */
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
@ -766,6 +766,11 @@ cat >g10defs.tmp <<G10EOF
|
||||
#define GNUPG_HOMEDIR "~/.gnupg"
|
||||
#endif
|
||||
#endif
|
||||
/* those are here to be redefined by handcrafted g10defs.h */
|
||||
#define DIRSEP_C '/'
|
||||
#define EXTSEP_C '.'
|
||||
#define DIRSEP_S "/"
|
||||
#define EXTSEP_S "."
|
||||
G10EOF
|
||||
cat mpi/mpi-asm-defs.h >>g10defs.tmp
|
||||
if cmp -s g10defs.h g10defs.tmp 2>/dev/null; then
|
||||
|
@ -366,11 +366,10 @@ The format of this file is as follows:
|
||||
This is a required parameter.
|
||||
Key-Length: <length-in-bits>
|
||||
Length of the key in bits. Default is 1024.
|
||||
|
||||
Key-Usage: <usage-list>
|
||||
Space or comma delimited list of key usage, allowed values are
|
||||
"encrypt" and "sign". This is used to generate the key flags
|
||||
and must match the algorithm.
|
||||
"encrypt" and "sign". This is used to generate the key flags.
|
||||
Please make sure that the algorithm is capable of this usage.
|
||||
Subkey-Type: <algo-number>|<algo-string>
|
||||
This generates a secondary key. Currently only one subkey
|
||||
can be handled.
|
||||
|
@ -1,3 +1,23 @@
|
||||
2001-08-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Applied patches from Stefan Bellon <sbellon@sbellon.de> to support
|
||||
the RISCOS. Nearly all of these patches are identified by the
|
||||
__riscos__ macro.
|
||||
* compress.c: Added a couple of casts.
|
||||
* g10.c [__riscos__]: Some patches and new options foo-file similar
|
||||
to all foo-fd options.
|
||||
* gpgv.c, openfile.c, ringedit.c, tdbio.c: Minor fixes. Mainly
|
||||
replaced hardcoded path separators with EXTSEP_S like macros.
|
||||
* passprase.c [__riscos__]: Disabled agent stuff
|
||||
* trustdb.c (check_trust): Changed r_trustlevel to signed int to
|
||||
avoid mismatch problems in pkclist.c
|
||||
* pkclist.c (add_ownertrust): Ditto.
|
||||
* plaintext.c (handle_plaintext) [__riscos__]: RPint a note when
|
||||
file can't be created.
|
||||
* options.h [__riscos__]: Use an extern unless included from the
|
||||
main module.
|
||||
* signal.c (got_fatal_signal) [__riscos__]: Close all files.
|
||||
|
||||
2001-08-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* keygen.c (ask_algo): New arg r_usage. Allow for RSA keys.
|
||||
|
@ -73,7 +73,11 @@ do_compress( compress_filter_context_t *zfx, z_stream *zs, int flush, IOBUF a )
|
||||
unsigned n;
|
||||
|
||||
do {
|
||||
#ifndef __riscos__
|
||||
zs->next_out = zfx->outbuf;
|
||||
#else /* __riscos__ */
|
||||
zs->next_out = (Bytef *) zfx->outbuf;
|
||||
#endif /* __riscos__ */
|
||||
zs->avail_out = zfx->outbufsize;
|
||||
if( DBG_FILTER )
|
||||
log_debug("enter deflate: avail_in=%u, avail_out=%u, flush=%d\n",
|
||||
@ -143,7 +147,11 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs,
|
||||
if( zs->avail_in < zfx->inbufsize && refill ) {
|
||||
n = zs->avail_in;
|
||||
if( !n )
|
||||
#ifndef __riscos__
|
||||
zs->next_in = zfx->inbuf;
|
||||
#else /* __riscos__ */
|
||||
zs->next_in = (Bytef *) zfx->inbuf;
|
||||
#endif /* __riscos__ */
|
||||
count = zfx->inbufsize - n;
|
||||
nread = iobuf_read( a, zfx->inbuf + n, count );
|
||||
if( nread == -1 ) nread = 0;
|
||||
@ -201,7 +209,11 @@ compress_filter( void *opaque, int control,
|
||||
zfx->status = 1;
|
||||
}
|
||||
|
||||
#ifndef __riscos__
|
||||
zs->next_out = buf;
|
||||
#else /* __riscos__ */
|
||||
zs->next_out = (Bytef *) buf;
|
||||
#endif /* __riscos__ */
|
||||
zs->avail_out = size;
|
||||
zfx->outbufsize = size; /* needed only for calculation */
|
||||
rc = do_uncompress( zfx, zs, a, ret_len );
|
||||
@ -226,7 +238,11 @@ compress_filter( void *opaque, int control,
|
||||
zfx->status = 2;
|
||||
}
|
||||
|
||||
#ifndef __riscos__
|
||||
zs->next_in = buf;
|
||||
#else /* __riscos__ */
|
||||
zs->next_in = (Bytef *) buf;
|
||||
#endif /* __riscos__ */
|
||||
zs->avail_in = size;
|
||||
rc = do_compress( zfx, zs, Z_NO_FLUSH, a );
|
||||
}
|
||||
@ -238,7 +254,11 @@ compress_filter( void *opaque, int control,
|
||||
m_free(zfx->outbuf); zfx->outbuf = NULL;
|
||||
}
|
||||
else if( zfx->status == 2 ) {
|
||||
#ifndef __riscos__
|
||||
zs->next_in = buf;
|
||||
#else /* __riscos__ */
|
||||
zs->next_in = (Bytef *) buf;
|
||||
#endif /* __riscos__ */
|
||||
zs->avail_in = 0;
|
||||
do_compress( zfx, zs, Z_FINISH, a );
|
||||
deflateEnd(zs);
|
||||
|
86
g10/g10.c
86
g10/g10.c
@ -28,8 +28,11 @@
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#include <fcntl.h> /* for setmode() */
|
||||
#endif
|
||||
#ifdef __riscos__
|
||||
#include <unixlib/local.h>
|
||||
#endif /* __riscos__ */
|
||||
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "packet.h"
|
||||
#include "iobuf.h"
|
||||
#include "memory.h"
|
||||
@ -125,6 +128,9 @@ enum cmd_and_opt_values { aNull = 0,
|
||||
oDebug,
|
||||
oDebugAll,
|
||||
oStatusFD,
|
||||
#ifdef __riscos__
|
||||
oStatusFile,
|
||||
#endif /* __riscos__ */
|
||||
oNoComment,
|
||||
oNoVersion,
|
||||
oEmitVersion,
|
||||
@ -138,7 +144,13 @@ enum cmd_and_opt_values { aNull = 0,
|
||||
oDigestAlgo,
|
||||
oCompressAlgo,
|
||||
oPasswdFD,
|
||||
#ifdef __riscos__
|
||||
oPasswdFile,
|
||||
#endif /* __riscos__ */
|
||||
oCommandFD,
|
||||
#ifdef __riscos__
|
||||
oCommandFile,
|
||||
#endif /* __riscos__ */
|
||||
oQuickRandom,
|
||||
oNoVerbose,
|
||||
oTrustDBName,
|
||||
@ -179,6 +191,9 @@ enum cmd_and_opt_values { aNull = 0,
|
||||
oEncryptTo,
|
||||
oNoEncryptTo,
|
||||
oLoggerFD,
|
||||
#ifdef __riscos__
|
||||
oLoggerFile,
|
||||
#endif /* __riscos__ */
|
||||
oUtf8Strings,
|
||||
oNoUtf8Strings,
|
||||
oDisableCipherAlgo,
|
||||
@ -306,6 +321,9 @@ static ARGPARSE_OPTS opts[] = {
|
||||
{ oDebug, "debug" ,4|16, "@"},
|
||||
{ oDebugAll, "debug-all" ,0, "@"},
|
||||
{ oStatusFD, "status-fd" ,1, N_("|FD|write status info to this FD") },
|
||||
#ifdef __riscos__
|
||||
{ oStatusFile, "status-file" ,2, N_("|[file]|write status info to file") },
|
||||
#endif /* __riscos__ */
|
||||
{ oNoComment, "no-comment", 0, "@"},
|
||||
{ oCompletesNeeded, "completes-needed", 1, "@"},
|
||||
{ oMarginalsNeeded, "marginals-needed", 1, "@"},
|
||||
@ -344,7 +362,13 @@ static ARGPARSE_OPTS opts[] = {
|
||||
{ aPipeMode, "pipemode", 0, "@" },
|
||||
{ oKOption, NULL, 0, "@"},
|
||||
{ oPasswdFD, "passphrase-fd",1, "@" },
|
||||
#ifdef __riscos__
|
||||
{ oPasswdFile, "passphrase-file",2, "@" },
|
||||
#endif /* __riscos__ */
|
||||
{ oCommandFD, "command-fd",1, "@" },
|
||||
#ifdef __riscos__
|
||||
{ oCommandFile, "command-file",2, "@" },
|
||||
#endif /* __riscos__ */
|
||||
{ oQuickRandom, "quick-random", 0, "@"},
|
||||
{ oNoVerbose, "no-verbose", 0, "@"},
|
||||
{ oTrustDBName, "trustdb-name", 2, "@" },
|
||||
@ -379,6 +403,9 @@ static ARGPARSE_OPTS opts[] = {
|
||||
{ oLockMultiple, "lock-multiple", 0, "@" },
|
||||
{ oLockNever, "lock-never", 0, "@" },
|
||||
{ oLoggerFD, "logger-fd",1, "@" },
|
||||
#ifdef __riscos__
|
||||
{ oLoggerFile, "logger-file",2, "@" },
|
||||
#endif /* __riscos__ */
|
||||
{ oUseEmbeddedFilename, "use-embedded-filename", 0, "@" },
|
||||
{ oUtf8Strings, "utf8-strings", 0, "@" },
|
||||
{ oNoUtf8Strings, "no-utf8-strings", 0, "@" },
|
||||
@ -454,7 +481,11 @@ strusage( int level )
|
||||
break;
|
||||
|
||||
case 31: p = "\nHome: "; break;
|
||||
#ifndef __riscos__
|
||||
case 32: p = opt.homedir; break;
|
||||
#else /* __riscos__ */
|
||||
case 32: p = make_filename(opt.homedir, NULL); break;
|
||||
#endif /* __riscos__ */
|
||||
case 33: p = _("\nSupported algorithms:\n"); break;
|
||||
case 34:
|
||||
if( !ciphers )
|
||||
@ -627,6 +658,11 @@ main( int argc, char **argv )
|
||||
#ifdef USE_SHM_COPROCESSING
|
||||
ulong requested_shm_size=0;
|
||||
#endif
|
||||
#ifdef __riscos__
|
||||
/* set global RISC OS specific properties */
|
||||
__riscosify_control = __RISCOSIFY_NO_PROCESS;
|
||||
opt.lock_once = 1;
|
||||
#endif /* __riscos__ */
|
||||
|
||||
trap_unaligned();
|
||||
secmem_set_flags( secmem_get_flags() | 2 ); /* suspend warnings */
|
||||
@ -822,10 +858,21 @@ main( int argc, char **argv )
|
||||
case oStatusFD:
|
||||
set_status_fd( iobuf_translate_file_handle (pargs.r.ret_int, 1) );
|
||||
break;
|
||||
#ifdef __riscos__
|
||||
case oStatusFile:
|
||||
set_status_fd( iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 1), 1) );
|
||||
break;
|
||||
#endif /* __riscos__ */
|
||||
case oLoggerFD:
|
||||
log_set_logfile( NULL,
|
||||
iobuf_translate_file_handle (pargs.r.ret_int, 1) );
|
||||
break;
|
||||
#ifdef __riscos__
|
||||
case oLoggerFile:
|
||||
log_set_logfile( NULL,
|
||||
iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 1), 1) );
|
||||
break;
|
||||
#endif /* __riscos__ */
|
||||
case oWithFingerprint:
|
||||
with_fpr=1; /*fall thru*/
|
||||
case oFingerprint: opt.fingerprint++; break;
|
||||
@ -876,8 +923,12 @@ main( int argc, char **argv )
|
||||
case aListSecretKeys: set_cmd( &cmd, aListSecretKeys); break;
|
||||
case oAlwaysTrust: opt.always_trust = 1; break;
|
||||
case oLoadExtension:
|
||||
#ifndef __riscos__
|
||||
register_cipher_extension(orig_argc? *orig_argv:NULL,
|
||||
pargs.r.ret_str);
|
||||
#else /* __riscos__ */
|
||||
not_implemented("load-extension");
|
||||
#endif /* __riscos__ */
|
||||
break;
|
||||
case oRFC1991:
|
||||
opt.rfc1991 = 1;
|
||||
@ -906,11 +957,15 @@ main( int argc, char **argv )
|
||||
case oEmuMDEncodeBug: opt.emulate_bugs |= EMUBUG_MDENCODE; break;
|
||||
case oCompressSigs: opt.compress_sigs = 1; break;
|
||||
case oRunAsShmCP:
|
||||
#ifndef __riscos__
|
||||
#ifndef USE_SHM_COPROCESSING
|
||||
/* not possible in the option file,
|
||||
* but we print the warning here anyway */
|
||||
log_error("shared memory coprocessing is not available\n");
|
||||
#endif
|
||||
#else /* __riscos__ */
|
||||
not_implemented("run-as-shm-coprocess");
|
||||
#endif /* __riscos__ */
|
||||
break;
|
||||
case oSetFilename: opt.set_filename = pargs.r.ret_str; break;
|
||||
case oSetPolicyURL: opt.set_policy_url = pargs.r.ret_str; break;
|
||||
@ -941,9 +996,19 @@ main( int argc, char **argv )
|
||||
case oPasswdFD:
|
||||
pwfd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
|
||||
break;
|
||||
#ifdef __riscos__
|
||||
case oPasswdFile:
|
||||
pwfd = iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 0), 0);
|
||||
break;
|
||||
#endif /* __riscos__ */
|
||||
case oCommandFD:
|
||||
opt.command_fd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
|
||||
break;
|
||||
#ifdef __riscos__
|
||||
case oCommandFile:
|
||||
opt.command_fd = iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 0), 0);
|
||||
break;
|
||||
#endif /* __riscos__ */
|
||||
case oCipherAlgo: def_cipher_string = m_strdup(pargs.r.ret_str); break;
|
||||
case oDigestAlgo: def_digest_string = m_strdup(pargs.r.ret_str); break;
|
||||
case oNoSecmemWarn: secmem_set_flags( secmem_get_flags() | 1 ); break;
|
||||
@ -956,7 +1021,13 @@ main( int argc, char **argv )
|
||||
case oEscapeFrom: opt.escape_from = 1; break;
|
||||
case oLockOnce: opt.lock_once = 1; break;
|
||||
case oLockNever: disable_dotlock(); break;
|
||||
case oLockMultiple: opt.lock_once = 0; break;
|
||||
case oLockMultiple:
|
||||
opt.lock_once = 0;
|
||||
#ifdef __riscos__
|
||||
not_implemented("lock-multiple");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case oKeyServer: opt.keyserver_name = pargs.r.ret_str; break;
|
||||
case oNotation: add_notation_data( pargs.r.ret_str ); break;
|
||||
case oUtf8Strings: utf8_strings = 1; break;
|
||||
@ -1098,6 +1169,13 @@ main( int argc, char **argv )
|
||||
if (preference_list && keygen_set_std_prefs (preference_list))
|
||||
log_error(_("invalid preferences\n"));
|
||||
|
||||
#ifdef __riscos__
|
||||
if (opt.use_agent) {
|
||||
opt.use_agent = 0;
|
||||
not_implemented ("use-agent");
|
||||
}
|
||||
#endif
|
||||
|
||||
if( log_get_errorcount(0) )
|
||||
g10_exit(2);
|
||||
|
||||
@ -1141,11 +1219,11 @@ main( int argc, char **argv )
|
||||
&& !(cmd == aKMode && argc == 2 ) ) {
|
||||
|
||||
if( !sec_nrings || default_keyring ) /* add default secret rings */
|
||||
add_keyblock_resource("secring.gpg", 0, 1);
|
||||
add_keyblock_resource("secring" EXTSEP_S "gpg", 0, 1);
|
||||
for(sl = sec_nrings; sl; sl = sl->next )
|
||||
add_keyblock_resource( sl->d, 0, 1 );
|
||||
if( !nrings || default_keyring ) /* add default ring */
|
||||
add_keyblock_resource("pubring.gpg", 0, 0);
|
||||
add_keyblock_resource("pubring" EXTSEP_S "gpg", 0, 0);
|
||||
for(sl = nrings; sl; sl = sl->next )
|
||||
add_keyblock_resource( sl->d, 0, 0 );
|
||||
}
|
||||
|
10
g10/gpgv.c
10
g10/gpgv.c
@ -28,8 +28,11 @@
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#include <fcntl.h> /* for setmode() */
|
||||
#endif
|
||||
#ifdef __riscos__
|
||||
#include <unixlib/local.h>
|
||||
#endif /* __riscos__ */
|
||||
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "packet.h"
|
||||
#include "iobuf.h"
|
||||
#include "memory.h"
|
||||
@ -136,6 +139,9 @@ main( int argc, char **argv )
|
||||
STRLIST sl;
|
||||
STRLIST nrings=NULL;
|
||||
unsigned configlineno;
|
||||
#ifdef __riscos__
|
||||
__riscosify_control = __RISCOSIFY_NO_PROCESS;
|
||||
#endif /* __riscos__ */
|
||||
|
||||
log_set_name("gpgv");
|
||||
init_signals();
|
||||
@ -183,7 +189,7 @@ main( int argc, char **argv )
|
||||
set_packet_list_mode(1);
|
||||
|
||||
if( !nrings ) /* no keyring given: use default one */
|
||||
add_keyblock_resource("trustedkeys.gpg", 0, 0);
|
||||
add_keyblock_resource("trustedkeys" EXTSEP_S "gpg", 0, 0);
|
||||
for(sl = nrings; sl; sl = sl->next )
|
||||
add_keyblock_resource( sl->d, 0, 0 );
|
||||
|
||||
|
@ -39,10 +39,10 @@
|
||||
#ifdef USE_ONLY_8DOT3
|
||||
#define SKELEXT ".skl"
|
||||
#else
|
||||
#define SKELEXT ".skel"
|
||||
#define SKELEXT EXTSEP_S "skel"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRIVE_LETTERS
|
||||
#if defined (HAVE_DRIVE_LETTERS) || defined (__riscos__)
|
||||
#define CMP_FILENAME(a,b) ascii_strcasecmp( (a), (b) )
|
||||
#else
|
||||
#define CMP_FILENAME(a,b) strcmp( (a), (b) )
|
||||
@ -102,15 +102,15 @@ make_outfile_name( const char *iname )
|
||||
return m_strdup("-");
|
||||
|
||||
n = strlen(iname);
|
||||
if( n > 4 && ( !CMP_FILENAME(iname+n-4,".gpg")
|
||||
|| !CMP_FILENAME(iname+n-4,".pgp")
|
||||
|| !CMP_FILENAME(iname+n-4,".sig")
|
||||
|| !CMP_FILENAME(iname+n-4,".asc") ) ) {
|
||||
if( n > 4 && ( !CMP_FILENAME(iname+n-4, EXTSEP_S "gpg")
|
||||
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "pgp")
|
||||
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "sig")
|
||||
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "asc") ) ) {
|
||||
char *buf = m_strdup( iname );
|
||||
buf[n-4] = 0;
|
||||
return buf;
|
||||
}
|
||||
else if( n > 5 && !CMP_FILENAME(iname+n-5,".sign") ) {
|
||||
else if( n > 5 && !CMP_FILENAME(iname+n-5, EXTSEP_S "sign") ) {
|
||||
char *buf = m_strdup( iname );
|
||||
buf[n-5] = 0;
|
||||
return buf;
|
||||
@ -217,8 +217,8 @@ open_outfile( const char *iname, int mode, IOBUF *a )
|
||||
strcat( buf, newsfx );
|
||||
#else
|
||||
buf = m_alloc(strlen(iname)+4+1);
|
||||
strcpy(stpcpy(buf,iname), mode==1 ? ".asc" :
|
||||
mode==2 ? ".sig" : ".gpg");
|
||||
strcpy(stpcpy(buf,iname), mode==1 ? EXTSEP_S "asc" :
|
||||
mode==2 ? EXTSEP_S "sig" : EXTSEP_S "gpg");
|
||||
#endif
|
||||
name = buf;
|
||||
}
|
||||
@ -262,9 +262,9 @@ open_sigfile( const char *iname )
|
||||
|
||||
if( iname && !(*iname == '-' && !iname[1]) ) {
|
||||
len = strlen(iname);
|
||||
if( len > 4 && ( !strcmp(iname + len - 4, ".sig")
|
||||
|| ( len > 5 && !strcmp(iname + len - 5, ".sign") )
|
||||
|| !strcmp(iname + len - 4, ".asc")) ) {
|
||||
if( len > 4 && ( !strcmp(iname + len - 4, EXTSEP_S "sig")
|
||||
|| ( len > 5 && !strcmp(iname + len - 5, EXTSEP_S "sign") )
|
||||
|| !strcmp(iname + len - 4, EXTSEP_S "asc")) ) {
|
||||
char *buf;
|
||||
buf = m_strdup(iname);
|
||||
buf[len-(buf[len-1]=='n'?5:4)] = 0 ;
|
||||
@ -294,14 +294,14 @@ copy_options_file( const char *destdir )
|
||||
return;
|
||||
|
||||
fname = m_alloc( strlen(datadir) + strlen(destdir) + 15 );
|
||||
strcpy(stpcpy(fname, datadir), "/options" SKELEXT );
|
||||
strcpy(stpcpy(fname, datadir), DIRSEP_S "options" SKELEXT );
|
||||
src = fopen( fname, "r" );
|
||||
if( !src ) {
|
||||
log_error(_("%s: can't open: %s\n"), fname, strerror(errno) );
|
||||
m_free(fname);
|
||||
return;
|
||||
}
|
||||
strcpy(stpcpy(fname, destdir), "/options" );
|
||||
strcpy(stpcpy(fname, destdir), DIRSEP_S "options" );
|
||||
dst = fopen( fname, "w" );
|
||||
if( !dst ) {
|
||||
log_error(_("%s: can't create: %s\n"), fname, strerror(errno) );
|
||||
|
@ -24,7 +24,16 @@
|
||||
|
||||
#undef ENABLE_COMMENT_PACKETS /* don't create comment packets */
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
/* Norcraft can't cope with common symbols */
|
||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
#else
|
||||
#define EXTERN_UNLESS_MAIN_MODULE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct {
|
||||
int verbose;
|
||||
int quiet;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#if !defined(HAVE_DOSISH_SYSTEM) && !defined(__riscos__)
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
@ -64,7 +64,7 @@ enum gpga_protocol_codes {
|
||||
GPGA_PROT_BAD_PASSPHRASE = 0x20005,
|
||||
GPGA_PROT_INVALID_DATA = 0x20006,
|
||||
GPGA_PROT_NOT_IMPLEMENTED= 0x20007,
|
||||
GPGA_PROT_UI_PROBLEM = 0x20008,
|
||||
GPGA_PROT_UI_PROBLEM = 0x20008
|
||||
};
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ read_passphrase_from_fd( int fd )
|
||||
fd_passwd = pw;
|
||||
}
|
||||
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#if !defined(HAVE_DOSISH_SYSTEM) && !defined(__riscos__)
|
||||
static int
|
||||
writen ( int fd, const void *buf, size_t nbytes )
|
||||
{
|
||||
@ -265,7 +265,7 @@ agent_close ( int fd )
|
||||
{
|
||||
close (fd);
|
||||
}
|
||||
#endif /* !HAVE_DOSISH_SYSTEM */
|
||||
#endif /* !HAVE_DOSISH_SYSTEM && !__riscos__ */
|
||||
|
||||
|
||||
/*
|
||||
@ -277,7 +277,7 @@ agent_close ( int fd )
|
||||
static char *
|
||||
agent_get_passphrase ( u32 *keyid, int mode )
|
||||
{
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||
return NULL;
|
||||
#else
|
||||
|
||||
@ -427,7 +427,7 @@ agent_get_passphrase ( u32 *keyid, int mode )
|
||||
void
|
||||
passphrase_clear_cache ( u32 *keyid, int algo )
|
||||
{
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||
return ;
|
||||
#else
|
||||
size_t n;
|
||||
|
@ -418,7 +418,7 @@ add_ownertrust_cb( ulong lid )
|
||||
* Returns: -1 if no ownertrust were added.
|
||||
*/
|
||||
static int
|
||||
add_ownertrust( PKT_public_key *pk, int *quit, unsigned *trustlevel )
|
||||
add_ownertrust( PKT_public_key *pk, int *quit, int *trustlevel )
|
||||
{
|
||||
int rc;
|
||||
unsigned flags = 0;
|
||||
|
@ -105,8 +105,12 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
if( fp || nooutput )
|
||||
;
|
||||
else if( !(fp = fopen(fname,"wb")) ) {
|
||||
log_error("Error creating `%s': %s\n", fname, strerror(errno) );
|
||||
log_error(_("error creating `%s': %s\n"), fname, strerror(errno) );
|
||||
rc = G10ERR_CREATE_FILE;
|
||||
#ifdef __riscos__
|
||||
if (errno == 106)
|
||||
log_info("perhaps the output file has the same name as the input file?\n");
|
||||
#endif /* __riscos__ */
|
||||
goto leave;
|
||||
}
|
||||
|
||||
|
@ -214,17 +214,17 @@ add_keyblock_resource( const char *url, int force, int secret )
|
||||
rt = rt_GDBM;
|
||||
resname += 11;
|
||||
}
|
||||
#ifndef HAVE_DRIVE_LETTERS
|
||||
#if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__)
|
||||
else if( strchr( resname, ':' ) ) {
|
||||
log_error("%s: invalid URL\n", url );
|
||||
rc = G10ERR_GENERAL;
|
||||
goto leave;
|
||||
}
|
||||
#endif
|
||||
#endif /* !HAVE_DRIVE_LETTERS && !__riscos__ */
|
||||
}
|
||||
|
||||
if( *resname != '/' ) { /* do tilde expansion etc */
|
||||
if( strchr(resname, '/') )
|
||||
if( *resname != DIRSEP_C ) { /* do tilde expansion etc */
|
||||
if( strchr(resname, DIRSEP_C) )
|
||||
filename = make_filename(resname, NULL);
|
||||
else
|
||||
filename = make_filename(opt.homedir, resname, NULL);
|
||||
@ -282,7 +282,7 @@ add_keyblock_resource( const char *url, int force, int secret )
|
||||
if( !iobuf ) {
|
||||
char *last_slash_in_filename;
|
||||
|
||||
last_slash_in_filename = strrchr(filename, '/');
|
||||
last_slash_in_filename = strrchr(filename, DIRSEP_C);
|
||||
*last_slash_in_filename = 0;
|
||||
|
||||
if( access(filename, F_OK) ) {
|
||||
@ -292,11 +292,11 @@ add_keyblock_resource( const char *url, int force, int secret )
|
||||
*/
|
||||
try_make_homedir( filename );
|
||||
rc = G10ERR_OPEN_FILE;
|
||||
*last_slash_in_filename = '/';
|
||||
*last_slash_in_filename = DIRSEP_C;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
*last_slash_in_filename = '/';
|
||||
*last_slash_in_filename = DIRSEP_C;
|
||||
|
||||
iobuf = iobuf_create( filename );
|
||||
if( !iobuf ) {
|
||||
@ -447,8 +447,8 @@ get_writable_keyblock_file( int secret )
|
||||
}
|
||||
}
|
||||
/* Assume the home dir is always writable */
|
||||
return make_filename(opt.homedir, secret? "secring.gpg"
|
||||
: "pubring.gpg", NULL );
|
||||
return make_filename(opt.homedir, secret? "secring" EXTSEP_S "gpg"
|
||||
: "pubring" EXTSEP_S "gpg", NULL );
|
||||
}
|
||||
|
||||
|
||||
@ -1413,25 +1413,25 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root )
|
||||
* works. So we replace .gpg by .bak or .tmp
|
||||
*/
|
||||
if( strlen(rentry->fname) > 4
|
||||
&& !strcmp(rentry->fname+strlen(rentry->fname)-4, ".gpg") ) {
|
||||
&& !strcmp(rentry->fname+strlen(rentry->fname)-4, EXTSEP_S "gpg") ) {
|
||||
bakfname = m_alloc( strlen( rentry->fname ) + 1 );
|
||||
strcpy(bakfname,rentry->fname);
|
||||
strcpy(bakfname+strlen(rentry->fname)-4, ".bak");
|
||||
strcpy(bakfname+strlen(rentry->fname)-4, EXTSEP_S "bak");
|
||||
tmpfname = m_alloc( strlen( rentry->fname ) + 1 );
|
||||
strcpy(tmpfname,rentry->fname);
|
||||
strcpy(tmpfname+strlen(rentry->fname)-4, ".tmp");
|
||||
strcpy(tmpfname+strlen(rentry->fname)-4, EXTSEP_S "tmp");
|
||||
}
|
||||
else { /* file does not end with gpg; hmmm */
|
||||
bakfname = m_alloc( strlen( rentry->fname ) + 5 );
|
||||
strcpy(stpcpy(bakfname,rentry->fname),".bak");
|
||||
strcpy(stpcpy(bakfname,rentry->fname), EXTSEP_S "bak");
|
||||
tmpfname = m_alloc( strlen( rentry->fname ) + 5 );
|
||||
strcpy(stpcpy(tmpfname,rentry->fname),".tmp");
|
||||
strcpy(stpcpy(tmpfname,rentry->fname), EXTSEP_S "tmp");
|
||||
}
|
||||
#else
|
||||
bakfname = m_alloc( strlen( rentry->fname ) + 2 );
|
||||
strcpy(stpcpy(bakfname,rentry->fname),"~");
|
||||
tmpfname = m_alloc( strlen( rentry->fname ) + 5 );
|
||||
strcpy(stpcpy(tmpfname,rentry->fname),".tmp");
|
||||
strcpy(stpcpy(tmpfname,rentry->fname), EXTSEP_S "tmp");
|
||||
#endif
|
||||
newfp = iobuf_create( tmpfname );
|
||||
if( !newfp ) {
|
||||
@ -1534,7 +1534,7 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root )
|
||||
if( !rentry->secret ) { /* but not for secret keyrings */
|
||||
iobuf_ioctl (NULL, 2, 0, bakfname );
|
||||
iobuf_ioctl (NULL, 2, 0, rentry->fname );
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||
remove( bakfname );
|
||||
#endif
|
||||
if( rename( rentry->fname, bakfname ) ) {
|
||||
@ -1546,7 +1546,7 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root )
|
||||
}
|
||||
iobuf_ioctl (NULL, 2, 0, tmpfname );
|
||||
iobuf_ioctl (NULL, 2, 0, rentry->fname );
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||
remove( rentry->fname );
|
||||
#endif
|
||||
if( rename( tmpfname, rentry->fname ) ) {
|
||||
|
@ -42,7 +42,7 @@ static void
|
||||
init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
||||
{
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#if HAVE_SIGACTION
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction oact, nact;
|
||||
|
||||
if (check_ign) {
|
||||
@ -99,6 +99,9 @@ got_fatal_signal( int sig )
|
||||
/* reset action to default action and raise signal again */
|
||||
init_one_signal (sig, SIG_DFL, 0);
|
||||
remove_lockfiles ();
|
||||
#ifdef __riscos__
|
||||
close_fds ();
|
||||
#endif /* __riscos__ */
|
||||
raise( sig );
|
||||
}
|
||||
|
||||
|
25
g10/tdbio.c
25
g10/tdbio.c
@ -417,7 +417,8 @@ tdbio_set_dbname( const char *new_dbname, int create )
|
||||
initialized = 1;
|
||||
}
|
||||
fname = new_dbname? m_strdup( new_dbname )
|
||||
: make_filename(opt.homedir, "trustdb.gpg", NULL );
|
||||
: make_filename(opt.homedir,
|
||||
"trustdb" EXTSEP_S "gpg", NULL );
|
||||
|
||||
if( access( fname, R_OK ) ) {
|
||||
if( errno != ENOENT ) {
|
||||
@ -429,7 +430,7 @@ tdbio_set_dbname( const char *new_dbname, int create )
|
||||
FILE *fp;
|
||||
TRUSTREC rec;
|
||||
int rc;
|
||||
char *p = strrchr( fname, '/' );
|
||||
char *p = strrchr( fname, DIRSEP_C );
|
||||
|
||||
assert(p);
|
||||
*p = 0;
|
||||
@ -437,14 +438,22 @@ tdbio_set_dbname( const char *new_dbname, int create )
|
||||
try_make_homedir( fname );
|
||||
log_fatal( _("%s: directory does not exist!\n"), fname );
|
||||
}
|
||||
*p = '/';
|
||||
*p = DIRSEP_C;
|
||||
|
||||
m_free(db_name);
|
||||
db_name = fname;
|
||||
#ifdef __riscos__
|
||||
if( !lockhandle )
|
||||
lockhandle = create_dotlock( db_name );
|
||||
if( !lockhandle )
|
||||
log_fatal( _("%s: can't create lock\n"), db_name );
|
||||
if( make_dotlock( lockhandle, -1 ) )
|
||||
log_fatal( _("%s: can't make lock\n"), db_name );
|
||||
#endif /* __riscos__ */
|
||||
fp =fopen( fname, "wb" );
|
||||
if( !fp )
|
||||
log_fatal( _("%s: can't create: %s\n"), fname, strerror(errno) );
|
||||
fclose(fp);
|
||||
m_free(db_name);
|
||||
db_name = fname;
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
db_fd = open( db_name, O_RDWR | O_BINARY );
|
||||
#else
|
||||
@ -453,10 +462,12 @@ tdbio_set_dbname( const char *new_dbname, int create )
|
||||
if( db_fd == -1 )
|
||||
log_fatal( _("%s: can't open: %s\n"), db_name, strerror(errno) );
|
||||
|
||||
#ifndef __riscos__
|
||||
if( !lockhandle )
|
||||
lockhandle = create_dotlock( db_name );
|
||||
if( !lockhandle )
|
||||
log_fatal( _("%s: can't create lock\n"), db_name );
|
||||
#endif /* !__riscos__ */
|
||||
|
||||
memset( &rec, 0, sizeof rec );
|
||||
rec.r.ver.version = 2;
|
||||
@ -506,6 +517,10 @@ open_db()
|
||||
lockhandle = create_dotlock( db_name );
|
||||
if( !lockhandle )
|
||||
log_fatal( _("%s: can't create lock\n"), db_name );
|
||||
#ifdef __riscos__
|
||||
if( make_dotlock( lockhandle, -1 ) )
|
||||
log_fatal( _("%s: can't make lock\n"), db_name );
|
||||
#endif /* __riscos__ */
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
db_fd = open( db_name, O_RDWR | O_BINARY );
|
||||
#else
|
||||
|
@ -2301,11 +2301,11 @@ query_trust_record( PKT_public_key *pk )
|
||||
* is not necessary to check this if we use a local pubring. Hmmmm.
|
||||
*/
|
||||
int
|
||||
check_trust( PKT_public_key *pk, unsigned *r_trustlevel,
|
||||
check_trust( PKT_public_key *pk, int *r_trustlevel,
|
||||
const byte *namehash, int (*add_fnc)(ulong), unsigned *retflgs )
|
||||
{
|
||||
TRUSTREC rec;
|
||||
unsigned trustlevel = TRUST_UNKNOWN;
|
||||
unsigned int trustlevel = TRUST_UNKNOWN;
|
||||
int rc=0;
|
||||
u32 cur_time;
|
||||
u32 keyid[2];
|
||||
|
@ -45,7 +45,7 @@ void update_trustdb( void );
|
||||
int setup_trustdb( int level, const char *dbname );
|
||||
void init_trustdb( void );
|
||||
void sync_trustdb( void );
|
||||
int check_trust( PKT_public_key *pk, unsigned *r_trustlevel,
|
||||
int check_trust( PKT_public_key *pk, int *r_trustlevel,
|
||||
const byte* nh, int (*add_fnc)(ulong), unsigned *retflgs );
|
||||
int query_trust_info( PKT_public_key *pk, const byte *nh );
|
||||
int enum_cert_paths( void **context, ulong *lid,
|
||||
|
@ -1,3 +1,10 @@
|
||||
2001-08-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* util.h [__riscos__]: Added prototypes and made sure that we
|
||||
never use __attribute__.
|
||||
* cipher.h, iobuf.h, memory.h, mpi.h [__riscos__]: extern hack.
|
||||
* i18n.h [__riscos__]: Use another include file
|
||||
|
||||
2001-05-30 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* ttyio.h (tty_printf): Add missing parenthesis for non gcc.
|
||||
|
@ -91,10 +91,17 @@ struct gcry_md_context {
|
||||
|
||||
typedef struct gcry_md_context *MD_HANDLE;
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
#else
|
||||
#define EXTERN_UNLESS_MAIN_MODULE
|
||||
#endif
|
||||
#endif
|
||||
EXTERN_UNLESS_MAIN_MODULE int g10c_debug_mode;
|
||||
EXTERN_UNLESS_MAIN_MODULE int g10_opt_verbose;
|
||||
EXTERN_UNLESS_MAIN_MODULE const char *g10_opt_homedir;
|
||||
|
||||
int g10c_debug_mode;
|
||||
int g10_opt_verbose;
|
||||
const char *g10_opt_homedir;
|
||||
|
||||
/*-- dynload.c --*/
|
||||
void register_cipher_extension( const char *mainpgm, const char *fname );
|
||||
|
@ -34,7 +34,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#ifndef __riscos__
|
||||
#include <libintl.h>
|
||||
#else
|
||||
#include "libgettext.h"
|
||||
#endif /* __riscos__ */
|
||||
#define _(a) gettext (a)
|
||||
#ifdef gettext_noop
|
||||
#define N_(a) gettext_noop (a)
|
||||
|
@ -71,7 +71,14 @@ struct iobuf_struct {
|
||||
} unget;
|
||||
};
|
||||
|
||||
int iobuf_debug_mode;
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
#else
|
||||
#define EXTERN_UNLESS_MAIN_MODULE
|
||||
#endif
|
||||
#endif
|
||||
EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode;
|
||||
|
||||
void iobuf_enable_special_filenames ( int yes );
|
||||
IOBUF iobuf_alloc(int use, size_t bufsize);
|
||||
|
@ -25,7 +25,11 @@
|
||||
#ifndef STR
|
||||
#define STR(v) #v
|
||||
#endif
|
||||
#define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]"
|
||||
#ifndef __riscos__
|
||||
#define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]"
|
||||
#else /* __riscos__ */
|
||||
#define M_DBGINFO(a) "["__FILE__ ":" STR(a) "]"
|
||||
#endif /* __riscos__ */
|
||||
#define m_alloc(n) m_debug_alloc((n), M_DBGINFO( __LINE__ ) )
|
||||
#define m_alloc_clear(n) m_debug_alloc_clear((n), M_DBGINFO(__LINE__) )
|
||||
#define m_alloc_secure(n) m_debug_alloc((n), M_DBGINFO(__LINE__) )
|
||||
@ -76,9 +80,16 @@ unsigned secmem_get_flags(void);
|
||||
|
||||
#define DBG_MEMORY memory_debug_mode
|
||||
#define DBG_MEMSTAT memory_stat_debug_mode
|
||||
int memory_debug_mode;
|
||||
int memory_stat_debug_mode;
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
#else
|
||||
#define EXTERN_UNLESS_MAIN_MODULE
|
||||
#endif
|
||||
#endif
|
||||
EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode;
|
||||
EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
|
||||
|
||||
|
||||
#endif /*G10_MEMORY_H*/
|
||||
|
@ -53,9 +53,17 @@
|
||||
#endif
|
||||
#define BITS_PER_MPI_LIMB (8*BYTES_PER_MPI_LIMB)
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
#else
|
||||
#define EXTERN_UNLESS_MAIN_MODULE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DBG_MPI mpi_debug_mode
|
||||
int mpi_debug_mode;
|
||||
EXTERN_UNLESS_MAIN_MODULE int mpi_debug_mode;
|
||||
|
||||
|
||||
struct gcry_mpi {
|
||||
int alloced; /* array size (# of allocated limbs) */
|
||||
|
@ -43,7 +43,13 @@
|
||||
|
||||
#ifndef HAVE_BYTE_TYPEDEF
|
||||
#undef byte /* maybe there is a macro with this name */
|
||||
typedef unsigned char byte;
|
||||
#ifndef __riscos__
|
||||
typedef unsigned char byte;
|
||||
#else
|
||||
/* FIXME it seems that char is unsigned by default and we workaround
|
||||
* signed/unsigned mismacthes here. */
|
||||
typedef char byte;
|
||||
#endif
|
||||
#define HAVE_BYTE_TYPEDEF
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,8 @@ int log_get_errorcount( int clear );
|
||||
void log_inc_errorcount(void);
|
||||
void g10_log_hexdump( const char *text, const char *buf, size_t len );
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
|
||||
#if !defined (__riscos__) \
|
||||
&& (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 ))
|
||||
void g10_log_bug( const char *fmt, ... )
|
||||
__attribute__ ((noreturn, format (printf,1,2)));
|
||||
void g10_log_bug0( const char *, int, const char * ) __attribute__ ((noreturn));
|
||||
@ -240,4 +241,23 @@ int vasprintf ( char **result, const char *format, va_list args);
|
||||
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
|
||||
#define DIMof(type,member) DIM(((type *)0)->member)
|
||||
|
||||
/******* RISC OS stuff ***********/
|
||||
#ifdef __riscos__
|
||||
FILE *riscos_fopen(const char *filename, const char *mode);
|
||||
int riscos_open(const char *filename, int oflag, ...);
|
||||
int riscos_fstat(int fildes, struct stat *buf);
|
||||
int fdopenfile(const char *filename, const int allow_write);
|
||||
void close_fds(void);
|
||||
int renamefile(const char *old, const char *new);
|
||||
char *gstrans(const char *old);
|
||||
void not_implemented(const char *feature);
|
||||
void set_filetype(const char *filename, const int type);
|
||||
#ifndef __RISCOS__C__
|
||||
#define fopen riscos_fopen
|
||||
#define open riscos_open
|
||||
#define fstat riscos_fstat
|
||||
#endif /* !__RISCOS__C__ */
|
||||
#endif /* __riscos__ */
|
||||
|
||||
#endif /*G10_UTIL_H*/
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-08-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* longlong.h [__riscos__]: Need a special pragma here.
|
||||
|
||||
2001-08-09 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* config.links: Added configuraton for powerpc-openbsd. By Peter
|
||||
|
@ -94,6 +94,9 @@ MA 02111-1307, USA. */
|
||||
Please add support for more CPUs here, or improve the current support
|
||||
for the CPUs below! */
|
||||
|
||||
#ifdef __riscos__
|
||||
#pragma continue_after_hash_error
|
||||
#else /* !__riscos__ */
|
||||
#if defined (__GNUC__) && !defined (NO_ASM)
|
||||
|
||||
/* We sometimes need to clobber "cc" with gcc2, but that would not be
|
||||
@ -1312,6 +1315,7 @@ extern USItype __udiv_qrnnd ();
|
||||
#endif /* __z8000__ */
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* !__riscos__ */
|
||||
|
||||
|
||||
/***************************************
|
||||
|
3
scripts/build-riscos
Normal file
3
scripts/build-riscos
Normal file
@ -0,0 +1,3 @@
|
||||
Please add here the stuff to build the riscos version. The script
|
||||
should copy the files ffrom the conf-riscos tree over the main tree.
|
||||
It would be nice to make sure that it can only be used under riscos.
|
38
scripts/conf-riscos/cipher/construct.c
Normal file
38
scripts/conf-riscos/cipher/construct.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* construct.c - RISC OS constructors for cipher algorithms
|
||||
* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
void rndriscos_constructor(void);
|
||||
void sha1_constructor(void);
|
||||
void rmd160_constructor(void);
|
||||
void md5_constructor(void);
|
||||
|
||||
void
|
||||
cipher_modules_constructor(void)
|
||||
{
|
||||
static int done = 0;
|
||||
if( done )
|
||||
return;
|
||||
done = 1;
|
||||
|
||||
rndriscos_constructor();
|
||||
sha1_constructor();
|
||||
rmd160_constructor();
|
||||
md5_constructor();
|
||||
}
|
32
scripts/conf-riscos/cipher/constructv.c
Normal file
32
scripts/conf-riscos/cipher/constructv.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* constructv.c - RISC OS constructors for cipher algorithms (gpgv version)
|
||||
* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
void rmd160_constructor(void);
|
||||
|
||||
void
|
||||
cipher_modules_constructor(void)
|
||||
{
|
||||
static int done = 0;
|
||||
if( done )
|
||||
return;
|
||||
done = 1;
|
||||
|
||||
rmd160_constructor();
|
||||
}
|
380
scripts/conf-riscos/include/config.h
Normal file
380
scripts/conf-riscos/include/config.h
Normal file
@ -0,0 +1,380 @@
|
||||
/* config.h - hand edited by Stefan Bellon to suit RISC OS needs
|
||||
* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* GNUPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNUPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifndef G10_CONFIG_H
|
||||
#define G10_CONFIG_H
|
||||
|
||||
/* need this, because some autoconf tests rely on this (e.g. stpcpy)
|
||||
* and it should be used for new programs
|
||||
*/
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
/* #undef HAVE_ALLOCA */
|
||||
#define HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
/* #undef HAVE_ALLOCA_H */
|
||||
#define HAVE_ALLOCA_H
|
||||
|
||||
/* #undef _LIBC */
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#define inline __inline
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
#define size_t unsigned int
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS
|
||||
|
||||
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||
#define SYS_SIGLIST_DECLARED
|
||||
|
||||
#undef M_DEBUG
|
||||
#undef M_GUARD
|
||||
#define PRINTABLE_OS_NAME "RISC OS"
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if NLS is requested. */
|
||||
#define ENABLE_NLS 1
|
||||
|
||||
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
|
||||
#undef HAVE_CATGETS
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
#undef BIG_ENDIAN_HOST
|
||||
#define LITTLE_ENDIAN_HOST
|
||||
|
||||
#undef HAVE_BYTE_TYPEDEF
|
||||
#undef HAVE_USHORT_TYPEDEF
|
||||
#undef HAVE_ULONG_TYPEDEF
|
||||
#undef HAVE_U16_TYPEDEF
|
||||
#undef HAVE_U32_TYPEDEF
|
||||
|
||||
#undef HAVE_BROKEN_MLOCK
|
||||
|
||||
/* defined if we have a /dev/random and /dev/urandom */
|
||||
#undef HAVE_DEV_RANDOM
|
||||
/* and the real names of the random devices */
|
||||
#undef NAME_OF_DEV_RANDOM
|
||||
#undef NAME_OF_DEV_URANDOM
|
||||
/* Linux has an ioctl */
|
||||
#undef HAVE_DEV_RANDOM_IOCTL
|
||||
|
||||
/* see cipher/rndegd.c */
|
||||
#undef EGD_SOCKET_NAME
|
||||
|
||||
#undef USE_DYNAMIC_LINKING
|
||||
#undef HAVE_DL_DLOPEN
|
||||
#undef HAVE_DL_SHL_LOAD
|
||||
#undef HAVE_DLD_DLD_LINK
|
||||
|
||||
#undef USE_SHM_COPROCESSING
|
||||
|
||||
#undef IPC_HAVE_SHM_LOCK
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
/* set this to limit filenames to the 8.3 format */
|
||||
#undef USE_ONLY_8DOT3
|
||||
/* defined if we must run on a stupid file system */
|
||||
#undef HAVE_DRIVE_LETTERS
|
||||
/* defined if we run on some of the PCDOS like systems (DOS, Windoze. OS/2)
|
||||
* with special properties like no file modes */
|
||||
#undef HAVE_DOSISH_SYSTEM
|
||||
/* because the Unix gettext has to much overhead on MingW32 systems
|
||||
* and these systems lack Posix functions, we use a simplified version
|
||||
* of gettext */
|
||||
#undef USE_SIMPLE_GETTEXT
|
||||
/* At some point in the system we need to know that we use the Windows
|
||||
* random module. */
|
||||
#undef USE_STATIC_RNDW32
|
||||
|
||||
#undef USE_CAPABILITIES
|
||||
|
||||
/* Some systems have mkdir that takes a single argument. */
|
||||
#undef MKDIR_TAKES_ONE_ARG
|
||||
|
||||
/* The number of bytes in a unsigned int. */
|
||||
#define SIZEOF_UNSIGNED_INT 4
|
||||
|
||||
/* The number of bytes in a unsigned long. */
|
||||
#define SIZEOF_UNSIGNED_LONG 4
|
||||
|
||||
/* The number of bytes in a unsigned long long. */
|
||||
#define SIZEOF_UNSIGNED_LONG_LONG 0
|
||||
|
||||
/* The number of bytes in a unsigned short. */
|
||||
#define SIZEOF_UNSIGNED_SHORT 2
|
||||
|
||||
/* Define if you have the __argz_count function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
/* Define if you have the __argz_next function. */
|
||||
#undef HAVE___ARGZ_NEXT
|
||||
|
||||
/* Define if you have the __argz_stringify function. */
|
||||
#undef HAVE___ARGZ_STRINGIFY
|
||||
|
||||
/* Define if you have the atexit function. */
|
||||
#define HAVE_ATEXIT
|
||||
|
||||
/* Define if you have the clock_gettime function. */
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
||||
/* Define if you have the dcgettext function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define if you have the dlopen function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define if you have the fopen64 function. */
|
||||
#undef HAVE_FOPEN64
|
||||
|
||||
/* Define if you have the fstat64 function. */
|
||||
#undef HAVE_FSTAT64
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#define HAVE_GETCWD
|
||||
|
||||
/* Define if you have the gethrtime function. */
|
||||
#undef HAVE_GETHRTIME
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#define HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the getrusage function. */
|
||||
#define HAVE_GETRUSAGE
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define if you have the memicmp function. */
|
||||
#undef HAVE_MEMICMP
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#define HAVE_MEMMOVE
|
||||
|
||||
/* Define if you have the mlock function. */
|
||||
#undef HAVE_MLOCK
|
||||
|
||||
/* Define if you have the mmap function. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if you have the munmap function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define if you have the nl_langinfo function. */
|
||||
#undef HAVE_NL_LANGINFO
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#define HAVE_PUTENV
|
||||
|
||||
/* Define if you have the raise function. */
|
||||
#define HAVE_RAISE
|
||||
|
||||
/* Define if you have the rand function. */
|
||||
#define HAVE_RAND
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#define HAVE_SETENV
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#define HAVE_SETLOCALE
|
||||
|
||||
/* Define if you have the setrlimit function. */
|
||||
#define HAVE_SETRLIMIT
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
#define HAVE_SIGACTION
|
||||
|
||||
/* Define if you have the sigprocmask function. */
|
||||
#define HAVE_SIGPROCMASK
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
#define HAVE_STPCPY
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#define HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#define HAVE_STRCHR
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#define HAVE_STRDUP
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR
|
||||
|
||||
/* Define if you have the strftime function. */
|
||||
#define HAVE_STRFTIME
|
||||
|
||||
/* Define if you have the stricmp function. */
|
||||
#define HAVE_STRICMP
|
||||
|
||||
/* Define if you have the strlwr function. */
|
||||
#undef HAVE_STRLWR
|
||||
|
||||
/* Define if you have the strtoul function. */
|
||||
#define HAVE_STRTOUL
|
||||
|
||||
/* Define if you have the tcgetattr function. */
|
||||
#define HAVE_TCGETATTR
|
||||
|
||||
/* Define if you have the wait4 function. */
|
||||
#define HAVE_WAIT4
|
||||
|
||||
/* Define if you have the waitpid function. */
|
||||
#define HAVE_WAITPID
|
||||
|
||||
/* Define if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define if you have the <direct.h> header file. */
|
||||
#undef HAVE_DIRECT_H
|
||||
|
||||
/* Define if you have the <gdbm.h> header file. */
|
||||
#undef HAVE_GDBM_H
|
||||
|
||||
/* Define if you have the <langinfo.h> header file. */
|
||||
#undef HAVE_LANGINFO_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <linux/random.h> header file. */
|
||||
#undef HAVE_LINUX_RANDOM_H
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <sys/capability.h> header file. */
|
||||
#undef HAVE_SYS_CAPABILITY_H
|
||||
|
||||
/* Define if you have the <sys/ipc.h> header file. */
|
||||
#undef HAVE_SYS_IPC_H
|
||||
|
||||
/* Define if you have the <sys/mman.h> header file. */
|
||||
#define HAVE_SYS_MMAN_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/shm.h> header file. */
|
||||
#undef HAVE_SYS_SHM_H
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H
|
||||
|
||||
/* Define if you have the <termio.h> header file. */
|
||||
#define HAVE_TERMIO_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the <zlib.h> header file. */
|
||||
#define HAVE_ZLIB_H
|
||||
|
||||
/* Define if you have the dl library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define if you have the dld library (-ldld). */
|
||||
#undef HAVE_LIBDLD
|
||||
|
||||
/* Define if you have the gdbm library (-lgdbm). */
|
||||
#undef HAVE_LIBGDBM
|
||||
|
||||
/* Define if you have the i library (-li). */
|
||||
#undef HAVE_LIBI
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have the rt library (-lrt). */
|
||||
#undef HAVE_LIBRT
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "GnuPG"
|
||||
|
||||
/* Version number of package */
|
||||
/* no more needed here as set in the Makefile
|
||||
#define VERSION "1.0.4"
|
||||
#define IS_DEVELOPMENT_VERSION
|
||||
*/
|
||||
|
||||
/* define if compiled symbols have a leading underscore */
|
||||
#define WITH_SYMBOL_UNDERSCORE
|
||||
|
||||
#define getpid riscos_getpid
|
||||
#define kill(pid, sig) riscos_kill(pid, sig)
|
||||
#ifdef IS_DEVELOPMENT_VERSION
|
||||
#define M_GUARD
|
||||
#endif
|
||||
|
||||
#include "g10defs.h"
|
||||
|
||||
#endif /*G10_CONFIG_H*/
|
15
scripts/conf-riscos/include/g10defs.h
Normal file
15
scripts/conf-riscos/include/g10defs.h
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
#define G10_LOCALEDIR "<GnuPG$Dir>.locale"
|
||||
#define GNUPG_LIBDIR "<GnuPG$Dir>"
|
||||
#define GNUPG_DATADIR "<GnuPG$Dir>"
|
||||
#define GNUPG_HOMEDIR "<GnuPGUser$Dir>"
|
||||
#define LOCALE_ALIAS_PATH "<GnuPG$Dir>.locale"
|
||||
#define GNULOCALEDIR "<GnuPG$Dir>.locale"
|
||||
#define DIRSEP_C '.'
|
||||
#define EXTSEP_C '/'
|
||||
#define DIRSEP_S "."
|
||||
#define EXTSEP_S "/"
|
||||
/* This file defines some basic constants for the MPI machinery. We
|
||||
* need to define the types on a per-CPU basis, so it is done with
|
||||
* this file here. */
|
||||
#define BYTES_PER_MPI_LIMB (SIZEOF_UNSIGNED_LONG)
|
@ -1,3 +1,18 @@
|
||||
2001-08-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Applied patches from Stefan Bellon <sbellon@sbellon.de> to support
|
||||
the RISCOS. Nearly all of these patches are identified by the
|
||||
__riscos__ macro.
|
||||
* secmem.c [__riscos__]: Disabled secure memory stuff.
|
||||
* dotlock.c, ttyio.c [__riscos__]: Adapted for RISCOS
|
||||
* fileutil.c, iobuf.c: Adapted for RISCOS; mainly replaced
|
||||
hardcoded path separators with EXTSEP_S like macros.
|
||||
* http.c (send_request): Use macros for the env-var name.
|
||||
* logger.c [__riscos__]: Do an fflush at the end of each log
|
||||
function.
|
||||
* memory.c [__riscos__]: Minor patches
|
||||
* riscos.c (set_filetype): New.
|
||||
|
||||
2001-07-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* strgutil.c (utf8_to_native): Fixed printing of invalid utf-8
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* dotlock.c - dotfile locking
|
||||
* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -25,7 +25,7 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#if !defined (HAVE_DOSISH_SYSTEM)
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
@ -80,7 +80,7 @@ create_dotlock( const char *file_to_lock )
|
||||
DOTLOCK h;
|
||||
int fd = -1;
|
||||
char pidstr[16];
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#if !defined (HAVE_DOSISH_SYSTEM)
|
||||
struct utsname utsbuf;
|
||||
#endif
|
||||
const char *nodename;
|
||||
@ -106,7 +106,7 @@ create_dotlock( const char *file_to_lock )
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#if !defined (HAVE_DOSISH_SYSTEM)
|
||||
sprintf( pidstr, "%10d\n", (int)getpid() );
|
||||
/* fixme: add the hostname to the second line (FQDN or IP addr?) */
|
||||
|
||||
@ -116,8 +116,17 @@ create_dotlock( const char *file_to_lock )
|
||||
else
|
||||
nodename = utsbuf.nodename;
|
||||
|
||||
if( !(dirpart = strrchr( file_to_lock, '/' )) ) {
|
||||
dirpart = ".";
|
||||
#ifdef __riscos__
|
||||
{
|
||||
char *iter = (char *) nodename;
|
||||
for (; iter[0]; iter++)
|
||||
if (iter[0] == '.')
|
||||
iter[0] = '/';
|
||||
}
|
||||
#endif /* __riscos__ */
|
||||
|
||||
if( !(dirpart = strrchr( file_to_lock, DIRSEP_C )) ) {
|
||||
dirpart = EXTSEP_S;
|
||||
dirpartlen = 1;
|
||||
}
|
||||
else {
|
||||
@ -132,8 +141,13 @@ create_dotlock( const char *file_to_lock )
|
||||
all_lockfiles = h;
|
||||
|
||||
h->tname = m_alloc( dirpartlen + 6+30+ strlen(nodename) + 11 );
|
||||
#ifndef __riscos__
|
||||
sprintf( h->tname, "%.*s/.#lk%p.%s.%d",
|
||||
dirpartlen, dirpart, h, nodename, (int)getpid() );
|
||||
#else /* __riscos__ */
|
||||
sprintf( h->tname, "%.*s.lk%p/%s/%d",
|
||||
dirpartlen, dirpart, h, nodename, (int)getpid() );
|
||||
#endif /* __riscos__ */
|
||||
|
||||
do {
|
||||
errno = 0;
|
||||
@ -175,9 +189,9 @@ create_dotlock( const char *file_to_lock )
|
||||
#ifdef _REENTRANT
|
||||
/* release mutex */
|
||||
#endif
|
||||
#endif /* !HAVE_DOSISH_SYSTEM */
|
||||
#endif
|
||||
h->lockname = m_alloc( strlen(file_to_lock) + 6 );
|
||||
strcpy(stpcpy(h->lockname, file_to_lock), ".lock");
|
||||
strcpy(stpcpy(h->lockname, file_to_lock), EXTSEP_S "lock");
|
||||
return h;
|
||||
}
|
||||
|
||||
@ -202,7 +216,7 @@ maybe_deadlock( DOTLOCK h )
|
||||
int
|
||||
make_dotlock( DOTLOCK h, long timeout )
|
||||
{
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined (HAVE_DOSISH_SYSTEM)
|
||||
return 0;
|
||||
#else
|
||||
int pid;
|
||||
@ -214,11 +228,14 @@ make_dotlock( DOTLOCK h, long timeout )
|
||||
}
|
||||
|
||||
if( h->locked ) {
|
||||
#ifndef __riscos__
|
||||
log_debug("oops, `%s' is already locked\n", h->lockname );
|
||||
#endif /* !__riscos__ */
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(;;) {
|
||||
#ifndef __riscos__
|
||||
if( !link(h->tname, h->lockname) ) {
|
||||
/* fixme: better use stat to check the link count */
|
||||
h->locked = 1;
|
||||
@ -228,6 +245,16 @@ make_dotlock( DOTLOCK h, long timeout )
|
||||
log_error( "lock not made: link() failed: %s\n", strerror(errno) );
|
||||
return -1;
|
||||
}
|
||||
#else /* __riscos__ */
|
||||
if( !renamefile(h->tname, h->lockname) ) {
|
||||
h->locked = 1;
|
||||
return 0; /* okay */
|
||||
}
|
||||
if( errno != EEXIST ) {
|
||||
log_error( "lock not made: rename() failed: %s\n", strerror(errno) );
|
||||
return -1;
|
||||
}
|
||||
#endif /* __riscos__ */
|
||||
if( (pid = read_lockfile(h->lockname)) == -1 ) {
|
||||
if( errno != ENOENT ) {
|
||||
log_info("cannot read lockfile\n");
|
||||
@ -242,11 +269,18 @@ make_dotlock( DOTLOCK h, long timeout )
|
||||
return 0; /* okay */
|
||||
}
|
||||
else if( kill(pid, 0) && errno == ESRCH ) {
|
||||
#ifndef __riscos__
|
||||
maybe_dead = " - probably dead";
|
||||
#if 0 /* we should not do this without checking the permissions */
|
||||
/* and the hostname */
|
||||
log_info( "removing stale lockfile (created by %d)", pid );
|
||||
#endif
|
||||
#else /* __riscos__ */
|
||||
/* we are *pretty* sure that the other task is dead and therefore
|
||||
we remove the other lock file */
|
||||
maybe_dead = " - probably dead - removing lock";
|
||||
unlink(h->lockname);
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
if( timeout == -1 ) {
|
||||
struct timeval tv;
|
||||
@ -265,7 +299,7 @@ make_dotlock( DOTLOCK h, long timeout )
|
||||
return -1;
|
||||
}
|
||||
/*not reached */
|
||||
#endif /* !HAVE_DOSISH_SYSTEM */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -276,7 +310,7 @@ make_dotlock( DOTLOCK h, long timeout )
|
||||
int
|
||||
release_dotlock( DOTLOCK h )
|
||||
{
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined (HAVE_DOSISH_SYSTEM)
|
||||
return 0;
|
||||
#else
|
||||
int pid;
|
||||
@ -299,15 +333,23 @@ release_dotlock( DOTLOCK h )
|
||||
log_error( "release_dotlock: not our lock (pid=%d)\n", pid);
|
||||
return -1;
|
||||
}
|
||||
#ifndef __riscos__
|
||||
if( unlink( h->lockname ) ) {
|
||||
log_error( "release_dotlock: error removing lockfile `%s'",
|
||||
h->lockname);
|
||||
return -1;
|
||||
}
|
||||
#else /* __riscos__ */
|
||||
if( renamefile(h->lockname, h->tname) ) {
|
||||
log_error( "release_dotlock: error renaming lockfile `%s' to `%s'",
|
||||
h->lockname, h->tname);
|
||||
return -1;
|
||||
}
|
||||
#endif /* __riscos__ */
|
||||
/* fixme: check that the link count is now 1 */
|
||||
h->locked = 0;
|
||||
return 0;
|
||||
#endif /* !HAVE_DOSISH_SYSTEM */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -317,7 +359,7 @@ release_dotlock( DOTLOCK h )
|
||||
static int
|
||||
read_lockfile( const char *name )
|
||||
{
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined (HAVE_DOSISH_SYSTEM)
|
||||
return 0;
|
||||
#else
|
||||
int fd, pid;
|
||||
@ -338,7 +380,11 @@ read_lockfile( const char *name )
|
||||
pidstr[10] = 0; /* terminate pid string */
|
||||
close(fd);
|
||||
pid = atoi(pidstr);
|
||||
#ifndef __riscos__
|
||||
if( !pid || pid == -1 ) {
|
||||
#else /* __riscos__ */
|
||||
if( (!pid && riscos_getpid()) || pid == -1 ) {
|
||||
#endif /* __riscos__ */
|
||||
log_error("invalid pid %d in lockfile `%s'", pid, name );
|
||||
errno = 0;
|
||||
return -1;
|
||||
@ -351,7 +397,7 @@ read_lockfile( const char *name )
|
||||
void
|
||||
remove_lockfiles()
|
||||
{
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#if !defined (HAVE_DOSISH_SYSTEM)
|
||||
DOTLOCK h, h2;
|
||||
|
||||
h = all_lockfiles;
|
||||
|
@ -25,6 +25,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __riscos__
|
||||
#include <kernel.h>
|
||||
#include <sys/swis.h>
|
||||
#endif /* __riscos__ */
|
||||
#include "util.h"
|
||||
#include "memory.h"
|
||||
#include "ttyio.h"
|
||||
@ -39,7 +43,7 @@ make_basename(const char *filepath)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if ( !(p=strrchr(filepath, '/')) )
|
||||
if ( !(p=strrchr(filepath, DIRSEP_C)) )
|
||||
#ifdef HAVE_DRIVE_LETTERS
|
||||
if ( !(p=strrchr(filepath, '\\')) )
|
||||
if ( !(p=strrchr(filepath, ':')) )
|
||||
@ -66,13 +70,13 @@ make_dirname(const char *filepath)
|
||||
int dirname_length;
|
||||
char *p;
|
||||
|
||||
if ( !(p=strrchr(filepath, '/')) )
|
||||
if ( !(p=strrchr(filepath, DIRSEP_C)) )
|
||||
#ifdef HAVE_DRIVE_LETTERS
|
||||
if ( !(p=strrchr(filepath, '\\')) )
|
||||
if ( !(p=strrchr(filepath, ':')) )
|
||||
#endif
|
||||
{
|
||||
return m_strdup(".");
|
||||
return m_strdup(EXTSEP_S);
|
||||
}
|
||||
|
||||
dirname_length = p-filepath;
|
||||
@ -103,20 +107,30 @@ make_filename( const char *first_part, ... )
|
||||
n += strlen(s) + 1;
|
||||
va_end(arg_ptr);
|
||||
|
||||
#ifndef __riscos__
|
||||
home = NULL;
|
||||
if( *first_part == '~' && first_part[1] == '/'
|
||||
if( *first_part == '~' && first_part[1] == DIRSEP_C
|
||||
&& (home = getenv("HOME")) && *home )
|
||||
n += strlen(home);
|
||||
|
||||
name = m_alloc(n);
|
||||
p = home ? stpcpy(stpcpy(name,home), first_part+1)
|
||||
: stpcpy(name, first_part);
|
||||
#else /* __riscos__ */
|
||||
name = m_alloc(n);
|
||||
p = stpcpy(name, first_part);
|
||||
#endif /* __riscos__ */
|
||||
va_start( arg_ptr, first_part ) ;
|
||||
while( (s=va_arg(arg_ptr, const char *)) )
|
||||
p = stpcpy(stpcpy(p,"/"), s);
|
||||
p = stpcpy(stpcpy(p, DIRSEP_S), s);
|
||||
va_end(arg_ptr);
|
||||
|
||||
#ifndef __riscos__
|
||||
return name;
|
||||
#else /* __riscos__ */
|
||||
p = gstrans(name);
|
||||
m_free(name);
|
||||
return p;
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
|
||||
@ -126,11 +140,26 @@ compare_filenames( const char *a, const char *b )
|
||||
/* ? check whether this is an absolute filename and
|
||||
* resolve symlinks?
|
||||
*/
|
||||
#ifndef __riscos__
|
||||
#ifdef HAVE_DRIVE_LETTERS
|
||||
return ascii_strcasecmp(a,b);
|
||||
#else
|
||||
return strcmp(a,b);
|
||||
#endif
|
||||
#else /* __riscos__ */
|
||||
int c = 0;
|
||||
char *abuf, *bbuf;
|
||||
|
||||
abuf = gstrans(a);
|
||||
bbuf = gstrans(b);
|
||||
|
||||
c = stricmp(abuf, bbuf);
|
||||
|
||||
m_free(abuf);
|
||||
m_free(bbuf);
|
||||
|
||||
return c;
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
|
||||
|
13
util/http.c
13
util/http.c
@ -45,6 +45,14 @@
|
||||
|
||||
#include "http.h"
|
||||
|
||||
#ifdef __riscos__
|
||||
#define HTTP_PROXY_ENV "GnuPG$HttpProxy"
|
||||
#define HTTP_PROXY_ENV_PRINTABLE "<GnuPG$HttpProxy>"
|
||||
#else
|
||||
#define HTTP_PROXY_ENV "http_proxy"
|
||||
#define HTTP_PROXY_ENV_PRINTABLE "$http_proxy"
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define sock_close(a) closesocket(a)
|
||||
#else
|
||||
@ -475,12 +483,13 @@ send_request( HTTP_HD hd )
|
||||
port = hd->uri->port? hd->uri->port : 80;
|
||||
|
||||
if( (hd->flags & HTTP_FLAG_TRY_PROXY)
|
||||
&& (http_proxy = getenv( "http_proxy" )) ) {
|
||||
&& (http_proxy = getenv( HTTP_PROXY_ENV )) ) {
|
||||
PARSED_URI uri;
|
||||
|
||||
rc = parse_uri( &uri, http_proxy );
|
||||
if (rc) {
|
||||
log_error("invalid $http_proxy: %s\n", g10_errstr(rc));
|
||||
log_error("invalid " HTTP_PROXY_ENV_PRINTABLE ": %s\n",
|
||||
g10_errstr(rc));
|
||||
release_parsed_uri( uri );
|
||||
return G10ERR_NETWORK;
|
||||
}
|
||||
|
10
util/iobuf.c
10
util/iobuf.c
@ -32,6 +32,10 @@
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#ifdef __riscos__
|
||||
#include <kernel.h>
|
||||
#include <sys/swis.h>
|
||||
#endif /* __riscos__ */
|
||||
|
||||
#include "memory.h"
|
||||
#include "util.h"
|
||||
@ -921,14 +925,14 @@ iobuf_cancel( IOBUF a )
|
||||
const char *s;
|
||||
IOBUF a2;
|
||||
int rc;
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||
char *remove_name = NULL;
|
||||
#endif
|
||||
|
||||
if( a && a->use == 2 ) {
|
||||
s = iobuf_get_real_fname(a);
|
||||
if( s && *s ) {
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||
remove_name = m_strdup ( s );
|
||||
#else
|
||||
remove(s);
|
||||
@ -945,7 +949,7 @@ iobuf_cancel( IOBUF a )
|
||||
}
|
||||
|
||||
rc = iobuf_close(a);
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||
if ( remove_name ) {
|
||||
/* Argg, MSDOS does not allow to remove open files. So
|
||||
* we have to do it here */
|
||||
|
@ -117,6 +117,9 @@ g10_log_print_prefix(const char *text)
|
||||
fprintf(logfp, "%s%s: %s", pgm_name, pidstring, text );
|
||||
else
|
||||
fprintf(logfp, "?%s: %s", pidstring, text );
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -128,6 +131,9 @@ print_prefix_f(const char *text, const char *fname)
|
||||
fprintf(logfp, "%s%s:%s: %s", pgm_name, pidstring, fname, text );
|
||||
else
|
||||
fprintf(logfp, "?%s:%s: %s", pidstring, fname, text );
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
void
|
||||
@ -139,6 +145,9 @@ g10_log_info( const char *fmt, ... )
|
||||
va_start( arg_ptr, fmt ) ;
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
void
|
||||
@ -150,6 +159,9 @@ g10_log_info_f( const char *fname, const char *fmt, ... )
|
||||
va_start( arg_ptr, fmt ) ;
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
void
|
||||
@ -162,6 +174,9 @@ g10_log_error( const char *fmt, ... )
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
errorcount++;
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
void
|
||||
@ -174,6 +189,9 @@ g10_log_error_f( const char *fname, const char *fmt, ... )
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
errorcount++;
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
void
|
||||
@ -186,6 +204,9 @@ g10_log_fatal( const char *fmt, ... )
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
secmem_dump_stats();
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@ -199,6 +220,9 @@ g10_log_fatal_f( const char *fname, const char *fmt, ... )
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
secmem_dump_stats();
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@ -217,7 +241,8 @@ g10_log_bug( const char *fmt, ... )
|
||||
abort();
|
||||
}
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
|
||||
#if !defined (__riscos__) \
|
||||
&& ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 ))
|
||||
void
|
||||
g10_log_bug0( const char *file, int line, const char *func )
|
||||
{
|
||||
@ -240,6 +265,9 @@ g10_log_debug( const char *fmt, ... )
|
||||
va_start( arg_ptr, fmt ) ;
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
void
|
||||
@ -251,6 +279,9 @@ g10_log_debug_f( const char *fname, const char *fmt, ... )
|
||||
va_start( arg_ptr, fmt ) ;
|
||||
vfprintf(logfp,fmt,arg_ptr) ;
|
||||
va_end(arg_ptr);
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
|
||||
@ -264,6 +295,9 @@ g10_log_hexdump( const char *text, const char *buf, size_t len )
|
||||
for(i=0; i < len; i++ )
|
||||
fprintf(logfp, " %02X", ((const byte*)buf)[i] );
|
||||
fputc('\n', logfp);
|
||||
#ifdef __riscos__
|
||||
fflush( logfp );
|
||||
#endif /* __riscos__ */
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,8 +73,13 @@
|
||||
#define FNAME(a) m_debug_ ##a
|
||||
#define FNAMEPRT , const char *info
|
||||
#define FNAMEARG , info
|
||||
#define store_len(p,n,m) do { add_entry(p,n,m, \
|
||||
#ifndef __riscos__
|
||||
#define store_len(p,n,m) do { add_entry(p,n,m, \
|
||||
info, __FUNCTION__); } while(0)
|
||||
#else
|
||||
#define store_len(p,n,m) do { add_entry(p,n,m, \
|
||||
info, "[" __FILE__ ":" STR(__LINE__) "]" ); } while(0)
|
||||
#endif
|
||||
#else
|
||||
#define FNAME(a) m_ ##a
|
||||
#define FNAMEPRT
|
||||
@ -321,9 +326,15 @@ check_allmem( const char *info )
|
||||
unsigned n;
|
||||
struct memtbl_entry *e;
|
||||
|
||||
for( e = memtbl, n = 0; n < memtbl_len; n++, e++ )
|
||||
if( e->inuse )
|
||||
for( e = memtbl, n = 0; n < memtbl_len; n++, e++ ) {
|
||||
if( e->inuse ) {
|
||||
#ifndef __riscos__
|
||||
check_mem(e->user_p-4-EXTRA_ALIGN, info);
|
||||
#else
|
||||
check_mem((const byte *) e->user_p-4-EXTRA_ALIGN, info);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* M_DEBUG */
|
||||
@ -373,7 +384,7 @@ m_print_stats( const char *prefix )
|
||||
void
|
||||
m_dump_table( const char *prefix )
|
||||
{
|
||||
#if M_DEBUG
|
||||
#ifdef M_DEBUG
|
||||
fprintf(stderr,"Memory-Table-Dump: %s\n", prefix);
|
||||
dump_table();
|
||||
#endif
|
||||
@ -507,7 +518,7 @@ FNAME(free)( void *a FNAMEPRT )
|
||||
return;
|
||||
#ifdef M_DEBUG
|
||||
free_entry(p-EXTRA_ALIGN-4, info);
|
||||
#elif M_GUARD
|
||||
#elif defined M_GUARD
|
||||
m_check(p);
|
||||
if( m_is_secure(a) )
|
||||
secmem_free(p-EXTRA_ALIGN-4);
|
||||
|
315
util/riscos.c
Normal file
315
util/riscos.c
Normal file
@ -0,0 +1,315 @@
|
||||
/* riscos.c - RISC OS stuff
|
||||
* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG for RISC OS.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifndef __RISCOS__C__
|
||||
#define __RISCOS__C__
|
||||
|
||||
#include <config.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <kernel.h>
|
||||
#include <sys/swis.h>
|
||||
#include "util.h"
|
||||
#include "memory.h"
|
||||
|
||||
#define __UNIXLIB_INTERNALS
|
||||
#include <sys/unix.h>
|
||||
#undef __UNIXLIB_INTERNALS
|
||||
|
||||
|
||||
/* RISC OS file open descriptor control list */
|
||||
|
||||
struct fds_item {
|
||||
int fd;
|
||||
struct fds_item *next;
|
||||
};
|
||||
static struct fds_item *fds_list = NULL;
|
||||
|
||||
|
||||
/* RISC OS functions */
|
||||
|
||||
pid_t
|
||||
riscos_getpid(void)
|
||||
{
|
||||
_kernel_swi_regs r;
|
||||
|
||||
r.r[0] = 3;
|
||||
if (_kernel_swi(Wimp_ReadSysInfo, &r, &r))
|
||||
log_fatal("Wimp_ReadSysInfo failed: Couldn't get WimpState (R0=3)!\n");
|
||||
|
||||
if (!r.r[0])
|
||||
return (pid_t) 0;
|
||||
|
||||
r.r[0] = 5;
|
||||
if (_kernel_swi(Wimp_ReadSysInfo, &r, &r))
|
||||
log_fatal("Wimp_ReadSysInfo failed: Couldn't get task handle (R0=5)!\n");
|
||||
|
||||
return (pid_t) r.r[0];
|
||||
}
|
||||
|
||||
int
|
||||
riscos_kill(pid_t pid, int sig)
|
||||
{
|
||||
_kernel_swi_regs r;
|
||||
int buf[4];
|
||||
|
||||
if (sig)
|
||||
kill(pid, sig);
|
||||
|
||||
r.r[0] = 0;
|
||||
do {
|
||||
r.r[1] = (int) buf;
|
||||
r.r[2] = 16;
|
||||
if (_kernel_swi(TaskManager_EnumerateTasks, &r, &r))
|
||||
log_fatal("TaskManager_EnumerateTasks failed!\n");
|
||||
if (buf[0] == pid)
|
||||
return 0;
|
||||
} while (r.r[0] >= 0);
|
||||
|
||||
return __set_errno(ESRCH);
|
||||
}
|
||||
|
||||
FILE *
|
||||
riscos_fopen(const char *filename, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
_kernel_swi_regs r;
|
||||
_kernel_oserror *e;
|
||||
int filetype;
|
||||
|
||||
r.r[0] = 17;
|
||||
r.r[1] = (int) filename;
|
||||
if( e =_kernel_swi(OS_File, &r, &r) )
|
||||
log_fatal("can't retrieve object information for %s\n", filename);
|
||||
if( r.r[0] == 2) {
|
||||
errno = EISDIR;
|
||||
return NULL;
|
||||
}
|
||||
if( r.r[0] == 3) {
|
||||
/* setting file to to non-image file, after fopening, restore */
|
||||
filetype = (r.r[2] >> 8) & 0xfff;
|
||||
set_filetype(filename, 0xfff);
|
||||
fp = fopen(filename, mode);
|
||||
set_filetype(filename, filetype);
|
||||
} else {
|
||||
fp = fopen(filename, mode);
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
|
||||
int
|
||||
riscos_open(const char *filename, int oflag, ...)
|
||||
{
|
||||
va_list ap;
|
||||
_kernel_swi_regs r;
|
||||
_kernel_oserror *e;
|
||||
int fd, mode, filetype;
|
||||
|
||||
r.r[0] = 17;
|
||||
r.r[1] = (int) filename;
|
||||
if( e =_kernel_swi(OS_File, &r, &r) )
|
||||
log_fatal("can't retrieve object information for %s\n", filename);
|
||||
if( r.r[0] == 2) {
|
||||
errno = EISDIR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_start(ap, oflag);
|
||||
mode = va_arg(ap, int);
|
||||
va_end(ap);
|
||||
|
||||
if( r.r[0] == 3) {
|
||||
/* setting file to to non-image file, after fopening, restore */
|
||||
filetype = (r.r[2] >> 8) & 0xfff;
|
||||
set_filetype(filename, 0xfff);
|
||||
if (!mode)
|
||||
fd = open(filename, oflag);
|
||||
else
|
||||
fd = open(filename, oflag, mode);
|
||||
set_filetype(filename, filetype);
|
||||
} else {
|
||||
if (!mode)
|
||||
fd = open(filename, oflag);
|
||||
else
|
||||
fd = open(filename, oflag, mode);
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
int
|
||||
riscos_fstat(int fildes, struct stat *buf)
|
||||
{
|
||||
_kernel_swi_regs r;
|
||||
_kernel_oserror *e;
|
||||
char *filename;
|
||||
int rc, filetype;
|
||||
int handle = (int) __u->fd[fildes].handle;
|
||||
|
||||
r.r[0] = 7;
|
||||
r.r[1] = handle;
|
||||
r.r[2] = 0;
|
||||
r.r[5] = 0;
|
||||
if (e = _kernel_swi(OS_Args, &r, &r))
|
||||
log_fatal("can't convert from file handle to name\n");
|
||||
|
||||
filename = m_alloc(1 - r.r[5]);
|
||||
|
||||
r.r[0] = 7;
|
||||
r.r[1] = handle;
|
||||
r.r[2] = (int) filename;
|
||||
r.r[5] = 1-r.r[5];
|
||||
if (e = _kernel_swi(OS_Args, &r, &r))
|
||||
log_fatal("can't convert from file handle to name\n");
|
||||
|
||||
r.r[0] = 17;
|
||||
r.r[1] = (int) filename;
|
||||
if( e =_kernel_swi(OS_File, &r, &r) )
|
||||
log_fatal("can't retrieve object information for %s\n", filename);
|
||||
if( r.r[0] == 2) {
|
||||
errno = EISDIR;
|
||||
return NULL;
|
||||
}
|
||||
if( r.r[0] == 3) {
|
||||
/* setting file to to non-image file, after fopening, restore */
|
||||
filetype = (r.r[2] >> 8) & 0xfff;
|
||||
set_filetype(filename, 0xfff);
|
||||
rc = fstat(fildes, buf);
|
||||
set_filetype(filename, filetype);
|
||||
} else {
|
||||
rc = fstat(fildes, buf);
|
||||
}
|
||||
|
||||
m_free(filename);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
fdopenfile(const char *filename, const int allow_write)
|
||||
{
|
||||
struct fds_item *h;
|
||||
static int initialized;
|
||||
int fd = open(filename, allow_write ? O_CREAT | O_RDWR : O_RDONLY);
|
||||
if( fd == -1 )
|
||||
log_fatal("can't open file %s\n", filename);
|
||||
|
||||
if( !initialized ) {
|
||||
atexit( close_fds );
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
h = fds_list;
|
||||
fds_list = (struct fds_item *) m_alloc( sizeof( struct fds_item ) );
|
||||
fds_list->fd = fd;
|
||||
fds_list->next = h;
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
void
|
||||
close_fds(void)
|
||||
{
|
||||
FILE *fp;
|
||||
struct fds_item *h2, *h1 = fds_list;
|
||||
while( h1 ) {
|
||||
h2 = h1->next;
|
||||
fp = fdopen (h2->fd, "a");
|
||||
if (fp)
|
||||
fflush (fp);
|
||||
close( h2->fd );
|
||||
m_free( h1 );
|
||||
h1 = h2;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
renamefile(const char *old, const char *new)
|
||||
{
|
||||
_kernel_swi_regs r;
|
||||
_kernel_oserror *e;
|
||||
|
||||
r.r[0] = 25;
|
||||
r.r[1] = (int) old;
|
||||
r.r[2] = (int) new;
|
||||
if (e = _kernel_swi(OS_FSControl, &r, &r)) {
|
||||
if (e->errnum == 214)
|
||||
return __set_errno(ENOENT);
|
||||
if (e->errnum == 176)
|
||||
return __set_errno(EEXIST);
|
||||
printf("Error during renaming: %i, %s\n", e->errnum, e->errmess);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
gstrans(const char *old)
|
||||
{
|
||||
_kernel_swi_regs r;
|
||||
int c = 0;
|
||||
int size = 256;
|
||||
char *buf, *tmp;
|
||||
|
||||
buf = (char *) m_alloc(size);
|
||||
do {
|
||||
r.r[0] = (int) old;
|
||||
r.r[1] = (int) buf;
|
||||
r.r[2] = size;
|
||||
_kernel_swi_c(OS_GSTrans, &r, &r, &c);
|
||||
if (c) {
|
||||
size += 256;
|
||||
tmp = (char *) m_realloc(buf, size);
|
||||
if (!tmp)
|
||||
log_fatal("can't claim memory for OS_GSTrans buffer!\n");
|
||||
buf = tmp;
|
||||
}
|
||||
} while (c);
|
||||
|
||||
buf[r.r[2]] = '\0';
|
||||
tmp = (char *) m_realloc(buf, r.r[2] + 1);
|
||||
if (!tmp)
|
||||
log_fatal("can't realloc memory after OS_GSTrans!\n");
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void
|
||||
set_filetype(const char *filename, const 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 %s\n", filename);
|
||||
}
|
||||
|
||||
void
|
||||
not_implemented(const char *feature)
|
||||
{
|
||||
log_info("%s is not implemented in the RISC OS version!\n", feature);
|
||||
}
|
||||
|
||||
#endif /* !__RISCOS__C__ */
|
@ -168,6 +168,11 @@ lock_pool( void *p, size_t n )
|
||||
/* It does not make sense to print such a warning, given the fact that
|
||||
* this whole Windows !@#$% and their user base are inherently insecure
|
||||
*/
|
||||
#elif defined (__riscos__)
|
||||
/* no virtual memory on RISC OS, so no pages are swapped to disc,
|
||||
* besides we don't have mmap, so we don't use it! ;-)
|
||||
* But don't complain, as explained above.
|
||||
*/
|
||||
#else
|
||||
log_info("Please note that you don't have secure memory on this system\n");
|
||||
#endif
|
||||
@ -267,6 +272,7 @@ void
|
||||
secmem_init( size_t n )
|
||||
{
|
||||
if( !n ) {
|
||||
#ifndef __riscos__
|
||||
#ifdef USE_CAPABILITIES
|
||||
/* drop all capabilities */
|
||||
cap_set_proc( cap_from_text("all-eip") );
|
||||
@ -281,6 +287,7 @@ secmem_init( size_t n )
|
||||
log_fatal("failed to drop setuid\n" );
|
||||
}
|
||||
#endif
|
||||
#endif /* !__riscos__ */
|
||||
}
|
||||
else {
|
||||
if( n < DEFAULT_POOLSIZE )
|
||||
|
64
util/ttyio.c
64
util/ttyio.c
@ -26,6 +26,11 @@
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_TCGETATTR
|
||||
#include <termios.h>
|
||||
#ifdef __riscos__
|
||||
#include <kernel.h>
|
||||
#include <sys/swis.h>
|
||||
#undef HAVE_TCGETATTR
|
||||
#endif /* __riscos__ */
|
||||
#else
|
||||
#ifdef HAVE_TERMIO_H
|
||||
/* simulate termios with termio */
|
||||
@ -75,10 +80,16 @@ static int batchmode;
|
||||
static int no_terminal;
|
||||
|
||||
#ifdef HAVE_TCGETATTR
|
||||
static struct termios termsave;
|
||||
static int restore_termios;
|
||||
#ifdef __riscos__
|
||||
struct termios termsave;
|
||||
int restore_termios;
|
||||
#else
|
||||
static struct termios termsave;
|
||||
static int restore_termios;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_TCGETATTR
|
||||
static void
|
||||
cleanup(void)
|
||||
@ -273,7 +284,12 @@ static char *
|
||||
do_get( const char *prompt, int hidden )
|
||||
{
|
||||
char *buf;
|
||||
#ifndef __riscos__
|
||||
byte cbuf[1];
|
||||
#else
|
||||
int carry;
|
||||
_kernel_swi_regs r;
|
||||
#endif
|
||||
int c, n, i;
|
||||
|
||||
if( batchmode ) {
|
||||
@ -328,6 +344,50 @@ do_get( const char *prompt, int hidden )
|
||||
if( hidden )
|
||||
SetConsoleMode(con.in, DEF_INPMODE );
|
||||
|
||||
#elif defined(__riscos__)
|
||||
do {
|
||||
if (_kernel_swi_c(OS_ReadC, &r, &r, &carry))
|
||||
log_fatal("OS_ReadC failed: Couldn't read from keyboard!\n");
|
||||
c = r.r[0];
|
||||
if (carry != 0)
|
||||
log_fatal("OS_ReadC failed: Return Code = %i!\n", c);
|
||||
if (c == 0xa || c == 0xd) { /* Return || Enter */
|
||||
c = (int) '\n';
|
||||
} else if (c == 0x8 || c == 0x7f) { /* Backspace || Delete */
|
||||
if (i>0) {
|
||||
i--;
|
||||
if (!hidden) {
|
||||
last_prompt_len--;
|
||||
fputc(8, ttyfp);
|
||||
fputc(32, ttyfp);
|
||||
fputc(8, ttyfp);
|
||||
fflush(ttyfp);
|
||||
}
|
||||
} else {
|
||||
fputc(7, ttyfp);
|
||||
fflush(ttyfp);
|
||||
}
|
||||
continue;
|
||||
} else if (c == (int) '\t') { /* Tab */
|
||||
c = ' ';
|
||||
} else if (c > 0xa0) {
|
||||
; /* we don't allow 0xa0, as this is a protected blank which may
|
||||
* confuse the user */
|
||||
} else if (iscntrl(c)) {
|
||||
continue;
|
||||
}
|
||||
if(!(i < n-1)) {
|
||||
n += 50;
|
||||
buf = m_realloc(buf, n);
|
||||
}
|
||||
buf[i++] = c;
|
||||
if (!hidden) {
|
||||
last_prompt_len++;
|
||||
fputc(c, ttyfp);
|
||||
fflush(ttyfp);
|
||||
}
|
||||
} while (c != '\n');
|
||||
i = (i>0) ? i-1 : 0;
|
||||
#else /* unix version */
|
||||
if( hidden ) {
|
||||
#ifdef HAVE_TCGETATTR
|
||||
|
Loading…
x
Reference in New Issue
Block a user