Import ncpfs 2.1.1

This commit is contained in:
ncpfs archive import
2026-04-28 20:39:59 +02:00
parent f813517d69
commit c6c6fbe4ca
105 changed files with 7915 additions and 11381 deletions

View File

@@ -17,28 +17,25 @@
static void
#ifdef __STDC__
default_com_err_proc(const char *whoami, errcode_t code, const
char *fmt, va_list args)
default_com_err_proc(const char *whoami, errcode_t code, const
char *fmt, va_list args)
#else
default_com_err_proc(whoami, code, fmt, args)
default_com_err_proc(whoami, code, fmt, args)
const char *whoami;
errcode_t code;
const char *fmt;
va_list args;
#endif
{
if (whoami)
{
if (whoami) {
fputs(whoami, stderr);
fputs(": ", stderr);
}
if (code)
{
if (code) {
fputs(error_message(code), stderr);
fputs(" ", stderr);
}
if (fmt)
{
if (fmt) {
vfprintf(stderr, fmt, args);
}
/* should do this only on a tty in raw mode */
@@ -56,12 +53,10 @@ typedef void (*errf) ();
errf com_err_hook = default_com_err_proc;
#ifdef __STDC__
void
com_err_va(const char *whoami, errcode_t code, const char *fmt,
va_list args)
void com_err_va(const char *whoami, errcode_t code, const char *fmt,
va_list args)
#else
void
com_err_va(whoami, code, fmt, args)
void com_err_va(whoami, code, fmt, args)
const char *whoami;
errcode_t code;
const char *fmt;
@@ -72,14 +67,12 @@ va_list args;
}
#ifndef VARARGS
void
com_err(const char *whoami,
errcode_t code,
const char *fmt,...)
void com_err(const char *whoami,
errcode_t code,
const char *fmt,...)
{
#else
void
com_err(va_alist)
void com_err(va_alist)
va_dcl
{
const char *whoami, *fmt;

View File

@@ -24,10 +24,10 @@ struct et_list *_et_list = (struct et_list *) NULL;
#ifdef __STDC__
const char *
error_message(errcode_t code)
error_message(errcode_t code)
#else
const char *
error_message(code)
error_message(code)
errcode_t code;
#endif
{
@@ -39,8 +39,7 @@ errcode_t code;
offset = code & ((1 << ERRCODE_RANGE) - 1);
table_num = code - offset;
if (!table_num)
{
if (!table_num) {
#ifdef HAS_SYS_ERRLIST
if (offset < sys_nerr)
return (sys_errlist[offset]);
@@ -54,10 +53,8 @@ errcode_t code;
goto oops;
#endif
}
for (et = _et_list; et; et = et->next)
{
if (et->table->base == table_num)
{
for (et = _et_list; et; et = et->next) {
if (et->table->base == table_num) {
/* This is the right table */
if (et->table->n_msgs <= offset)
goto oops;
@@ -66,21 +63,17 @@ errcode_t code;
}
oops:
strcpy(buffer, "Unknown code ");
if (table_num)
{
if (table_num) {
strcat(buffer, error_table_name(table_num));
strcat(buffer, " ");
}
for (cp = buffer; *cp; cp++)
;
if (offset >= 100)
{
for (cp = buffer; *cp; cp++);
if (offset >= 100) {
*cp++ = '0' + offset / 100;
offset %= 100;
started++;
}
if (started || offset >= 10)
{
if (started || offset >= 10) {
*cp++ = '0' + offset / 10;
offset %= 10;
}

View File

@@ -11,14 +11,12 @@
#define const
#endif
struct error_table
{
struct error_table {
char const *const *msgs;
long base;
int n_msgs;
};
struct et_list
{
struct et_list {
struct et_list *next;
const struct error_table *table;
};

View File

@@ -14,7 +14,7 @@ static const char char_set[] =
static char buf[6];
const char *
error_table_name(num)
error_table_name(num)
int num;
{
int ch;
@@ -27,8 +27,7 @@ int num;
/* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
num &= 077777777;
/* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
for (i = 4; i >= 0; i--)
{
for (i = 4; i >= 0; i--) {
ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1);
if (ch != 0)
*p++ = char_set[ch - 1];

View File

@@ -23,8 +23,7 @@
#define const
#endif
struct foobar
{
struct foobar {
struct et_list etl;
struct error_table et;
};
@@ -32,11 +31,9 @@ struct foobar
extern struct et_list *_et_list;
#ifdef __STDC__
int
init_error_table(const char *const *msgs, int base, int count)
int init_error_table(const char *const *msgs, int base, int count)
#else
int
init_error_table(msgs, base, count)
int init_error_table(msgs, base, count)
const char *const *msgs;
int base;
int count;