19 #include <X11/Intrinsic.h> 20 #include <X11/StringDefs.h> 23 static XtAppContext app_con;
24 static Widget toplevel;
25 static char *hcopydev;
27 static String fallback_resources[] = {
29 "help.help.background: lightgrey",
30 "help.help.Box.background: lightblue",
31 "help.help.Box.Command.background: yellow",
32 "help.help.Box.Toggle.background: yellow",
33 "help.help.Box.Label.background: pink",
34 "help.help.Label.background: pink",
36 "help.popup.form.background: lightblue",
37 "help.popup.form.Command.background: yellow",
38 "help.popup.form.Label.background: pink",
40 "help.popup_m.form_m.background: pink",
41 "help.popup_m.form_m.Command.background: yellow",
54 XGetErrorText(display, errorev->error_code, ErrorMessage, 1024);
61 CRaction(caller, call_data, params, numparams)
69 Widget action = XtNameToWidget(XtParent(caller),
"action");
72 XtCallCallbacks(action, XtNcallback,
NULL);
77 QUaction(caller, call_data, params, numparams)
87 quit = XtNameToWidget(caller,
"help.buttonbox.delete");
89 XtCallCallbacks(quit, XtNcallback,
NULL);
92 static XtActionsRec actions[] = {
125 Help_Path =
copy(SPICE_HELP);
128 else if ((s =
getenv(
"SPICE_LIB_DIR")) !=
NULL) {
129 Help_Path =
tmalloc(strlen(s) + 10);
130 sprintf(Help_Path,
"%s/helpdir",s);
145 XtToolkitInitialize();
146 app_con = XtCreateApplicationContext();
147 XtAppSetFallbackResources(app_con, fallback_resources);
151 fprintf(stderr,
"Error: Can't open X display");
155 XtAppAddActions(app_con, actions,
XtNumber(actions));
165 XtAppMainLoop(app_con);
177 fprintf(stderr,
"fatal error\n");
189 if (!strcmp(n, kw_hcopydev)) {
204 int bcnt = 0, ecnt = 0;
208 if (*t ==
'/' || *t ==
'\\') {
214 else if (*t ==
'.') {
219 if (bcnt++ < 8) *s++ = *t++;
223 if (ecnt++ < 4) *s++ = *t++;
232 if (
index(buf,
'~')) {
257 while (*
string && isspace(*
string))
265 if (!*
string || *
string ==
'/') {
266 pw = getpwuid(getuid());
271 while ((c = *
string) && c !=
'/')
288 return (
copy(
string));
void cp_pathfix(char *buf)
static char buf[MAXPROMPT]
bool cp_getvar(char *n, int t, char *r)
static int errorhandler()
char * index(char *s, char c) const
static char * tilde_expand()
int main(int argc, char **argv)