vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit f1f6db0c5d7fa1a4e80b7a42377d5f9f20db2c5a
parent 9720d679df046dfb219a6c20c006574baea63e40
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Sat, 18 Sep 2010 21:49:16 +0200

support quoted multiple lines in 9vx.ini (useful for initcmd)

Diffstat:
Mdoc/9vx.1 | 7+++++--
Msrc/9vx/conf.c | 8+++++++-
Msrc/9vx/main.c | 15+++++++--------
3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/doc/9vx.1 b/doc/9vx.1 @@ -164,9 +164,12 @@ pairs in a similar fasion to plan9.ini(8). Additional options are (that can also be part of a netdev line), .I zallowed. .I localroot. -.I initcmd. +.I initcmd, and -.I service +.I service. +New lines can be escaped surrounding +.I value +by simple quotes. .SS Exiting 9vx Reboot signals terminate 9vx execution. In particular, the reboot command will exit printing its arguments to starndard error. diff --git a/src/9vx/conf.c b/src/9vx/conf.c @@ -85,7 +85,7 @@ readini(char *fn) *p++ = '\n'; *p++ = 0; - nfields += getfields(cp, &iniline[nfields], MAXCONF-nfields, 0, "\n"); + nfields += gettokens(cp, &iniline[nfields], MAXCONF-nfields, "\n"); return 0; } @@ -95,6 +95,7 @@ inifields(void (*fp)(char*, char*)) { int i; char *cp; + char *cq; for(i = 0; i < MAXCONF; i++){ if(!iniline[i]) @@ -103,6 +104,11 @@ inifields(void (*fp)(char*, char*)) if(cp == 0) continue; *cp++ = 0; + if(*cp == '\''){ + cp++; + if((cq = strrchr(cp, '\'')) > 0) + *cq = 0; + } if(cp - iniline[i] >= NAMELEN+1) *(iniline[i]+NAMELEN-1) = 0; (fp)(iniline[i], cp); diff --git a/src/9vx/main.c b/src/9vx/main.c @@ -534,21 +534,20 @@ init0(void) if(initrc != 0){ if(localroot == nil && bootargc == 0){ - inienv("nobootprompt", defaultroot); - inienv("initcmd", defaultinit); - inienv("init", "/386/bin/rc -c 'eval $initcmd'"); + ksetenv("nobootprompt", defaultroot, 0); + ksetenv("initcmd", defaultinit, 0); + ksetenv("init", "/386/bin/rc -c 'eval $initcmd", 0); } else - inienv("init", "/386/init -tm"); + ksetenv("init", "/386/init -tm", 0); } else if(initcmd){ ksetenv("initcmd", initcmd, 0); - inienv("init", "/386/init -t '. /rc/bin/termrc; home=/usr/$user;\ - test -d $home && cd; rc -c $initcmd; reboot'"); + ksetenv("init", "/386/init -t '. /rc/bin/termrc; home=/usr/$user;\ + test -d $home && cd; rc -c $initcmd; reboot'", 0); } if(localroot) - inienv("nobootprompt", nobootprompt(localroot)); - inienv("cputype", "386"); + ksetenv("nobootprompt", nobootprompt(localroot), 0); poperror();