bother. unrevert my fix.

This commit is contained in:
Eric Andersen 2004-07-26 12:11:32 +00:00
parent 8f38782a6e
commit b2a300590d
2 changed files with 25 additions and 17 deletions

View File

@ -22,35 +22,42 @@
* *
*/ */
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include <ctype.h>
#include "libbb.h" #include "libbb.h"
#define isodigit(c) ((c) >= '0' && (c) <= '7')
#define hextobin(c) ((c)>='a'&&(c)<='f' ? (c)-'a'+10 : (c)>='A'&&(c)<='F' ? (c)-'A'+10 : (c)-'0')
#define octtobin(c) ((c) - '0')
char bb_process_escape_sequence(const char **ptr) char bb_process_escape_sequence(const char **ptr)
{ {
const char *p, *q;
unsigned int num_digits, r, n, hexescape;
static const char charmap[] = { static const char charmap[] = {
'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', 0, 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', 0,
'\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '\\' }; '\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '\\' };
const char *p; n = r = hexescape = num_digits = 0;
const char *q;
unsigned int num_digits;
unsigned int r;
unsigned int n;
n = 0;
q = *ptr; q = *ptr;
num_digits = 0; if (*q == 'x') {
hexescape++;
++q;
}
do { do {
if (((unsigned int)(*q - '0')) <= 7) { if (hexescape && isxdigit(*q)) {
r = n * 8 + (*q - '0'); r = n * 16 + hextobin(*q);
if (r <= UCHAR_MAX) { } else if (isodigit(*q)) {
n = r; r = n * 8 + octtobin(*q);
++q; }
if (++num_digits < 3) { if (r <= UCHAR_MAX) {
continue; n = r;
} ++q;
if (++num_digits < 3) {
continue;
} }
} }
break; break;

View File

@ -565,7 +565,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
int result = 0; int result = 0;
if (execable("/sbin/udhcpc")) { if (execable("/sbin/udhcpc")) {
execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
execute("kill -TERM `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); execute("kill -9 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
} else if (execable("/sbin/pump")) { } else if (execable("/sbin/pump")) {
result = execute("pump -i %iface% -k", ifd, exec); result = execute("pump -i %iface% -k", ifd, exec);
} else if (execable("/sbin/dhclient")) { } else if (execable("/sbin/dhclient")) {
@ -573,6 +573,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
} else if (execable("/sbin/dhcpcd")) { } else if (execable("/sbin/dhcpcd")) {
result = execute("dhcpcd -k %iface%", ifd, exec); result = execute("dhcpcd -k %iface%", ifd, exec);
} }
static_down(ifd, exec)
return (result || bootp_down(ifd, exec)); return (result || bootp_down(ifd, exec));
} }