~ubuntu-branches/ubuntu/edgy/e2fsprogs/edgy

« back to all changes in this revision

Viewing changes to lib/et/init_et.c

  • Committer: Bazaar Package Importer
  • Author(s): Yann Dirson
  • Date: 2002-03-21 23:58:48 UTC
  • Revision ID: james.westby@ubuntu.com-20020321235848-cmmy98hy0nihp922
Tags: upstream-1.27
ImportĀ upstreamĀ versionĀ 1.27

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Header: lib/et/SCCS/s.init_et.c 1.15 99/10/23 01:16:06-00:00 tytso@mit.edu $
 
3
 * $Source: /usr/src/e2fsprogs/BK/e2fsprogs/lib/et/SCCS/s.init_et.c $
 
4
 * $Locker: <Not implemented> $
 
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
#ifndef __STDC__
 
28
#define const
 
29
#endif
 
30
 
 
31
struct foobar {
 
32
    struct et_list etl;
 
33
    struct error_table et;
 
34
};
 
35
 
 
36
extern struct et_list * _et_list;
 
37
 
 
38
#ifdef __STDC__
 
39
int init_error_table(const char * const *msgs, int base, int count)
 
40
#else
 
41
int init_error_table(msgs, base, count)
 
42
    const char * const * msgs;
 
43
    int base;
 
44
    int count;
 
45
#endif
 
46
{
 
47
    struct foobar * new_et;
 
48
 
 
49
    if (!base || !count || !msgs)
 
50
        return 0;
 
51
 
 
52
    new_et = (struct foobar *) malloc(sizeof(struct foobar));
 
53
    if (!new_et)
 
54
        return ENOMEM;  /* oops */
 
55
    new_et->etl.table = &new_et->et;
 
56
    new_et->et.msgs = msgs;
 
57
    new_et->et.base = base;
 
58
    new_et->et.n_msgs= count;
 
59
 
 
60
    new_et->etl.next = _et_list;
 
61
    _et_list = &new_et->etl;
 
62
    return 0;
 
63
}