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