1/* reliab.c 2 Subroutines to handle reliability commands for ports and dialers. 3 4 Copyright (C) 1992, 2002 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 21 22 The author of the program may be contacted at ian@airs.com. 23 */ 24 25#include "uucnfi.h" 26 27#if USE_RCS_ID 28const char _uuconf_reliab_rcsid[] = "$Id: reliab.c,v 1.9 2002/03/05 19:10:42 ian Rel $"; 29#endif 30 31/* Handle the "seven-bit" command for a port or a dialer. The pvar 32 argument points to an integer which should be set to hold 33 reliability information. */ 34 35/*ARGSUSED*/ 36int 37_uuconf_iseven_bit (pglobal,argc, argv, pvar, pinfo) 38 pointer pglobal; 39 int argc ATTRIBUTE_UNUSED; 40 char **argv; 41 pointer pvar; 42 pointer pinfo ATTRIBUTE_UNUSED; 43{ 44 struct sglobal *qglobal = (struct sglobal *) pglobal; 45 int *pi = (int *) pvar; 46 int fval; 47 int iret; 48 49 iret = _uuconf_iboolean (qglobal, argv[1], &fval); 50 if ((iret &~ UUCONF_CMDTABRET_KEEP) != UUCONF_SUCCESS) 51 return iret; 52 53 *pi |= UUCONF_RELIABLE_SPECIFIED; 54 if (fval) 55 *pi &=~ UUCONF_RELIABLE_EIGHT; 56 else 57 *pi |= UUCONF_RELIABLE_EIGHT; 58 59 return iret; 60} 61 62/* Handle the "reliable" command for a port or a dialer. The pvar 63 argument points to an integer which should be set to hold 64 reliability information. */ 65 66/*ARGSUSED*/ 67int 68_uuconf_ireliable (pglobal, argc, argv, pvar, pinfo) 69 pointer pglobal; 70 int argc ATTRIBUTE_UNUSED; 71 char **argv; 72 pointer pvar; 73 pointer pinfo ATTRIBUTE_UNUSED; 74{ 75 struct sglobal *qglobal = (struct sglobal *) pglobal; 76 int *pi = (int *) pvar; 77 int fval; 78 int iret; 79 80 iret = _uuconf_iboolean (qglobal, argv[1], &fval); 81 if ((iret &~ UUCONF_CMDTABRET_KEEP) != UUCONF_SUCCESS) 82 return iret; 83 84 *pi |= UUCONF_RELIABLE_SPECIFIED; 85 if (fval) 86 *pi |= UUCONF_RELIABLE_RELIABLE; 87 else 88 *pi &=~ UUCONF_RELIABLE_RELIABLE; 89 90 return iret; 91} 92 93/* Handle the "half-duplex" command for a port or a dialer. The pvar 94 argument points to an integer which should be set to hold 95 reliability information. */ 96 97/*ARGSUSED*/ 98int 99_uuconf_ihalf_duplex (pglobal, argc, argv, pvar, pinfo) 100 pointer pglobal; 101 int argc ATTRIBUTE_UNUSED; 102 char **argv; 103 pointer pvar; 104 pointer pinfo ATTRIBUTE_UNUSED; 105{ 106 struct sglobal *qglobal = (struct sglobal *) pglobal; 107 int *pi = (int *) pvar; 108 int fval; 109 int iret; 110 111 iret = _uuconf_iboolean (qglobal, argv[1], &fval); 112 if ((iret &~ UUCONF_CMDTABRET_KEEP) != UUCONF_SUCCESS) 113 return iret; 114 115 *pi |= UUCONF_RELIABLE_SPECIFIED; 116 if (fval) 117 *pi &=~ UUCONF_RELIABLE_FULLDUPLEX; 118 else 119 *pi |= UUCONF_RELIABLE_FULLDUPLEX; 120 121 return iret; 122} 123