Commit 41e0d83c authored by Niels Möller's avatar Niels Möller

New files

Rev: src/.cvsignore:1.1
Rev: src/atoms.c:1.1
Rev: src/atoms.h:1.1
Rev: src/configure.in:1.1
Rev: src/keyexchange.h:1.1
Rev: src/lsh_types.h:1.1
Rev: src/server_keyexchange.c:1.1
Rev: src/server_keyexchange.d:1.1
Rev: src/void.c:1.1
Rev: src/void.h:1.1
Rev: src/werror.c:1.1
Rev: src/werror.h:1.1
Rev: src/xalloc.c:1.1
Rev: src/xalloc.h:1.1
parent 05d0e7dc
Makefile
*.d
/Makefile
/*.d
/* atoms.c
*
*/
#include "atoms.h"
#include "atoms_gperf.c"
struct atom_rassoc
{
UINT8 *name;
UINT32 length;
};
struct atom_rassoc atom_table[] =
#include "atoms_table.c"
;
UINT32 get_atom_length(int atom)
{ return atom_table[atom].length; }
UINT8 *get_atom_name(int atom)
{ return atom_table[atom].name; }
UINT32 lookup_atom(UINT8 *name, UINT32 length)
{
struct atom_assoc *pair = gperf_atom(name, length);
return pair ? pair->id : 0;
}
/* atoms.h
*
*/
#ifndef LSH_ATOMS_H_INCLUDED
#define LSH_ATOMS_H_INCLUDED
#include "lsh_types.h"
#include "atoms_defines.h"
UINT32 get_atom_length(int atom);
UINT8 *get_atom_name(int atom);
UINT32 lookup_atom(UINT8 *name, UINT32 length);
#endif /* LSH_ATOMS_H_INCLUDED */
dnl Process this file with autoconf to produce a configure script.
AC_INIT(keyexchange.h)
AC_CONFIG_HEADER(config.h)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
dnl Checks for libraries.
AC_CHECK_LIB(gmp, mpz_set_d)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(gmp.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
dnl Checks for library functions.
AC_OUTPUT(Makefile, echo timestamp > stamp-h)
/* keyexchange.h
*
*/
#ifndef LSH_KEYEXCHANGE_H_INCLUDED
#define LSH_KEYEXCHANGE_H_INCLUDED
struct server_keyexchange
{
struct packet_processor p;
#endif /* LSH_KEYEXCHANGE_H_INCLUDED */
/* lsh_types.h
*
*/
#ifndef LSH_TYPS_H_INCLUDED
#define LSH_TYPS_H_INCLUDED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if SIZEOF_SHORT >= 4
#define UINT32 unsigned short
#elif SIZEOF_INT >= 4
#define UINT32 unsigned int
#elif SIZEOF_LONG >= 4
#define UINT32 unsigned long
#endif
#define UINT8 unsigned char
#endif /* LSH_TYPS_H_INCLUDED */
/* server_keyexchange.c
*
*/
server_keyexchange.o server_keyexchange.d : server_keyexchange.c
/* void.c
*
*/
#include "void.h"
static int do_ignore(struct pad_processor *closure,
struct simple_packet *packet)
{
free(packet);
return 1;
}
struct packet_processor *make_void_processor()
{
struct void_processor *closure = xalloc(sizeof(struct void_processor));
closure->p->f = (raw_processor_function) do_ignore;
return (struct packet_processor *) closure;
}
/* void.h
*
* A packet processor that destroys all packets.
*/
#ifndef LSH_VOID_H_INCLUDED
#define LSH_VOID_H_INCLUDED
#include "transport.h"
struct void_processor
{
struct packet_processor p;
};
struct packet_processor *make_void_processor();
#endif /* LSH_VOID_H_INCLUDED */
/* werror.c
*
*/
#include "werror.h"
#include <stdio.h>
#include <stdarg.h>
void werror(char *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
}
void fatal(char *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
abort();
}
/* werror.h
*
*/
#ifndef LSH_ERROR_H_INCLUDED
#define LSH_ERROR_H_INCLUDED
#ifdef __GNUC__
#define NORETURN __attribute__ ((noreturn))
#define PRINTF_STYLE(f, a) __attribute__ ((format(printf, f, a)))
#else
#define NORETURN
#define PRINTF_STYLE(f, a)
#endif
void werror(char *format, ...) PRINTF_STYLE(1,2);
void fatal(char *format, ...) PRINTF_STYLE(1,2) NORETURN;
#endif /* LSH_ERROR_H_INCLUDED */
/* xalloc.c
*
*/
#include "xalloc.h"
void *xalloc(size_t size)
{
void *res = malloc(size);
if (!res)
fatal("Virtual memory exhausted");
return res;
}
/* xalloc.h
*
*/
#ifndef LSH_XALLOC_H_INCLUDED
#define LSH_XALLOC_H_INCLUDED
#include <stdlib.h>
#include "werror.h"
void *xalloc(size_t size);
#endif /* LSH_XALLOC_H_INCLUDED */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment