1: /* $Header: errmsg.c,v 2.0 85/11/21 07:22:44 jqj Exp $ */ 2: 3: /* $Log: errmsg.c,v $ 4: * Revision 2.0 85/11/21 07:22:44 jqj 5: * 4.3BSD standard release 6: * 7: * Revision 1.1 85/11/20 14:19:04 jqj 8: * Initial revision 9: * 10: */ 11: #include "Filing4_defs.h" 12: 13: FilingErrMsg(Code, Message) 14: int Code; 15: char *Message; 16: { 17: static char *errmsgs[] = { 18: "AttributeTypeError", 19: "AttributeValueError", 20: "ControlTypeError", 21: "ControlValueError", 22: "ScopeTypeError", 23: "ScopeValueError", 24: "AccessError", 25: "AuthenticationError", 26: "ConnectionError", 27: "HandleError", 28: "InsertionError", 29: "ServiceError", 30: "SessionError", 31: "SpaceError", 32: "TransferError", 33: "UndefinedError", 34: "RangeError" }; 35: static char *argproblems[] = { 36: "illegal", 37: "disallowed", 38: "unreasonable", 39: "unimplemented", 40: "duplicated", 41: "missing" }; 42: static char *accessproblems[] = { 43: "accessRightsInsufficient", 44: "accessRightsIndeterminate", 45: "fileChanged", 46: "fileDamaged", 47: "fileInUse", 48: "fileNotFound", 49: "fileOpen" }; 50: static char *connectionproblems[] = { 51: "noRoute", 52: "noResponse", 53: "transmissionHardware", 54: "transportTimeout", 55: "tooManyLocalConnections", 56: "tooManyRemoteConnections", 57: "missingCourier", 58: "missingProgram", 59: "missingProcedure", 60: "protocolMismatch", 61: "parameterInconsistency", 62: "invalidMessage", 63: "returnTimedOut", 64: "otherCallProblem" }; 65: static char* handleproblems[] = { 66: "invalid", 67: "nullDisallowed", 68: "directoryRequired" }; 69: static char *insertionproblems[] = { 70: "positionUnavailable", 71: "fileNotUnique", 72: "loopInHierarchy" }; 73: static char *serviceproblems[] = { 74: "cannotAuthenticate", 75: "serviceFull", 76: "serviceUnavailable", 77: "sessionInUse" }; 78: static char *sessionproblems[] = { 79: "tokenInvalid", 80: "serviceAlreadySet" }; 81: static char *spaceproblems[] = { 82: "allocationExceeded", 83: "attributeAreadFull", 84: "mediumFull" }; 85: static char *transferproblems[] = { 86: "aborted", 87: "checksumIncorrect", 88: "formatIncorrect", 89: "noRendevous", 90: "wrongDirection" }; 91: static char *authenticationproblems[] = { 92: "credentialsInvalid", 93: "verifierInvalid", 94: "verifierExpiered", 95: "verifierReused", 96: "credentialsExpired", 97: "inappropriateCredentials" }; 98: static char *rejectproblem[] = { 99: "noSuchProgramNumber", 100: "noSuchVersionNumber", 101: "noSuchProcedureValue", 102: "invalidArgument" }; 103: char *msg, *problemstr; 104: int problem; 105: char tempbuf[40]; 106: 107: if (Code < 1000) { 108: if (Message != (char *) 0) 109: printf("ERROR: %s\n", Message); 110: return; 111: } 112: 113: if (Code-ERROR_OFFSET >= 0 && Code-ERROR_OFFSET <= 16) { 114: msg = errmsgs[Code-ERROR_OFFSET]; 115: problem = (((UndefinedErrorArgs *) Message)->problem); 116: } else { 117: msg = ""; 118: problem = 0; 119: } 120: switch (Code) { 121: case AttributeTypeError: 122: case AttributeValueError: 123: case ControlTypeError: 124: case ControlValueError: 125: case ScopeTypeError: 126: case ScopeValueError: 127: case RangeError: 128: problemstr = argproblems[problem]; 129: break; 130: case AccessError: 131: problemstr = accessproblems[problem]; 132: break; 133: case AuthenticationError: 134: problemstr = authenticationproblems[problem]; 135: break; 136: case ConnectionError: 137: problemstr = connectionproblems[problem]; 138: break; 139: case HandleError: 140: problemstr = handleproblems[problem]; 141: break; 142: case InsertionError: 143: problemstr = insertionproblems[problem]; 144: break; 145: case ServiceError: 146: problemstr = serviceproblems[problem]; 147: break; 148: case SessionError: 149: problemstr = sessionproblems[problem]; 150: break; 151: case SpaceError: 152: problemstr = spaceproblems[problem]; 153: break; 154: case TransferError: 155: problemstr = transferproblems[problem]; 156: break; 157: case UndefinedError: 158: problemstr = tempbuf; 159: sprintf(problemstr,"number %d",problem); 160: break; 161: case REJECT_ERROR: 162: msg = "Courier REJECT"; 163: problem = (int) (((rejectionDetails *) Message)->designator); 164: if (problem <= 3) 165: problemstr = rejectproblem[problem]; 166: else problemstr = "unspecifiedError"; 167: break; 168: case PROTOCOL_VIOLATION: 169: problemstr = "Courier protocol violation"; 170: break; 171: default: 172: problemstr = tempbuf; 173: sprintf(problemstr,"unexpected error number %d", Code); 174: break; 175: } 176: printf("ERROR: %s, %s\n", msg, problemstr); 177: }