📄 ndial.c
字号:
#include "net.h"
#include "local.h"
#include "support.h"
#include "script.h"
/*
** * * * * * *
** ussDial() Perform a dial script in blocking mode
**
** int ussDial(int netno, const char *script);
**
** PARAMETERS:
** (in) int netno A network number
** (in) const char *script A dial script
**
** RETURNS
** 0 Success
** -1 Failure
**
** DESCRIPTION:
** This function will perform a dial script in blocking mode.
** * * * * * *
*/
int ussDial(int netno, const char *script)
{
struct NET *netp;
int status;
if (netno < 0 || netno >= NNETS) {
#if NTRACE
Nprintf("Ndial: Network number not valid\n");
#endif
return -1;
}
/* This routine only works with serial devices */
netp = &nets[netno];
if (netp->protoc[0] != SLIP && netp->protoc[0] != PPP) {
#if NTRACE
Nprintf("Ndial: Interface not SLIP or PPP\n");
#endif
return -1;
}
/* Do script opertaions until the status is finished, good or bad */
ussScriptInit(netno, script);
do {
status = ussScriptTimeout(netno);
} while (status == 0);
/* If the status is success (1), return 0; else return status (-1) */
return (status == 1) ? 0 : status;
}
/*
** * * * * * *
** Ndial() Perform dial-out or dial-down operation
**
** int Ndial(int netno, char *phonenumber
**
** PARAMETERS:
** (in) int netno a yfnet network number
** (in) char *phonenumber a pointer to an ASCII phone number string
**
** DESCRIPTION:
** This function will dial down if phonenumber == 0. Otherwise, this
** function will dial out to the phonenumber.
** * * * * * *
*/
int Ndial(int netno,char *phonenumber)
{
const char *script;
/* If phone number is defined, dial out */
if (phonenumber) {
ussScriptPhoneNum = phonenumber;
script = ussDialScrTable[ussDialIxOutE];
}
/* Else dial down */
else
script = ussDialScrTable[ussDialIxDownE];
return ussDial(netno, script);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -