[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: debconf client support in cdebconf



Cool, I'm using this for netcfg. One little problem that get's fixed by this:

Index: debconfclient.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/cdebconf/src/debconfclient.c,v
retrieving revision 1.1
diff -u -r1.1 debconfclient.c
--- debconfclient.c     2000/12/09 07:19:11     1.1
+++ debconfclient.c     2000/12/11 05:02:34
@@ -69,10 +145,12 @@
        CHOMP(buf);
        if (strlen(buf) > 0) 
        {
+               char *ptr;
                /* strip off the return code */
                strtok(buf, " \t\n");
                DELETE(client->value);
-               client->value = STRDUP(strtok(NULL, "\n"));
+               ptr = strtok(NULL,"\n");
+               client->value = STRDUP(ptr);
                return atoi(buf);
        }
        else 

The problem with the old way is that the STRDUP() macro expands to make two
calls to strtok(), first to make sure the return value !=NULL, and then again to
try and duplicate the sring.  The second call to strtok() returns something
different than the first call, and we fail.

It's possible that I'm confused, if so, let me know and I'll search for a
problem on my end.

-David


Sat, Dec 09, 2000 at 12:38:39AM -0700 wrote:
> Since there are a few copies of debconf.[ch] appearing in
> debian-installer cvs, i've added debconf-client support code to
> libdebconf (cdebconf) so we don't duplicate it too much.
> 
> the API is pretty simple:
> 
> #include <debconfclient.h>
> 
> struct debconfclient *client = debconfclient_new();
> client->command(client, "INPUT", "low", "foo/bar", NULL);
> myvar = client->value;
> (or myvar = client->ret(client); )
> /* ... */
> debconfclient_delete(client);
> 
> to compile the library, go to tools/cdebconf, and do ./configure; make
> 
> add -I(path to tools/cdebconf/src) to your makefile for now, and
> -L(path) -ldebconf to link.
> 
> By default libdebconf is built with a rpath set to the path where
> cdebconf is, so you don't need to set LD_LIBRARY_PATH. If you don't want
> that you can set --without-rpath when you build cdebconf
> 
> I'll make a -dev package for cdebconf at some point, but it's moving too
> fast now and the API may change from time to time.
> 
> randolph
> -- 
> Debian Developer <tausq@debian.org>
> http://www.TauSq.org/
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-boot-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: