Path: utzoo!news-server.csri.toronto.edu!rutgers!njin!princeton!grendel.Princeton.EDU From: rhl@grendel.Princeton.EDU (Robert Lupton (the Good)) Newsgroups: comp.windows.x Subject: Illegal databases confuse XrmParseCommand Message-ID: <6990@idunno.Princeton.EDU> Date: 9 Mar 91 04:00:28 GMT Sender: news@idunno.Princeton.EDU Organization: Princeton University Lines: 35 With the MIT X11R4 server, passing a garbage XrmDatabase to XrmParseCommand causes a bus error (NULL is OK). As XrmParseCommand is supposed to set rather than modify a database this is a little surprising (I imagine that it is cleaning up), and doesn't appear to be documented. This was a nasty bug to find --- it depended on the state of the stack left by the main programme that this was a subroutine of. Robert /********************************************************************/ #include #include static XrmOptionDescRec options[] = { {"-display", ".display", XrmoptionSepArg, NULL}, }; int main(ac,av) int ac; char *av[]; { char *option_type; XrmDatabase args_db; XrmValue value; XrmInitialize(); args_db = (XrmDatabase)1; /* point somewhere illegal... */ XrmParseCommand(&args_db,options,1,av[0],&ac,av); XrmGetResource(args_db,"foo.display","",&option_type,&value); return(0); }