• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * $Header$
3  * $Source$
4  * $Locker$
5  *
6  * Copyright 1986, 1987, 1988 by MIT Information Systems and
7  *	the MIT Student Information Processing Board.
8  *
9  * Permission to use, copy, modify, and distribute this software and
10  * its documentation for any purpose is hereby granted, provided that
11  * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
12  * advertising or publicity pertaining to distribution of the software
13  * without specific, written prior permission.  M.I.T. and the
14  * M.I.T. S.I.P.B. make no representations about the suitability of
15  * this software for any purpose.  It is provided "as is" without
16  * express or implied warranty.
17  */
18 
19 #include <stdio.h>
20 #include <errno.h>
21 #ifdef HAVE_STDLIB_H
22 #include <stdlib.h>
23 #endif
24 #include "com_err.h"
25 #include "error_table.h"
26 
27 struct foobar {
28     struct et_list etl;
29     struct error_table et;
30 };
31 
32 extern struct et_list * _et_dynamic_list;
33 
init_error_table(const char * const * msgs,long base,int count)34 int init_error_table(const char * const *msgs, long base, int count)
35 {
36     struct foobar * new_et;
37 
38     if (!base || !count || !msgs)
39 	return 0;
40 
41     new_et = (struct foobar *) malloc(sizeof(struct foobar));
42     if (!new_et)
43 	return ENOMEM;	/* oops */
44     new_et->etl.table = &new_et->et;
45     new_et->et.msgs = msgs;
46     new_et->et.base = base;
47     new_et->et.n_msgs= count;
48 
49     new_et->etl.next = _et_dynamic_list;
50     _et_dynamic_list = &new_et->etl;
51     return 0;
52 }
53