1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 1994 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate /* 34*7c478bd9Sstevel@tonic-gate * Convert an error number from the Common Control into a string 35*7c478bd9Sstevel@tonic-gate */ 36*7c478bd9Sstevel@tonic-gate #ifndef DIAL 37*7c478bd9Sstevel@tonic-gate static char SCCSID[] = "@(#)dkerr.c 2.6+BNU DKHOST 87/03/05"; 38*7c478bd9Sstevel@tonic-gate #endif 39*7c478bd9Sstevel@tonic-gate /* 40*7c478bd9Sstevel@tonic-gate * COMMKIT(TM) Software - Datakit(R) VCS Interface Release 2.0 V1 41*7c478bd9Sstevel@tonic-gate */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #include "dk.h" 44*7c478bd9Sstevel@tonic-gate #include <sysexits.h> 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate GLOBAL 47*7c478bd9Sstevel@tonic-gate char *dk_msgs[] = { 48*7c478bd9Sstevel@tonic-gate "Call Failed", /* code 0 - Something is Wrong */ 49*7c478bd9Sstevel@tonic-gate "All channels busy", /* code 1 - busy */ 50*7c478bd9Sstevel@tonic-gate "Remote node not answering", /* code 2 - trunk down */ 51*7c478bd9Sstevel@tonic-gate "Server not answering", /* code 3 - termporary no dest */ 52*7c478bd9Sstevel@tonic-gate "Non-assigned number", /* code 4 - permonent no dest (INTERT) */ 53*7c478bd9Sstevel@tonic-gate "All trunk channels busy", /* code 5 - System Overload (REORT) */ 54*7c478bd9Sstevel@tonic-gate "Server already exists", /* code 6 - already exists */ 55*7c478bd9Sstevel@tonic-gate "Access denied", /* code 7 - denied by remote server */ 56*7c478bd9Sstevel@tonic-gate "", /* code 8 - directory assistance req */ 57*7c478bd9Sstevel@tonic-gate } ; 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate GLOBAL 60*7c478bd9Sstevel@tonic-gate char *dialer_msgs[] = { 61*7c478bd9Sstevel@tonic-gate "", 62*7c478bd9Sstevel@tonic-gate "Please supply a valid phone number", /* code 1 - phone # missing */ 63*7c478bd9Sstevel@tonic-gate "No response from auto-dialer. Try again", /* code 2- bad port */ 64*7c478bd9Sstevel@tonic-gate "Auto dialer failed to initiate call. Try again", /* code 3 - dial failure */ 65*7c478bd9Sstevel@tonic-gate "No initial dial tone detected", /* code 4 - bad telephone line */ 66*7c478bd9Sstevel@tonic-gate "No secondary dial tone detected", /* code 5 - no sec. dial tone */ 67*7c478bd9Sstevel@tonic-gate "Dialed number is busy", /* code 6 - busy signal detected */ 68*7c478bd9Sstevel@tonic-gate "No answer fron dialed number", /* code 7 - auto-dialer didn't get ans. */ 69*7c478bd9Sstevel@tonic-gate "No carrier tone was detected", /* code 8 - no carrier tone det. */ 70*7c478bd9Sstevel@tonic-gate "Could not complete your call. Try again.", /* code 9 - auto dialer didn't complete */ 71*7c478bd9Sstevel@tonic-gate "Wrong number", /*code 10 - bad number*/ 72*7c478bd9Sstevel@tonic-gate }; 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate GLOBAL 75*7c478bd9Sstevel@tonic-gate char *dk_hostmsgs[] = { 76*7c478bd9Sstevel@tonic-gate "Dkserver: Can't open line: See System Administrator", /* Code 130 */ 77*7c478bd9Sstevel@tonic-gate "", /* Code 131 */ 78*7c478bd9Sstevel@tonic-gate "", /* Code 132 */ 79*7c478bd9Sstevel@tonic-gate "Dkserver: Dksrvtab not readable: See System Administrator", /* Code 133 */ 80*7c478bd9Sstevel@tonic-gate "Dkserver: Can't chroot: See System Administrator", 81*7c478bd9Sstevel@tonic-gate }; 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate #define NDKMSGS (sizeof(dk_msgs)/sizeof(dk_msgs[0])) 84*7c478bd9Sstevel@tonic-gate #define NDKHOMSGS (sizeof(dk_hostmsgs)/sizeof(dk_hostmsgs[0])) 85*7c478bd9Sstevel@tonic-gate #define DIALERCODE 11 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate GLOBAL int dk_verbose = 1; /* Print error messages on stderr if 1 */ 88*7c478bd9Sstevel@tonic-gate GLOBAL int dk_errno = 0; /* Saved error number from iocb.req_error */ 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate static char generalmsg[32]; 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate GLOBAL char * 93*7c478bd9Sstevel@tonic-gate dkerr(err) 94*7c478bd9Sstevel@tonic-gate { 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate if ((err & 0377) == DIALERCODE) 97*7c478bd9Sstevel@tonic-gate return(dialer_msgs[err>>8]); 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate if ((err >= 0 && err <= 99) && err < NDKMSGS && dk_msgs[err] != 0) 100*7c478bd9Sstevel@tonic-gate return(dk_msgs[err]); 101*7c478bd9Sstevel@tonic-gate if ((err >= 100) && (err < (NDKHOMSGS + 130)) && (dk_hostmsgs[err-130] != 0)) 102*7c478bd9Sstevel@tonic-gate return(dk_hostmsgs[err-130]); 103*7c478bd9Sstevel@tonic-gate sprintf(generalmsg, "Error code %d", err) ; 104*7c478bd9Sstevel@tonic-gate return(generalmsg); 105*7c478bd9Sstevel@tonic-gate } 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate GLOBAL int 108*7c478bd9Sstevel@tonic-gate dkerrmap(dkcode) 109*7c478bd9Sstevel@tonic-gate { 110*7c478bd9Sstevel@tonic-gate if (dkcode < 0) 111*7c478bd9Sstevel@tonic-gate return(-dkcode); 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate switch(dkcode){ 114*7c478bd9Sstevel@tonic-gate case 0: 115*7c478bd9Sstevel@tonic-gate case 1: 116*7c478bd9Sstevel@tonic-gate case 2: 117*7c478bd9Sstevel@tonic-gate case 3: 118*7c478bd9Sstevel@tonic-gate case 5: 119*7c478bd9Sstevel@tonic-gate return(EX_TEMPFAIL); 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate case 4: 122*7c478bd9Sstevel@tonic-gate return(EX_NOHOST); 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate case 6: 125*7c478bd9Sstevel@tonic-gate return(EX_CANTCREAT); 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate case 7: 128*7c478bd9Sstevel@tonic-gate return(EX_NOPERM); 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate default: 131*7c478bd9Sstevel@tonic-gate return(EX_DATAERR); 132*7c478bd9Sstevel@tonic-gate } 133*7c478bd9Sstevel@tonic-gate } 134