ipft_hx.c (145519) | ipft_hx.c (153881) |
---|---|
1/* $FreeBSD: head/contrib/ipfilter/lib/ipft_hx.c 145519 2005-04-25 18:20:15Z darrenr $ */ | 1/* $FreeBSD: head/contrib/ipfilter/lib/ipft_hx.c 153881 2005-12-30 11:52:26Z guido $ */ |
2 3/* 4 * Copyright (C) 1995-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)ipft_hx.c 1.1 3/9/96 (C) 1996 Darren Reed"; | 2 3/* 4 * Copyright (C) 1995-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)ipft_hx.c 1.1 3/9/96 (C) 1996 Darren Reed"; |
10static const char rcsid[] = "@(#)Id: ipft_hx.c,v 1.11.4.1 2004/12/09 19:41:20 darrenr Exp"; | 10static const char rcsid[] = "@(#)$Id: ipft_hx.c,v 1.11.4.3 2005/12/04 10:07:21 darrenr Exp $"; |
11#endif 12 13#include <ctype.h> 14 15#include "ipf.h" 16#include "ipt.h" 17 18 --- 59 unchanged lines hidden (view full) --- 78 if (s == line) 79 return (char *)ip - buf; 80 *s = '\0'; 81 } 82 if ((s = strchr(line, '#'))) 83 *s = '\0'; 84 if (!*line) 85 continue; | 11#endif 12 13#include <ctype.h> 14 15#include "ipf.h" 16#include "ipt.h" 17 18 --- 59 unchanged lines hidden (view full) --- 78 if (s == line) 79 return (char *)ip - buf; 80 *s = '\0'; 81 } 82 if ((s = strchr(line, '#'))) 83 *s = '\0'; 84 if (!*line) 85 continue; |
86 if (!(opts & OPT_BRIEF)) { | 86 if ((opts & OPT_DEBUG) != 0) { |
87 printf("input: %s", line); 88 } 89 90 if ((*line == '[') && (s = strchr(line, ']'))) { 91 t = line + 1; 92 if (s - t > 0) { 93 *s++ = '\0'; 94 if ((u = strchr(t, ',')) && (u < s)) { --- 8 unchanged lines hidden (view full) --- 103 } 104 } else if (ifn) 105 *ifn = t; 106 } 107 } else 108 s = line; 109 t = (char *)ip; 110 ip = (ip_t *)readhex(s, (char *)ip); | 87 printf("input: %s", line); 88 } 89 90 if ((*line == '[') && (s = strchr(line, ']'))) { 91 t = line + 1; 92 if (s - t > 0) { 93 *s++ = '\0'; 94 if ((u = strchr(t, ',')) && (u < s)) { --- 8 unchanged lines hidden (view full) --- 103 } 104 } else if (ifn) 105 *ifn = t; 106 } 107 } else 108 s = line; 109 t = (char *)ip; 110 ip = (ip_t *)readhex(s, (char *)ip); |
111 if (!(opts & OPT_BRIEF)) { | 111 if ((opts & OPT_DEBUG) != 0) { |
112 if (opts & OPT_ASCII) { 113 if (t < (char *)ip) 114 putchar('\t'); 115 while (t < (char *)ip) { 116 if (ISPRINT(*t) && ISASCII(*t)) 117 putchar(*t); 118 else 119 putchar('.'); 120 t++; 121 } 122 } 123 putchar('\n'); 124 fflush(stdout); 125 } 126 } | 112 if (opts & OPT_ASCII) { 113 if (t < (char *)ip) 114 putchar('\t'); 115 while (t < (char *)ip) { 116 if (ISPRINT(*t) && ISASCII(*t)) 117 putchar(*t); 118 else 119 putchar('.'); 120 t++; 121 } 122 } 123 putchar('\n'); 124 fflush(stdout); 125 } 126 } |
127 if (feof(tfp)) 128 return 0; |
|
127 return -1; 128} 129 130 131static char *readhex(src, dst) 132register char *src, *dst; 133{ 134 int state = 0; --- 24 unchanged lines hidden --- | 129 return -1; 130} 131 132 133static char *readhex(src, dst) 134register char *src, *dst; 135{ 136 int state = 0; --- 24 unchanged lines hidden --- |