advcap.c (33841545909f4a4ee94aa148b3a9cbcdc1abb02a) | advcap.c (e1b4d8d0746069292d84708b0e11b17a7e1ef5e0) |
---|---|
1/* $FreeBSD$ */ 2/* $KAME: advcap.c,v 1.5 2001/02/01 09:12:08 jinmei Exp $ */ 3 4/* 5 * Copyright (c) 1983 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 148 unchanged lines hidden (view full) --- 157 if (c == '\n') { 158 if (cp > bp && cp[-1] == '\\') { 159 cp--; 160 continue; 161 } 162 break; 163 } 164 if (cp >= bp+BUFSIZ) { | 1/* $FreeBSD$ */ 2/* $KAME: advcap.c,v 1.5 2001/02/01 09:12:08 jinmei Exp $ */ 3 4/* 5 * Copyright (c) 1983 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 148 unchanged lines hidden (view full) --- 157 if (c == '\n') { 158 if (cp > bp && cp[-1] == '\\') { 159 cp--; 160 continue; 161 } 162 break; 163 } 164 if (cp >= bp+BUFSIZ) { |
165 write(2,"Remcap entry too long\n", 23); | 165 write(STDERR_FILENO, "Remcap entry too long\n", 166 23); |
166 break; 167 } else 168 *cp++ = c; 169 } 170 *cp = 0; 171 172 /* 173 * The real work for the match. --- 19 unchanged lines hidden (view full) --- 193 char tcname[16]; /* name of similar terminal */ 194 char tcbuf[BUFSIZ]; 195 char *holdtbuf = tbuf; 196 int l; 197 198 p = tbuf + strlen(tbuf) - 2; /* before the last colon */ 199 while (*--p != ':') 200 if (p<tbuf) { | 167 break; 168 } else 169 *cp++ = c; 170 } 171 *cp = 0; 172 173 /* 174 * The real work for the match. --- 19 unchanged lines hidden (view full) --- 194 char tcname[16]; /* name of similar terminal */ 195 char tcbuf[BUFSIZ]; 196 char *holdtbuf = tbuf; 197 int l; 198 199 p = tbuf + strlen(tbuf) - 2; /* before the last colon */ 200 while (*--p != ':') 201 if (p<tbuf) { |
201 write(2, "Bad remcap entry\n", 18); | 202 write(STDERR_FILENO, "Bad remcap entry\n", 18); |
202 return (0); 203 } 204 p++; 205 /* p now points to beginning of last field */ 206 if (p[0] != 't' || p[1] != 'c') 207 return (1); 208 strcpy(tcname, p+3); 209 q = tcname; 210 while (*q && *q != ':') 211 q++; 212 *q = 0; 213 if (++hopcount > MAXHOP) { | 203 return (0); 204 } 205 p++; 206 /* p now points to beginning of last field */ 207 if (p[0] != 't' || p[1] != 'c') 208 return (1); 209 strcpy(tcname, p+3); 210 q = tcname; 211 while (*q && *q != ':') 212 q++; 213 *q = 0; 214 if (++hopcount > MAXHOP) { |
214 write(2, "Infinite tc= loop\n", 18); | 215 write(STDERR_FILENO, "Infinite tc= loop\n", 18); |
215 return (0); 216 } 217 if (getent(tcbuf, tcname, remotefile) != 1) { 218 return (0); 219 } 220 for (q = tcbuf; *q++ != ':'; ) 221 ; 222 l = p - holdtbuf + strlen(q); 223 if (l > BUFSIZ) { | 216 return (0); 217 } 218 if (getent(tcbuf, tcname, remotefile) != 1) { 219 return (0); 220 } 221 for (q = tcbuf; *q++ != ':'; ) 222 ; 223 l = p - holdtbuf + strlen(q); 224 if (l > BUFSIZ) { |
224 write(2, "Remcap entry too long\n", 23); | 225 write(STDERR_FILENO, "Remcap entry too long\n", 23); |
225 q[BUFSIZ - (p-holdtbuf)] = 0; 226 } 227 strcpy(p, q); 228 tbuf = holdtbuf; 229 return (1); 230} 231 232/* --- 222 unchanged lines hidden --- | 226 q[BUFSIZ - (p-holdtbuf)] = 0; 227 } 228 strcpy(p, q); 229 tbuf = holdtbuf; 230 return (1); 231} 232 233/* --- 222 unchanged lines hidden --- |