Now uses generated ASN1-code.
kinit should be able to get a initial message from FOO.SE. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@844 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
64
lib/asn1/symbol.c
Normal file
64
lib/asn1/symbol.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "symbol.h"
|
||||
#include "hash.h"
|
||||
|
||||
static Hashtab *htab;
|
||||
|
||||
static int
|
||||
cmp (void *a, void *b)
|
||||
{
|
||||
Symbol *s1 = (Symbol *)a;
|
||||
Symbol *s2 = (Symbol *)b;
|
||||
|
||||
return strcmp (s1->name, s2->name);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hash (void *a)
|
||||
{
|
||||
Symbol *s = (Symbol *)a;
|
||||
|
||||
return hashjpw (s->name);
|
||||
}
|
||||
|
||||
void
|
||||
initsym ()
|
||||
{
|
||||
htab = hashtabnew (101, cmp, hash);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
output_name (char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = s; *p; ++p)
|
||||
if (*p == '-')
|
||||
*p = '_';
|
||||
}
|
||||
|
||||
Symbol*
|
||||
addsym (char *name)
|
||||
{
|
||||
Symbol key, *s;
|
||||
|
||||
key.name = name;
|
||||
s = (Symbol *)hashtabsearch (htab, (void *)&key);
|
||||
if (s == NULL) {
|
||||
char *p;
|
||||
|
||||
s = (Symbol *)malloc (sizeof (*s));
|
||||
s->name = name;
|
||||
s->gen_name = strdup(name);
|
||||
output_name (s->gen_name);
|
||||
s->stype = SUndefined;
|
||||
hashtabadd (htab, s);
|
||||
}
|
||||
return s;
|
||||
}
|
Reference in New Issue
Block a user