2
* $ Header: lib/et/SCCS/s.error_message.c 1.16 99/10/23 01:16:05-00:00 tytso@mit.edu $
3
* $ Source: /usr/src/e2fsprogs/BK/e2fsprogs/lib/et/SCCS/s.error_message.c $
4
* $ Locker: <Not implemented> $
6
* Copyright 1987 by the Student Information Processing Board
7
* of the Massachusetts Institute of Technology
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.
23
#include "error_table.h"
26
static char buffer[25];
28
struct et_list * _et_list = (struct et_list *) NULL;
32
const char * error_message (errcode_t code)
34
const char * error_message (code)
44
offset = (int) (code & ((1<<ERRCODE_RANGE)-1));
45
table_num = code - offset;
47
#ifdef HAS_SYS_ERRLIST
48
if (offset < sys_nerr)
49
return(sys_errlist[offset]);
53
cp = strerror(offset);
60
for (et = _et_list; et; et = et->next) {
61
if (et->table->base == table_num) {
62
/* This is the right table */
63
if (et->table->n_msgs <= offset)
65
return(et->table->msgs[offset]);
69
strcpy (buffer, "Unknown code ");
71
strcat (buffer, error_table_name (table_num));
74
for (cp = buffer; *cp; cp++)
77
*cp++ = '0' + offset / 100;
81
if (started || offset >= 10) {
82
*cp++ = '0' + offset / 10;