From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Cross Message-Id: <200104170034.UAA27111@augusta.math.psu.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] Spaces in values in plan9.ini? In-Reply-To: <20010416184538.3F48719A0A@mail.cse.psu.edu> Cc: Date: Mon, 16 Apr 2001 20:34:52 -0400 Topicbox-Message-UUID: 83779eee-eac9-11e9-9e20-41e7f4b1d025 In article <20010416184538.3F48719A0A@mail.cse.psu.edu> you write: >That sort of thing was precisely the reason for the change >to tokenize. Please try it, see if it works, and tell us the >result. Thanks. Okay, I changed it, and it seems to be working fine. However, the change to parsecmd() was only part of the fix; the other part was modifying isaconfig() in the couple of places it appears to deal with quoted strings in plan9.ini. I did a hack job of fixing that, allowing simple quoted strings by introducing a flag variable into isaconfig(), but it doesn't deal with nested or quoted quotes. Note that one has to preserve the quotes when passing data from plan9.ini, otherwise tokenize() in parsecmd() won't get what it's expecting. I suppose the real fix would be to abstract the parsing of plan9.ini into a library. Anyway, diff's follow. I don't think I missed anything I changed. - Dan C. diff /sys/src/9/port/lib.h 9/port/lib.h 82a83 > extern int tokenize(char *, char**, int); diff /sys/src/9/port/parse.c 9/port/parse.c 24c24 < cb->nf = getfields(cb->buf, cb->f, nelem(cb->f), 1, " "); --- > cb->nf = tokenize(cb->buf, cb->f, nelem(cb->f)); diff /sys/src/9/pc/main.c 9/pc/main.c 646c646 < int n; --- > int n, inquote; 682c682,686 < while(*p && *p != ' ' && *p != '\t'){ --- > inquote = 0; > while(*p && (inquote || (*p != ' ' && *p != '\t'))){ > if (*p == '\'') { > inquote = (inquote != 0) ? 0 : 1; > } diff /sys/src/boot/pc/conf.c boot/pc/conf.c 480c480 < int n; --- > int n, inquote; 516c516,520 < while(*p && *p != ' ' && *p != '\t'){ --- > inquote = 0; > while(*p && (inquote || (*p != ' ' && *p != '\t'))){ > if (*p == '\'') { > inquote = (inquote != 0) ? 0 : 1; > }