tcpip.c (155613) | tcpip.c (156123) |
---|---|
1/* | 1/* |
2 * $FreeBSD: head/usr.sbin/sysinstall/tcpip.c 155613 2006-02-13 20:49:32Z ceri $ | 2 * $FreeBSD: head/usr.sbin/sysinstall/tcpip.c 156123 2006-02-28 21:49:33Z jhb $ |
3 * 4 * Copyright (c) 1995 5 * Gary J Palmer. All rights reserved. 6 * Copyright (c) 1996 7 * Jordan K. Hubbard. All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions --- 88 unchanged lines hidden (view full) --- 99#define LAYOUT_OKBUTTON 7 100 { 19, 15, 0, 0, 101 "OK", "Select this if you are happy with these settings", 102 &okbutton, BUTTONOBJ, NULL }, 103#define LAYOUT_CANCELBUTTON 8 104 { 19, 35, 0, 0, 105 "CANCEL", "Select this if you wish to cancel this screen", 106 &cancelbutton, BUTTONOBJ, NULL }, | 3 * 4 * Copyright (c) 1995 5 * Gary J Palmer. All rights reserved. 6 * Copyright (c) 1996 7 * Jordan K. Hubbard. All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions --- 88 unchanged lines hidden (view full) --- 99#define LAYOUT_OKBUTTON 7 100 { 19, 15, 0, 0, 101 "OK", "Select this if you are happy with these settings", 102 &okbutton, BUTTONOBJ, NULL }, 103#define LAYOUT_CANCELBUTTON 8 104 { 19, 35, 0, 0, 105 "CANCEL", "Select this if you wish to cancel this screen", 106 &cancelbutton, BUTTONOBJ, NULL }, |
107 { 0 }, | 107 LAYOUT_END, |
108}; 109 110#define _validByte(b) ((b) >= 0 && (b) <= 255) 111 112/* whine */ 113static void 114feepout(char *msg) 115{ --- 56 unchanged lines hidden (view full) --- 172} 173 174/* Verify IPv4 netmask as being well-formed as 175 a 0x or AAA.BBB.CCC.DDD mask */ 176static int 177verifyNetmask(const char *netmask, unsigned long *out) 178{ 179 unsigned long mask; | 108}; 109 110#define _validByte(b) ((b) >= 0 && (b) <= 255) 111 112/* whine */ 113static void 114feepout(char *msg) 115{ --- 56 unchanged lines hidden (view full) --- 172} 173 174/* Verify IPv4 netmask as being well-formed as 175 a 0x or AAA.BBB.CCC.DDD mask */ 176static int 177verifyNetmask(const char *netmask, unsigned long *out) 178{ 179 unsigned long mask; |
180 unsigned long tmp; | 180 long tmp; |
181 char *endptr; 182 183 if (netmask[0] == '0' && (netmask[1] == 'x' || netmask[1] == 'X')) { 184 /* Parse out hex mask */ 185 mask = strtoul(netmask, &endptr, 0); 186 if (*endptr != '\0') 187 return 0; 188 } else { 189 /* Parse out quad decimal mask */ | 181 char *endptr; 182 183 if (netmask[0] == '0' && (netmask[1] == 'x' || netmask[1] == 'X')) { 184 /* Parse out hex mask */ 185 mask = strtoul(netmask, &endptr, 0); 186 if (*endptr != '\0') 187 return 0; 188 } else { 189 /* Parse out quad decimal mask */ |
190 mask = strtoul(netmask, &endptr, 10); 191 if (!_validByte(mask) || *endptr++ != '.') | 190 tmp = strtoul(netmask, &endptr, 10); 191 if (!_validByte(tmp) || *endptr++ != '.') |
192 return 0; | 192 return 0; |
193 mask = tmp; |
|
193 tmp = strtoul(endptr, &endptr, 10); 194 if (!_validByte(tmp) || *endptr++ != '.') 195 return 0; 196 mask = (mask << 8) + tmp; 197 tmp = strtoul(endptr, &endptr, 10); 198 if (!_validByte(tmp) || *endptr++ != '.') 199 return 0; 200 mask = (mask << 8) + tmp; --- 506 unchanged lines hidden --- | 194 tmp = strtoul(endptr, &endptr, 10); 195 if (!_validByte(tmp) || *endptr++ != '.') 196 return 0; 197 mask = (mask << 8) + tmp; 198 tmp = strtoul(endptr, &endptr, 10); 199 if (!_validByte(tmp) || *endptr++ != '.') 200 return 0; 201 mask = (mask << 8) + tmp; --- 506 unchanged lines hidden --- |