physical.c (2764b86afdc99a30f4b1a4da2c04db8aa7aa785d) | physical.c (565e35e50e2cdac423588a3d18742544bde128b0) |
---|---|
1/* 2 * Written by Eivind Eklund <eivind@yes.no> 3 * for Yes Interactive 4 * 5 * Copyright (C) 1998, Yes Interactive. All rights reserved. 6 * 7 * Redistribution and use in any form is permitted. Redistribution in 8 * source form should include the above copyright and this set of 9 * conditions, because large sections american law seems to have been 10 * created by a bunch of jerks on drugs that are now illegal, forcing 11 * me to include this copyright-stuff instead of placing this in the 12 * public domain. The name of of 'Yes Interactive' or 'Eivind Eklund' 13 * may not be used to endorse or promote products derived from this 14 * software without specific prior written permission. 15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18 * | 1/* 2 * Written by Eivind Eklund <eivind@yes.no> 3 * for Yes Interactive 4 * 5 * Copyright (C) 1998, Yes Interactive. All rights reserved. 6 * 7 * Redistribution and use in any form is permitted. Redistribution in 8 * source form should include the above copyright and this set of 9 * conditions, because large sections american law seems to have been 10 * created by a bunch of jerks on drugs that are now illegal, forcing 11 * me to include this copyright-stuff instead of placing this in the 12 * public domain. The name of of 'Yes Interactive' or 'Eivind Eklund' 13 * may not be used to endorse or promote products derived from this 14 * software without specific prior written permission. 15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18 * |
19 * $Id: physical.c,v 1.1.2.21 1998/04/06 09:12:34 brian Exp $ | 19 * $Id: physical.c,v 1.1.2.22 1998/04/07 00:54:13 brian Exp $ |
20 * 21 */ 22 23#include <sys/types.h> 24 25#include <sys/tty.h> 26 27#include <assert.h> --- 43 unchanged lines hidden (view full) --- 71 return isatty(phys->fd); 72} 73 74int 75Physical_IsSync(struct physical *phys) { 76 return phys->cfg.speed == 0; 77} 78 | 20 * 21 */ 22 23#include <sys/types.h> 24 25#include <sys/tty.h> 26 27#include <assert.h> --- 43 unchanged lines hidden (view full) --- 71 return isatty(phys->fd); 72} 73 74int 75Physical_IsSync(struct physical *phys) { 76 return phys->cfg.speed == 0; 77} 78 |
79int 80Physical_FD_ISSET(struct physical *phys, fd_set *set) { 81 return phys->fd >= 0 && FD_ISSET(phys->fd, set); 82} 83 84void 85Physical_FD_SET(struct physical *phys, fd_set *set) { 86 assert(phys->fd >= 0); 87 FD_SET(phys->fd, set); 88} 89 90 | |
91const char *Physical_GetDevice(struct physical *phys) 92{ 93 return phys->name.full; 94} 95 96/* XXX-ML - must be moved into the physical struct */ 97void 98Physical_SetDeviceList(struct physical *phys, const char *new_device_list) { --- 22 unchanged lines hidden (view full) --- 121Physical_SetRtsCts(struct physical *phys, int enable) { 122 assert(enable == 0 || enable == 1); 123 124 phys->cfg.rts_cts = enable; 125 return 1; 126} 127 128void | 79const char *Physical_GetDevice(struct physical *phys) 80{ 81 return phys->name.full; 82} 83 84/* XXX-ML - must be moved into the physical struct */ 85void 86Physical_SetDeviceList(struct physical *phys, const char *new_device_list) { --- 22 unchanged lines hidden (view full) --- 109Physical_SetRtsCts(struct physical *phys, int enable) { 110 assert(enable == 0 || enable == 1); 111 112 phys->cfg.rts_cts = enable; 113 return 1; 114} 115 116void |
129Physical_SetDedicated(struct physical *phys, int enable) { 130 assert(enable == 0 || enable == 1); 131 132 phys->cfg.is_dedicated = enable; 133} 134 135void 136Physical_SetDirect(struct physical *phys, int enable) { 137 assert(enable == 0 || enable == 1); 138 139 phys->cfg.is_direct = enable; 140} 141 142int 143Physical_IsDirect(struct physical *phys) { 144 return phys->cfg.is_direct; 145} 146 147int 148Physical_IsDedicated(struct physical *phys) { 149 return phys->cfg.is_dedicated; 150} 151 152 153void | |
154Physical_DupAndClose(struct physical *phys) { 155 int nmodem; 156 157 nmodem = dup(phys->fd); 158 close(phys->fd); 159 phys->fd = nmodem; 160} 161 --- 42 unchanged lines hidden (view full) --- 204{ 205 struct physical *p = descriptor2physical(d); 206 return p->fd >= 0 && FD_ISSET(p->fd, fdset); 207} 208 209void 210Physical_Login(struct physical *phys, const char *name) 211{ | 117Physical_DupAndClose(struct physical *phys) { 118 int nmodem; 119 120 nmodem = dup(phys->fd); 121 close(phys->fd); 122 phys->fd = nmodem; 123} 124 --- 42 unchanged lines hidden (view full) --- 167{ 168 struct physical *p = descriptor2physical(d); 169 return p->fd >= 0 && FD_ISSET(p->fd, fdset); 170} 171 172void 173Physical_Login(struct physical *phys, const char *name) 174{ |
212 if ((mode & MODE_DIRECT) && Physical_IsATTY(phys) && Enabled(ConfUtmp)) | 175 if (phys->type == PHYS_STDIN && Physical_IsATTY(phys) && Enabled(ConfUtmp)) |
213 if (phys->Utmp) 214 LogPrintf(LogERROR, "Oops, already logged in on %s\n", phys->name.base); 215 else { 216 struct utmp ut; 217 218 memset(&ut, 0, sizeof ut); 219 time(&ut.ut_time); 220 strncpy(ut.ut_name, name, sizeof ut.ut_name); --- 14 unchanged lines hidden --- | 176 if (phys->Utmp) 177 LogPrintf(LogERROR, "Oops, already logged in on %s\n", phys->name.base); 178 else { 179 struct utmp ut; 180 181 memset(&ut, 0, sizeof ut); 182 time(&ut.ut_time); 183 strncpy(ut.ut_name, name, sizeof ut.ut_name); --- 14 unchanged lines hidden --- |