/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include "mt.h"
#include "uucp.h"
static void alarmtr(int);
static char *fdig(char *);
#ifndef SMALL
static char *strecpy(char *, char *, char *);
#endif
static int interface(const char *);
static int fd_mklock(int);
static int getdialline(char *, int);
static int chat(int, char *[], int, char *, char *);
static void translate(char *, char *);
static int gdial(char *, char *[], int);
static int Modemctrl;
static unsigned connecttime;
static int (*Setup)();
/*
* to add a new caller:
* declare the function that knows how to call on the device,
* add a line to the callers table giving the name of the device
* (from Devices file) and the name of the function
* add the function to the end of this file
*/
#ifdef TLI
static int tlicall(char *[], char *[]);
#endif /* TLI */
#ifdef TLI
#ifdef TLIS
#endif /* TLIS */
#endif /* TLI */
};
/*
* exphone - expand phone number for given prefix and number
*
* return code - none
*/
static void
{
char *s1;
return;
}
continue;
break;
}
}
}
/*
* repphone - Replace \D and \T sequences in arg with phone
* expanding and translating as appropriate.
*/
static char *
{
return (arg);
}
if (*arg != '\\') {
continue;
} else {
switch (*(arg+1)) {
case 'T':
;
arg++;
break;
case 'D':
;
arg++;
break;
default:
break;
}
}
}
*tp = '\0';
return (pbuf);
}
static int pop_push(int);
static void setdevcfg(char *, char *);
static void ttygenbrk(int);
/*
* processdev - Process a line from the Devices file
*
* return codes:
* file descriptor - succeeded
* FAIL - failed
*/
static int
{
char **sdev;
int nullfd;
/* set up default "break" routine */
/* initialize Devconfig info */
/* This will find built-in caller functions */
/* if NULL - assume translate */
/* needed for for loop later to mark the end */
}
return (dcf);
/* restore vanilla unix interface */
(void) interface("UNIX");
return (FAIL);
}
break;
}
}
if (dcf == -1) {
/* Here if not a built-in caller function */
/* We do locking (file and advisory) after open */
/*
* Open the line
*/
} else {
}
/* take care of the possible partial open fd */
goto bad;
}
(void) alarm(10);
if (Modemctrl) {
} else {
saved_mode = O_RDWR;
}
(void) alarm(0);
if (dcf < 0) {
goto bad;
}
/* check locks BEFORE modifying the stream */
goto bad;
}
if (Modemctrl) {
errno);
goto bad;
}
}
}
/* any device|system lock files we should remove? */
goto bad;
}
/* configure any requested streams modules */
goto bad;
}
/* save initial state of line in case script fails */
/* use sdev[] since dev[] is incremented for internal callers */
/*
* Now loop through the remaining callers and chat
* according to scripts in dialers file.
*/
int w;
/*
* Scan Dialers file to find an entry
*/
goto bad;
}
if (w <= 2) /* do nothing - no chat */
break;
/*
* Translate the phone number
*/
/* if NULL - assume no translation */
/* needed for for loop to mark the end */
}
/*
* Chat
*/
goto bad;
}
}
/*
* Success at last!
*/
return (dcf);
bad:
if (dcf >= 0) {
/* reset line settings if we got them in the beginning */
if (ret_orig == 0)
}
/* restore vanilla unix interface */
(void) interface("UNIX");
return (FAIL);
}
/*
* clear_hup() clear the hangup state of the given device
*/
static int
{
int ndcf;
return (FAIL);
}
}
return (SUCCESS);
}
/*
* translate the pairs of characters present in the first
* string whenever the first of the pair appears in the second
* string.
*/
static void
{
char *s;
for (s = str; *s; s++)
if (*ttab == *s)
*s = *(ttab+1);
}
static void dialreset(void);
#ifndef SMALL
static char *currdial(void);
#endif
/*
* Get the information about the dialer.
* gdial(type, arps, narps)
* type -> type of dialer (e.g., penril)
* arps -> array of pointers returned by gdial
* narps -> number of elements in array returned by gdial
* Return value:
* -1 -> Can't open DIALERFILE
* 0 -> requested type not found
* >0 -> success - number of fields filled in
*/
static int
{
int na;
return (0);
}
}
continue;
continue;
dialreset();
return (na);
}
}
dialreset();
return (0);
}
#ifdef TLI
/*
*
* AT&T Transport Layer Interface
*
* expected in Devices
* TLI line1 - - TLI
* or
* TLIS line1 - - TLIS
*
*/
#include <tiuser.h>
/*
* returns fd to remote uucp daemon
*/
/*ARGSUSED*/
static int
{
int fd;
int i, j;
/* dev holds device name relative to /dev */
} else {
/* dev holds full path name of device */
}
/* gimme local transport endpoint */
return (FAIL);
}
(void) alarm(5);
(void) alarm(0);
if (fd < 0) {
return (FAIL);
}
return (FAIL);
}
/* allocate tli structures */
return (FAIL);
}
/* bind */
return (FAIL);
}
/*
* Prepare to connect.
*
* If address begins with "\x", "\X", "\o", or "\O",
* assume is hexadecimal or octal address and use stoa()
* to convert it.
*
* Else is usual uucico address -- only \N's left to process.
* Walk thru connection address, changing \N's to NULLCHARs.
* Note: If a NULLCHAR must be part of the connection address,
* it must be overtly included in the address. One recommended
* way is to do it in the Devices file, thusly:
* bsfix() turns \000 into \N and then the loop below makes it a
* real, included-in-the-length null-byte.
*
* The DEBUG must print the strecpy'd address (so that
* non-printables will have been replaced with C escapes).
*/
return (FAIL);
}
} else {
++i, ++j) {
++i;
} else {
}
}
}
return (FAIL);
}
(void) alarm(connecttime);
/* connect to the service -- some listeners can't handle */
/* multiple connect requests, so try it a few times */
for (i = 0; i < CONNECT_ATTEMPTS; ++i) {
break;
(void) alarm(0);
} else {
(void) alarm(0);
return (FAIL);
}
}
(void) alarm(0);
if (i == CONNECT_ATTEMPTS) {
return (FAIL);
}
return (fd);
}
#endif /* TLI */