]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - gnu/libexec/uucp/libuuconf/reliab.c
This is the Linux generic soundcard driver, version 1.0c. Supports
[FreeBSD/FreeBSD.git] / gnu / libexec / uucp / libuuconf / reliab.c
1 /* reliab.c
2    Subroutines to handle reliability commands for ports and dialers.
3
4    Copyright (C) 1992 Ian Lance Taylor
5
6    This file is part of the Taylor UUCP uuconf library.
7
8    This library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Library General Public License
10    as published by the Free Software Foundation; either version 2 of
11    the License, or (at your option) any later version.
12
13    This library is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Library General Public License for more details.
17
18    You should have received a copy of the GNU Library General Public
19    License along with this library; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22    The author of the program may be contacted at ian@airs.com or
23    c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
24    */
25
26 #include "uucnfi.h"
27
28 #if USE_RCS_ID
29 const char _uuconf_reliab_rcsid[] = "$Id: reliab.c,v 1.1 1993/08/04 19:34:58 jtc Exp $";
30 #endif
31 \f
32 /* Handle the "seven-bit" command for a port or a dialer.  The pvar
33    argument points to an integer which should be set to hold
34    reliability information.  */
35
36 /*ARGSUSED*/
37 int
38 _uuconf_iseven_bit (pglobal,argc, argv, pvar, pinfo)
39      pointer pglobal;
40      int argc;
41      char **argv;
42      pointer pvar;
43      pointer pinfo;
44 {
45   struct sglobal *qglobal = (struct sglobal *) pglobal;
46   int *pi = (int *) pvar;
47   int fval;
48   int iret;
49
50   iret = _uuconf_iboolean (qglobal, argv[1], &fval);
51   if ((iret &~ UUCONF_CMDTABRET_KEEP) != UUCONF_SUCCESS)
52     return iret;
53
54   *pi |= UUCONF_RELIABLE_SPECIFIED;
55   if (fval)
56     *pi &=~ UUCONF_RELIABLE_EIGHT;
57   else
58     *pi |= UUCONF_RELIABLE_EIGHT;
59
60   return iret;
61 }
62
63 /* Handle the "reliable" command for a port or a dialer.  The pvar
64    argument points to an integer which should be set to hold
65    reliability information.  */
66
67 /*ARGSUSED*/
68 int
69 _uuconf_ireliable (pglobal, argc, argv, pvar, pinfo)
70      pointer pglobal;
71      int argc;
72      char **argv;
73      pointer pvar;
74      pointer pinfo;
75 {
76   struct sglobal *qglobal = (struct sglobal *) pglobal;
77   int *pi = (int *) pvar;
78   int fval;
79   int iret;
80
81   iret = _uuconf_iboolean (qglobal, argv[1], &fval);
82   if ((iret &~ UUCONF_CMDTABRET_KEEP) != UUCONF_SUCCESS)
83     return iret;
84
85   *pi |= UUCONF_RELIABLE_SPECIFIED;
86   if (fval)
87     *pi |= UUCONF_RELIABLE_RELIABLE;
88   else
89     *pi &=~ UUCONF_RELIABLE_RELIABLE;
90
91   return iret;
92 }
93
94 /* Handle the "half-duplex" command for a port or a dialer.  The pvar
95    argument points to an integer which should be set to hold
96    reliability information.  */
97
98 /*ARGSUSED*/
99 int
100 _uuconf_ihalf_duplex (pglobal, argc, argv, pvar, pinfo)
101      pointer pglobal;
102      int argc;
103      char **argv;
104      pointer pvar;
105      pointer pinfo;
106 {
107   struct sglobal *qglobal = (struct sglobal *) pglobal;
108   int *pi = (int *) pvar;
109   int fval;
110   int iret;
111
112   iret = _uuconf_iboolean (qglobal, argv[1], &fval);
113   if ((iret &~ UUCONF_CMDTABRET_KEEP) != UUCONF_SUCCESS)
114     return iret;
115
116   *pi |= UUCONF_RELIABLE_SPECIFIED;
117   if (fval)
118     *pi &=~ UUCONF_RELIABLE_FULLDUPLEX;
119   else
120     *pi |= UUCONF_RELIABLE_FULLDUPLEX;
121
122   return iret;
123 }