13839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/* 23839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * Copyright 1987 by MIT Student Information Processing Board 33839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * 406cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * Permission to use, copy, modify, and distribute this software and 506cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * its documentation for any purpose is hereby granted, provided that 606cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in 706cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * advertising or publicity pertaining to distribution of the software 806cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * without specific, written prior permission. M.I.T. and the 906cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * M.I.T. S.I.P.B. make no representations about the suitability of 1006cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * this software for any purpose. It is provided "as is" without 1106cefee50dc681838454fcd079ba5b2760969f1bTheodore Ts'o * express or implied warranty. 123839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */ 133839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 14a47b66ee09960a8bf00e72b431ec56d68e11a301Theodore Ts'o#include "com_err.h" 153839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#include "error_table.h" 163839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#include "internal.h" 173839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 183839e65723771b85975f4263102dd3ceec4523cTheodore Ts'ostatic const char char_set[] = 193839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; 203839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 213839e65723771b85975f4263102dd3ceec4523cTheodore Ts'ostatic char buf[6]; 223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 23e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallconst char * error_table_name(errcode_t num) 243839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{ 253839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o int ch; 263839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o int i; 273839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o char *p; 283839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 293839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */ 303839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o p = buf; 313839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o num >>= ERRCODE_RANGE; 323839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */ 33a47b66ee09960a8bf00e72b431ec56d68e11a301Theodore Ts'o num &= 077777777L; 343839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */ 353839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o for (i = 4; i >= 0; i--) { 36a47b66ee09960a8bf00e72b431ec56d68e11a301Theodore Ts'o ch = (int)((num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1)); 373839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o if (ch != 0) 383839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *p++ = char_set[ch-1]; 393839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o } 403839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *p = '\0'; 413839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o return(buf); 423839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o} 43