]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - lib/et/init_et.c
Change compile_et to generate header files that use <et/com_err.h>
[thirdparty/e2fsprogs.git] / lib / et / init_et.c
CommitLineData
3839e657
TT
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 *
06cefee5
TT
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.
3839e657
TT
17 */
18
19#include <stdio.h>
f3db3566 20#include <errno.h>
50e1e10f 21#ifdef HAVE_STDLIB_H
f3db3566
TT
22#include <stdlib.h>
23#endif
24#include "com_err.h"
3839e657 25#include "error_table.h"
3839e657 26
3839e657
TT
27struct foobar {
28 struct et_list etl;
29 struct error_table et;
30};
31
32extern struct et_list * _et_list;
33
f3db3566 34int init_error_table(const char * const *msgs, int base, int count)
3839e657
TT
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)
f3db3566 43 return ENOMEM; /* oops */
3839e657
TT
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_list;
50 _et_list = &new_et->etl;
51 return 0;
52}