minit

A small yet feature-complete init (http://fefe.de/minit/)
Log | Files | Refs | README | LICENSE

commit f0169e13309403e13bba966597cfd3a262209e67
parent 88b42d7956af7657f6ab50f9bca1e70528525163
Author: leitner <leitner>
Date:   Tue,  4 Jun 2002 23:43:14 +0000

cosmetic changes

Diffstat:
Mbuffer.h | 5+++++
Mminit.c | 10+++++-----
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/buffer.h b/buffer.h @@ -38,6 +38,11 @@ extern int buffer_bget(buffer* b,char* x,unsigned int len); extern int buffer_feed(buffer* b); extern int buffer_getc(buffer* b,char* x); extern int buffer_getn(buffer* b,char* x,unsigned int len); + +/* read bytes until the destination buffer is full (len bytes), end of + * file is reached or the read char is in charset (setlen bytes). An + * empty line when looking for \n will write '\n' to x and return 0. If + * EOF is reached, \0 is written to the buffer */ extern int buffer_get_token(buffer* b,char* x,unsigned int len,const char* charset,unsigned int setlen); #define buffer_getline(b,x,len) buffer_get_token((b),(x),(len),"\n",1) diff --git a/minit.c b/minit.c @@ -284,11 +284,11 @@ int startservice(int service,int pause) { if (chdir(MINITROOT) || chdir(root[service].name)) return -1; if ((dir=open(".",O_RDONLY))>=0) { if (!openreadclose("depends",&s,&len)) { - char **argv; - int argc,i; - argv=split(s,'\n',&argc,0,0); - for (i=0; i<argc; i++) { - int service=loadservice(argv[i]); + char **deps; + int depc,i; + deps=split(s,'\n',&depc,0,0); + for (i=0; i<depc; i++) { + int service=loadservice(deps[i]); if (service>=0 && root[service].pid!=1) startservice(service,0); }