English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Contents of /branches/common-nfo/package/busybox/patches/970-ifupdown-whitespace.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3427 - (show annotations) (download)
Wed Aug 8 11:08:41 2007 UTC (6 years, 6 months ago) by tg
File size: 1395 byte(s)
merge in trunk rev. 3426
1
2 submitted as http://bugs.busybox.net/view.php?id=1436
3
4 --- busybox-1.4.2/networking/ifupdown.c.old Tue May 22 17:22:57 2007
5 +++ busybox-1.4.2/networking/ifupdown.c Tue May 22 17:23:35 2007
6 @@ -658,6 +658,51 @@ static struct interfaces_file_t *read_in
7 while ((buf = xmalloc_getline(f)) != NULL) {
8 char *buf_ptr = buf;
9
10 + /* skip comments -- tg@freewrt.org */
11 + {
12 + unsigned char inquote = 0;
13 + skipcommloop:
14 + if (inquote == 0)
15 + switch (*buf_ptr) {
16 + case '\'':
17 + case '\\':
18 + case '"':
19 + inquote = *buf_ptr;
20 + break;
21 + case '#':
22 + *buf_ptr = '\0';
23 + goto skipcommend;
24 + }
25 + else if (inquote == '\\')
26 + inquote = 0;
27 + else if ((inquote == '\'') && (*buf_ptr == '\''))
28 + inquote = 0;
29 + else if (inquote == '"')
30 + switch (*buf_ptr) {
31 + case '"':
32 + inquote = 0;
33 + break;
34 + case '\\':
35 + /* escape one via backslash inside " */
36 + inquote = '!';
37 + break;
38 + }
39 + else if (inquote == '!')
40 + inquote = '"';
41 + buf_ptr++;
42 + if (*buf_ptr)
43 + goto skipcommloop;
44 + skipcommend: /* required */;
45 + }
46 +
47 + /* rtrim -- tg@freewrt.org */
48 + buf_ptr = buf + strlen(buf) - 1;
49 + while ((buf_ptr >= buf) && /* can't be '\n' */
50 + ((*buf_ptr == ' ') || (*buf_ptr == '\t')))
51 + --buf_ptr;
52 + *++buf_ptr = '\0';
53 +
54 + buf_ptr = buf;
55 firstword = next_word(&buf_ptr);
56 if (firstword == NULL) {
57 free(buf);

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20