FreeBSD Bugzilla – Attachment 82696 Details for
Bug 118296
[patch] ndiscvt(8) can't parse a STRING WORD pattern when it process a register key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.11 KB, created by
Weongyo Jeong
on 2007-11-28 02:10:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Weongyo Jeong
Created:
2007-11-28 02:10:01 UTC
Size:
3.11 KB
patch
obsolete
>Index: inf-parse.y >=================================================================== >RCS file: /data/cvs/src/usr.sbin/ndiscvt/inf-parse.y,v >retrieving revision 1.2 >diff -u -r1.2 inf-parse.y >--- inf-parse.y 2 Jan 2004 04:31:06 -0000 1.2 >+++ inf-parse.y 27 Nov 2007 12:31:56 -0000 >@@ -95,17 +95,12 @@ > ; > > regkey >- : WORD >+ : WORD regkey > { push_word($1); } >- | STRING >- { push_word($1); } >- | WORD COMMA regkey >- { push_word($1); } >- | STRING COMMA regkey >+ | STRING regkey > { push_word($1); } > | COMMA regkey > { push_word(NULL); } >- | COMMA >- { push_word(NULL); } >+ | > ; > %% >Index: inf.c >=================================================================== >RCS file: /data/cvs/src/usr.sbin/ndiscvt/inf.c,v >retrieving revision 1.16 >diff -u -r1.16 inf.c >--- inf.c 15 May 2005 19:46:14 -0000 1.16 >+++ inf.c 27 Nov 2007 12:31:56 -0000 >@@ -67,6 +67,8 @@ > static void dump_regvals (void); > static void dump_paramreg (const struct section *, > const struct reg *, int); >+static int regkey_getidx(int); >+static char * regkey_get(int); > > static FILE *ofp; > >@@ -736,6 +738,63 @@ > return (0); > } > >+static int >+regkey_getidx(int slot) >+{ >+ int i, nullcount; >+ >+ nullcount = 0; >+ >+ if (slot <= 0) >+ return 0; >+ >+ for (i = 0; i < idx; i++) { >+ if (words[i] != NULL) >+ continue; >+ >+ nullcount++; >+ if (nullcount == slot) >+ break; >+ } >+ >+ return i + 1; >+} >+ >+static char * >+regkey_get(int rt) >+{ >+ int i, start, slots; >+ char newbuf[256]; >+ >+ switch (rt) { >+ case REGKEY_SUBKEY: >+ start = regkey_getidx(3); >+ slots = regkey_getidx(4) - start - 1; >+ break; >+ case REGKEY_KEY: >+ start = regkey_getidx(2); >+ slots = regkey_getidx(3) - start - 1; >+ break; >+ case REGKEY_FLAGS: >+ start = regkey_getidx(1); >+ slots = regkey_getidx(2) - start - 1; >+ break; >+ case REGKEY_VALUE: >+ start = regkey_getidx(0); >+ slots = regkey_getidx(1) - start - 1; >+ break; >+ default: >+ return NULL; >+ } >+ >+ bzero(newbuf, sizeof(newbuf)); >+ >+ for (i = start + slots - 1; i >= start; i--) >+ (void)strcat(newbuf, words[i]); >+ >+ return sstrdup(newbuf); >+} >+ > void > regkey_add (const char *r) > { >@@ -745,10 +804,10 @@ > bzero(reg, sizeof(struct reg)); > reg->section = TAILQ_LAST(&sh, section_head); > reg->root = sstrdup(r); >- reg->subkey = sstrdup(words[3]); >- reg->key = sstrdup(words[2]); >- reg->flags = satoi(words[1]); >- reg->value = sstrdup(words[0]); >+ reg->subkey = regkey_get(REGKEY_SUBKEY); >+ reg->key = regkey_get(REGKEY_KEY); >+ reg->flags = satoi(regkey_get(REGKEY_FLAGS)); >+ reg->value = regkey_get(REGKEY_VALUE); > TAILQ_INSERT_TAIL(&rh, reg, link); > > free(__DECONST(char *, r)); >Index: inf.h >=================================================================== >RCS file: /data/cvs/src/usr.sbin/ndiscvt/inf.h,v >retrieving revision 1.1 >diff -u -r1.1 inf.h >--- inf.h 11 Dec 2003 22:38:14 -0000 1.1 >+++ inf.h 27 Nov 2007 12:31:56 -0000 >@@ -51,6 +51,11 @@ > #define FLG_ADDREG_TYPE_DWORD 0x00010001 > #define FLG_ADDREG_TYPE_NONE 0x00020001 > >+#define REGKEY_SUBKEY 0x0 >+#define REGKEY_KEY 0x1 >+#define REGKEY_FLAGS 0x2 >+#define REGKEY_VALUE 0x3 >+ > extern void section_add (const char *); > extern void assign_add (const char *); > extern void define_add (const char *);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 118296
: 82696