summaryrefslogtreecommitdiff
path: root/xc/lib/FS/FSErrDis.c
diff options
context:
space:
mode:
authorrws <empty>1991-05-11 09:11:56 +0000
committerrws <empty>1991-05-11 09:11:56 +0000
commit70d519e50c97022c00dca832c755b97e9d61fb5c (patch)
tree94380ecc65fb83dc7544545c7afc298a4e40f93e /xc/lib/FS/FSErrDis.c
parent3861b38c5e72833f914cac7793dce10bb6e9a265 (diff)
Initial revision
Diffstat (limited to 'xc/lib/FS/FSErrDis.c')
-rw-r--r--xc/lib/FS/FSErrDis.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/xc/lib/FS/FSErrDis.c b/xc/lib/FS/FSErrDis.c
new file mode 100644
index 000000000..b5cc4735a
--- /dev/null
+++ b/xc/lib/FS/FSErrDis.c
@@ -0,0 +1,70 @@
+#include "copyright.h"
+/* @(#)FSErrDis.c 4.1 91/05/02
+ * Copyright 1990 Network Computing Devices;
+ * Portions Copyright 1987 by Digital Equipment Corporation and the
+ * Massachusetts Institute of Technology
+ */
+
+#include <stdio.h>
+#include <X11/Xos.h>
+#include "FSlibint.h"
+
+char *FSErrorList[] = {
+ /* FSBadRequest */ "BadRequest, invalid request code or no such operation",
+ /* FSBadFormat */ "BadFormat, bad font format mask",
+ /* FSBadFont */ "BadFont, invalid Font parameter",
+ /* FSBadRange */ "BadRange, invalid character range attributes",
+ /* FSBadEventMask */ "BadEventMask, illegal event mask",
+ /* FSBadAccessContext */ "BadAccessContext, insufficient permissions for operation",
+ /* FSBadIDChoice */ "BadIDChoice, invalid resource ID chosen for this connection",
+ /* FSBadName */ "BadName, named font does not exist",
+ /* FSBadResolution */ "BadResolution, improperly formatted resolution",
+ /* FSBadAlloc */ "BadAlloc, insufficient resources for operation",
+ /* FSBadLength */ "BadLength, request too large or internal FSlib length error",
+ /* FSBadImplementation */ "BadImplementation, request unsupported",
+};
+int FSErrorListSize = sizeof(FSErrorList);
+
+
+FSGetErrorText(svr, code, buffer, nbytes)
+ register int code;
+ register FSServer *svr;
+ char *buffer;
+ int nbytes;
+{
+
+ char *defaultp = NULL;
+ char buf[32];
+ register _FSExtension *ext;
+
+ if (nbytes == 0)
+ return;
+ sprintf(buf, "%d", code);
+ if (code <= (FSErrorListSize / sizeof(char *)) && code > 0) {
+ defaultp = FSErrorList[code];
+ FSGetErrorDatabaseText(svr, "FSProtoError", buf, defaultp, buffer, nbytes);
+ }
+ ext = svr->ext_procs;
+ while (ext) { /* call out to any extensions interested */
+ if (ext->error_string != NULL)
+ (*ext->error_string) (svr, code, &ext->codes, buffer, nbytes);
+ ext = ext->next;
+ }
+ return;
+}
+
+/* ARGSUSED */
+FSGetErrorDatabaseText(svr, name, type, defaultp, buffer, nbytes)
+ register char *name,
+ *type;
+ char *defaultp;
+ FSServer *svr;
+ char *buffer;
+ int nbytes;
+{
+ if (nbytes == 0)
+ return;
+ (void) strncpy(buffer, (char *) defaultp, nbytes);
+ if ((strlen(defaultp) + 1) > nbytes)
+ buffer[nbytes - 1] = '\0';
+}