mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Sun Apr 18 10:11:28 CEST 1999 Werner Koch
This commit is contained in:
parent
02d018f9c8
commit
1feae2011c
50 changed files with 547 additions and 502 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Apr 18 10:11:28 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* argparse.c (store_alias): Disabled becuase it is not used.
|
||||
|
||||
* ttyio.c (tty_batchmode): New
|
||||
|
||||
Sat Mar 20 11:44:21 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* http.c: Swapped to includes.
|
||||
|
|
|
@ -197,15 +197,20 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
|
|||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
store_alias( ARGPARSE_ARGS *arg, char *name, char *value )
|
||||
{
|
||||
/* TODO: replace this dummy function with a rea one
|
||||
* and fix the probelms IRIX has with (ALIAS_DEV)arg..
|
||||
* used as lvalue
|
||||
*/
|
||||
#if 0
|
||||
ALIAS_DEF a = m_alloc( sizeof *a );
|
||||
a->name = name;
|
||||
a->value = value;
|
||||
a->next = (ALIAS_DEF)arg->internal.aliases;
|
||||
(ALIAS_DEF)arg->internal.aliases = a;
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************
|
||||
|
@ -418,7 +423,7 @@ find_long_option( ARGPARSE_ARGS *arg,
|
|||
/* see whether it is an alias */
|
||||
for( a = args->internal.aliases; a; a = a->next ) {
|
||||
if( !strcmp( a->name, keyword) ) {
|
||||
/* fixme: must parse the alias here */
|
||||
/* todo: must parse the alias here */
|
||||
args->internal.cur_alias = a;
|
||||
return -3; /* alias available */
|
||||
}
|
||||
|
|
10
util/http.c
10
util/http.c
|
@ -270,7 +270,7 @@ do_parse_uri( PARSED_URI uri, int only_local_part )
|
|||
if( !p || !*p ) /* we don't have a path */
|
||||
return 0; /* and this is okay */
|
||||
|
||||
/* fixme: here we have to check params */
|
||||
/* todo: here we have to check params */
|
||||
|
||||
/* do we have a query part */
|
||||
if( (p2 = strchr( p, '?' )) )
|
||||
|
@ -463,7 +463,7 @@ build_rel_path( PARSED_URI uri )
|
|||
|
||||
/* count the needed space */
|
||||
n = insert_escapes( NULL, uri->path, "%;?&" );
|
||||
/* fixme: add params */
|
||||
/* todo: build params */
|
||||
for( r=uri->query; r; r = r->next ) {
|
||||
n++; /* '?'/'&' */
|
||||
n += insert_escapes( NULL, r->name, "%;?&=" );
|
||||
|
@ -476,13 +476,13 @@ build_rel_path( PARSED_URI uri )
|
|||
p = rel_path = m_alloc( n );
|
||||
n = insert_escapes( p, uri->path, "%;?&" );
|
||||
p += n;
|
||||
/* fixme: add params */
|
||||
/* todo: add params */
|
||||
for( r=uri->query; r; r = r->next ) {
|
||||
*p++ = r == uri->query? '?':'&';
|
||||
n = insert_escapes( p, r->name, "%;?&=" );
|
||||
p += n;
|
||||
*p++ = '=';
|
||||
/* fixme: use valuelen */
|
||||
/* todo: use valuelen */
|
||||
n = insert_escapes( p, r->value, "%;?&=" );
|
||||
p += n;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ parse_response( HTTP_HD hd )
|
|||
if( !p2 )
|
||||
return 0; /* assume http 0.9 */
|
||||
p = p2;
|
||||
/* fixme: add HTTP version number check here */
|
||||
/* todo: add HTTP version number check here */
|
||||
if( (p2 = strpbrk( p, " \t" ) ) )
|
||||
*p2++ = 0;
|
||||
if( !isdigit(p[0]) || !isdigit(p[1]) || !isdigit(p[2]) || p[3] ) {
|
||||
|
|
|
@ -123,19 +123,20 @@ static void check_allmem( const char *info );
|
|||
static void
|
||||
add_entry( byte *p, unsigned n, int mode, const char *info, const char *by )
|
||||
{
|
||||
unsigned idx;
|
||||
unsigned index;
|
||||
struct memtbl_entry *e;
|
||||
struct info_entry *ie;
|
||||
|
||||
if( memtbl_len < memtbl_size )
|
||||
idx = memtbl_len++;
|
||||
index = memtbl_len++;
|
||||
else {
|
||||
struct memtbl_entry *e;
|
||||
/* look for a used entry in the table. We take the first one,
|
||||
* so that freed entries remain as long as possible in the table
|
||||
* (free appends a new one)
|
||||
*/
|
||||
if( (e = memtbl_unused) ) {
|
||||
idx = e - memtbl;
|
||||
index = e - memtbl;
|
||||
memtbl_unused = e->next;
|
||||
e->next = NULL;
|
||||
}
|
||||
|
@ -144,33 +145,32 @@ add_entry( byte *p, unsigned n, int mode, const char *info, const char *by )
|
|||
memtbl_size = 100;
|
||||
if( !(memtbl = calloc( memtbl_size, sizeof *memtbl )) )
|
||||
membug("memory debug table malloc failed\n");
|
||||
idx = 0;
|
||||
index = 0;
|
||||
memtbl_len = 1;
|
||||
atexit( dump_table_at_exit );
|
||||
}
|
||||
else { /* realloc */
|
||||
unsigned nn = memtbl_size / 4; /* enlarge by 25% */
|
||||
if(!(memtbl = realloc(memtbl, (memtbl_size+nn)*sizeof *memtbl)))
|
||||
unsigned n = memtbl_size / 4; /* enlarge by 25% */
|
||||
if(!(memtbl = realloc(memtbl, (memtbl_size+n)*sizeof *memtbl)))
|
||||
membug("memory debug table realloc failed\n");
|
||||
memset(memtbl+memtbl_size, 0, n*sizeof *memtbl );
|
||||
memtbl_size += nn;
|
||||
idx = memtbl_len++;
|
||||
memtbl_size += n;
|
||||
index = memtbl_len++;
|
||||
}
|
||||
}
|
||||
}
|
||||
e = memtbl+idx;
|
||||
e = memtbl+index;
|
||||
if( e->inuse )
|
||||
membug("Ooops: entry %u is flagged as in use\n", idx);
|
||||
membug("Ooops: entry %u is flagged as in use\n", index);
|
||||
e->user_p = p + 4;
|
||||
e->user_n = n;
|
||||
e->count++;
|
||||
if( e->next )
|
||||
membug("Ooops: entry is in free entry list\n");
|
||||
/* do we already have this info string */
|
||||
for( ie = info_strings[info_hash(info)]; ie; ie = ie->next ) {
|
||||
for( ie = info_strings[info_hash(info)]; ie; ie = ie->next )
|
||||
if( ie->info == info )
|
||||
break;
|
||||
}
|
||||
if( !ie ) { /* no: make a new entry */
|
||||
if( !(ie = malloc( sizeof *ie )) )
|
||||
membug("can't allocate info entry\n");
|
||||
|
@ -184,9 +184,9 @@ add_entry( byte *p, unsigned n, int mode, const char *info, const char *by )
|
|||
e->inuse = 1;
|
||||
|
||||
/* put the index at the start of the memory */
|
||||
p[0] = idx;
|
||||
p[1] = idx >> 8 ;
|
||||
p[2] = idx >> 16 ;
|
||||
p[0] = index;
|
||||
p[1] = index >> 8 ;
|
||||
p[2] = index >> 16 ;
|
||||
p[3] = mode? MAGIC_SEC_BYTE : MAGIC_NOR_BYTE ;
|
||||
if( DBG_MEMORY )
|
||||
log_debug( "%s allocates %u bytes using %s\n", info, e->user_n, by );
|
||||
|
|
|
@ -324,6 +324,8 @@ secmem_free( void *a )
|
|||
|
||||
mb = (MEMBLOCK*)((char*)a - ((size_t) &((MEMBLOCK*)0)->u.aligned.c));
|
||||
size = mb->size;
|
||||
/* This does not make much sense: probably this memory is held in the
|
||||
* cache. We do it anyway: */
|
||||
memset(mb, 0xff, size );
|
||||
memset(mb, 0xaa, size );
|
||||
memset(mb, 0x55, size );
|
||||
|
|
|
@ -47,6 +47,25 @@ static ushort koi82unicode[128] = {
|
|||
0x042c,0x042b,0x0417,0x0428,0x042d,0x0429,0x0427,0x042a
|
||||
};
|
||||
|
||||
static ushort latin2_unicode[128] = {
|
||||
0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
|
||||
0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
|
||||
0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
|
||||
0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
|
||||
0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7,
|
||||
0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B,
|
||||
0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7,
|
||||
0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C,
|
||||
0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
|
||||
0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
|
||||
0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
|
||||
0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
|
||||
0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
|
||||
0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
|
||||
0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
|
||||
0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
|
||||
};
|
||||
|
||||
|
||||
|
||||
void
|
||||
|
|
24
util/ttyio.c
24
util/ttyio.c
|
@ -57,6 +57,7 @@ static FILE *ttyfp = NULL;
|
|||
|
||||
static int initialized;
|
||||
static int last_prompt_len;
|
||||
static int batchmode;
|
||||
|
||||
#ifdef HAVE_TCGETATTR
|
||||
static struct termios termsave;
|
||||
|
@ -108,9 +109,11 @@ init_ttyfp(void)
|
|||
#elif defined(__EMX__)
|
||||
ttyfp = stdout; /* Fixme: replace by the real functions: see wklib */
|
||||
#else
|
||||
ttyfp = fopen("/dev/tty", "r+");
|
||||
if( !ttyfp )
|
||||
log_fatal("cannot open /dev/tty: %s\n", strerror(errno) );
|
||||
ttyfp = batchmode? stderr : fopen("/dev/tty", "r+");
|
||||
if( !ttyfp ) {
|
||||
log_error("cannot open /dev/tty: %s\n", strerror(errno) );
|
||||
exit(2);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TCGETATTR
|
||||
atexit( cleanup );
|
||||
|
@ -118,6 +121,14 @@ init_ttyfp(void)
|
|||
initialized = 1;
|
||||
}
|
||||
|
||||
int
|
||||
tty_batchmode( int onoff )
|
||||
{
|
||||
int old = batchmode;
|
||||
if( onoff != -1 )
|
||||
batchmode = onoff;
|
||||
return old;
|
||||
}
|
||||
|
||||
void
|
||||
tty_printf( const char *fmt, ... )
|
||||
|
@ -220,6 +231,11 @@ do_get( const char *prompt, int hidden )
|
|||
byte cbuf[1];
|
||||
int c, n, i;
|
||||
|
||||
if( batchmode ) {
|
||||
log_error("Sorry, we are in batchmode - can't get input\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if( !initialized )
|
||||
init_ttyfp();
|
||||
|
||||
|
@ -336,6 +352,8 @@ tty_kill_prompt()
|
|||
|
||||
if( !initialized )
|
||||
init_ttyfp();
|
||||
if( batchmode )
|
||||
last_prompt_len = 0;
|
||||
if( !last_prompt_len )
|
||||
return;
|
||||
#if __MINGW32__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue