blob: 772660d80d4649dfc6b9635dee1321a32f678e85 [file] [log] [blame]
Theodore Ts'o3839e651997-04-26 13:21:57 +00001/*
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 *
Theodore Ts'o06cefee1999-10-23 01:16:22 +00009 * 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.
Theodore Ts'o3839e651997-04-26 13:21:57 +000017 */
18
Theodore Ts'od1154eb2011-09-18 17:34:37 -040019#include "config.h"
Theodore Ts'o3839e651997-04-26 13:21:57 +000020#include <stdio.h>
Theodore Ts'of3db3561997-04-26 13:34:30 +000021#include <errno.h>
Theodore Ts'o50e1e101997-04-26 13:58:21 +000022#ifdef HAVE_STDLIB_H
Theodore Ts'of3db3561997-04-26 13:34:30 +000023#include <stdlib.h>
24#endif
25#include "com_err.h"
Theodore Ts'o3839e651997-04-26 13:21:57 +000026#include "error_table.h"
Theodore Ts'o3839e651997-04-26 13:21:57 +000027
Theodore Ts'o3839e651997-04-26 13:21:57 +000028struct foobar {
29 struct et_list etl;
30 struct error_table et;
31};
32
Theodore Ts'od51b8192005-06-20 17:59:06 -040033extern struct et_list * _et_dynamic_list;
Theodore Ts'o3839e651997-04-26 13:21:57 +000034
Theodore Ts'o58f9d9e2003-05-06 00:31:55 -040035int init_error_table(const char * const *msgs, long base, int count)
Theodore Ts'o3839e651997-04-26 13:21:57 +000036{
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)
Theodore Ts'of3db3561997-04-26 13:34:30 +000044 return ENOMEM; /* oops */
Theodore Ts'o3839e651997-04-26 13:21:57 +000045 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
Theodore Ts'od51b8192005-06-20 17:59:06 -040050 new_et->etl.next = _et_dynamic_list;
51 _et_dynamic_list = &new_et->etl;
Theodore Ts'o3839e651997-04-26 13:21:57 +000052 return 0;
53}