Find a dialer in the HDB configuration files.
Copyright (C) 1992 Ian Lance Taylor
This file is part of the Taylor UUCP uuconf library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
const char _uuconf_hdial_rcsid
[] = "$Id: hdial.c,v 1.1 1993/08/04 19:34:15 jtc Exp $";
/* Find a dialer in the HDB configuration files by name. */
uuconf_hdb_dialer_info (pglobal
, zname
, qdialer
)
struct uuconf_dialer
*qdialer
;
struct sglobal
*qglobal
= (struct sglobal
*) pglobal
;
for (pz
= qglobal
->qprocess
->pzhdb_dialers
; *pz
!= NULL
; pz
++)
iret
= UUCONF_FOPEN_FAILED
| UUCONF_ERROR_ERRNO
;
while ((cchars
= _uuconf_getline (qglobal
, &zline
, &cline
, e
)) > 0)
if (zline
[cchars
] == '\n')
if (isspace (BUCHAR (zline
[0])) || zline
[0] == '#')
ctoks
= _uuconf_istrsplit (zline
, '\0', &pzsplit
, &csplit
);
iret
= UUCONF_MALLOC_FAILED
| UUCONF_ERROR_ERRNO
;
if (strcmp (zname
, pzsplit
[0]) != 0)
/* We found the dialer. */
pblock
= uuconf_malloc_block ();
iret
= UUCONF_MALLOC_FAILED
| UUCONF_ERROR_ERRNO
;
if (uuconf_add_block (pblock
, zline
) != 0)
uuconf_free_block (pblock
);
iret
= UUCONF_MALLOC_FAILED
| UUCONF_ERROR_ERRNO
;
_uuconf_uclear_dialer (qdialer
);
qdialer
->uuconf_zname
= pzsplit
[0];
qdialer
->uuconf_palloc
= pblock
;
/* The second field is characters to send instead of "="
and "-" in phone numbers. */
if (strcmp (pzsplit
[1], "\"\"") == 0)
qdialer
->uuconf_zdialtone
= zsubs
+ 1;
qdialer
->uuconf_zpause
= zsubs
+ 1;
/* Any remaining fields form a chat script. */
pzsplit
[1] = (char *) "chat";
iret
= _uuconf_ichat_cmd (qglobal
, ctoks
- 1,
iret
&=~ UUCONF_CMDTABRET_KEEP
;
if (iret
!= UUCONF_SUCCESS
)
uuconf_free_block (pblock
);
if (iret
!= UUCONF_NOT_FOUND
)
free ((pointer
) pzsplit
);
if (iret
!= UUCONF_SUCCESS
&& iret
!= UUCONF_NOT_FOUND
)
qglobal
->zfilename
= *pz
;
iret
|= UUCONF_ERROR_FILENAME
| UUCONF_ERROR_LINENO
;