Home | History | Annotate | Download | only in et
      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 "config.h"
     20 #include <stdio.h>
     21 #include <errno.h>
     22 #ifdef HAVE_STDLIB_H
     23 #include <stdlib.h>
     24 #endif
     25 #include "com_err.h"
     26 #include "error_table.h"
     27 
     28 struct foobar {
     29     struct et_list etl;
     30     struct error_table et;
     31 };
     32 
     33 extern struct et_list * _et_dynamic_list;
     34 
     35 int init_error_table(const char * const *msgs, long base, int count)
     36 {
     37     struct foobar * new_et;
     38 
     39     if (!base || !count || !msgs)
     40 	return 0;
     41 
     42     new_et = (struct foobar *) malloc(sizeof(struct foobar));
     43     if (!new_et)
     44 	return ENOMEM;	/* oops */
     45     new_et->etl.table = &new_et->et;
     46     new_et->et.msgs = msgs;
     47     new_et->et.base = base;
     48     new_et->et.n_msgs= count;
     49 
     50     new_et->etl.next = _et_dynamic_list;
     51     _et_dynamic_list = &new_et->etl;
     52     return 0;
     53 }
     54