getttyent.c (9272) | getttyent.c (17141) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 36 unchanged lines hidden (view full) --- 45 46struct ttyent * 47getttynam(tty) 48 const char *tty; 49{ 50 register struct ttyent *t; 51 52 setttyent(); | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 36 unchanged lines hidden (view full) --- 45 46struct ttyent * 47getttynam(tty) 48 const char *tty; 49{ 50 register struct ttyent *t; 51 52 setttyent(); |
53 while (t = getttyent()) | 53 while ( (t = getttyent()) ) |
54 if (!strcmp(tty, t->ty_name)) 55 break; 56 endttyent(); 57 return (t); 58} 59 60struct ttyent * 61getttyent() --- 53 unchanged lines hidden (view full) --- 115 } 116 117 if (zapchar == '#' || *p == '#') 118 while ((c = *++p) == ' ' || c == '\t') 119 ; 120 tty.ty_comment = p; 121 if (*p == 0) 122 tty.ty_comment = 0; | 54 if (!strcmp(tty, t->ty_name)) 55 break; 56 endttyent(); 57 return (t); 58} 59 60struct ttyent * 61getttyent() --- 53 unchanged lines hidden (view full) --- 115 } 116 117 if (zapchar == '#' || *p == '#') 118 while ((c = *++p) == ' ' || c == '\t') 119 ; 120 tty.ty_comment = p; 121 if (*p == 0) 122 tty.ty_comment = 0; |
123 if (p = index(p, '\n')) | 123 if ( (p = index(p, '\n')) ) |
124 *p = '\0'; 125 return (&tty); 126} 127 128#define QUOTED 1 129 130/* 131 * Skip over the current field, removing quotes, and return a pointer to --- 43 unchanged lines hidden (view full) --- 175 176int 177setttyent() 178{ 179 180 if (tf) { 181 rewind(tf); 182 return (1); | 124 *p = '\0'; 125 return (&tty); 126} 127 128#define QUOTED 1 129 130/* 131 * Skip over the current field, removing quotes, and return a pointer to --- 43 unchanged lines hidden (view full) --- 175 176int 177setttyent() 178{ 179 180 if (tf) { 181 rewind(tf); 182 return (1); |
183 } else if (tf = fopen(_PATH_TTYS, "r")) | 183 } else if ( (tf = fopen(_PATH_TTYS, "r")) ) |
184 return (1); 185 return (0); 186} 187 188int 189endttyent() 190{ 191 int rval; 192 193 if (tf) { 194 rval = !(fclose(tf) == EOF); 195 tf = NULL; 196 return (rval); 197 } 198 return (1); 199} | 184 return (1); 185 return (0); 186} 187 188int 189endttyent() 190{ 191 int rval; 192 193 if (tf) { 194 rval = !(fclose(tf) == EOF); 195 tf = NULL; 196 return (rval); 197 } 198 return (1); 199} |