/* This provides the XUL interface for Linuxconf. This interface could have been done using a new GUI frontend without changing a single line in Linuxconf. I have choosen to implement this internally in Linuxconf for the following reason -One potential interest in linuxconf-lib with the tlmpwork project. This project may evolve to provide hosting. So we need good performance and having to go back and forth between the application and the faked GUI front-end and then the browser would lower the performance. -XUL may introduce new interesting features of its own and this will potentially ripple up to the application layer. For example, application may send special javascripts to enhance one widget behavior. -Not sure. This is a prototype */ #include #include #include #include #include #include "dialog.h" static FILE *fout = NULL; static int seq = 0; static void open_xul () { if (fout == NULL){ char tmp[1000]; mkdir ("/tmp/xul",0755); seq++; snprintf (tmp,sizeof(tmp)-1,"/tmp/xul/test.%03d.xul",seq); fout = fopen(tmp,"w"); if (fout == NULL){ fprintf (stderr,"Can't create /tmp/xul/test... files\n"); exit (-1); } } } static void close_xul () { if (fout != NULL){ fclose (fout); fout = NULL; } } const char *xul_quote (const char *s, SSTRING &dst) { char tmp[1000]; char *pt = tmp; *pt++ = '"'; while (*s != '\0' && (pt-tmp) < 997){ if (*s == '"'){ pt = stpcpy (pt,"&dquot;"); pt++; }else{ *pt++ = *s; } s++; } *pt++ = '"'; *pt++ = '\0'; dst.setfrom (tmp); return dst.get(); } void xul_send_Label (const char *s) { // See diagui_send_Label for details if (s[0] != '\n'){ SSTRING tmp; fprintf (fout,"