📄 xdbx.c
字号:
{"-r", "dbxopt_r", XrmoptionNoArg, "True"}, {"-i", "dbxopt_i", XrmoptionNoArg, "True"}, {"-I", "includeDir", XrmoptionSepArg, NULL}, {"-k", "dbxopt_k", XrmoptionNoArg, "True"},#ifdef BSD /* Berkeley dbx */ {"-c", "cfile", XrmoptionSepArg, NULL},#else /* Sun dbx */ {"-kbd", "dbxopt_kbd", XrmoptionNoArg, "True"}, {"-f", "fcount", XrmoptionSepArg, NULL}, {"-s", "startup", XrmoptionSepArg, NULL}, {"-sr", "tstartup", XrmoptionSepArg, NULL},#endif#ifdef MIPS /* Mips dbx */ {"-pixie", "pixie", XrmoptionNoArg, "True"},#endif#endif /* not GDB */};XtActionsRec xdbx_actions[] = { {"SelectStart", (XtActionProc) SelectStart}, {"SelectEnd", (XtActionProc) SelectEnd}, {"SelectWord", (XtActionProc) SelectWord}, {"PrintSelection", (XtActionProc) PrintSelection}, {"Update", (XtActionProc) Update}, {"DeleteWord", (XtActionProc) DeleteWord}, {"DeleteLine", (XtActionProc) DeleteLine}, {NULL, NULL}};static void Syntax(call)char *call;{ fprintf(stderr,#ifdef GDB "Usage: %s [-toolkitoptions] [-gdboptions] [objfile [corefile]]\n",#else "Usage: %s [-toolkitoptions] [-dbxoptions] [objfile [corefile]]\n",#endif /* not GDB */ call); exit(1);}/* Set window manager hints to indicate display accepts input. * Initialize routines in source.c, signs.c and parser.c. * Disable window resize of fileWindow. * Get the name of the dbx command initialization file. */static void main_init(){ XWMHints wmhints; char title[100]; display = XtDisplay(toplevel); watch = XCreateFontCursor(display, XC_watch);#ifdef GDB sprintf(title, "xxgdb %s", XGDBVERSION); XStoreName(display, XtWindow(toplevel), title); XSetIconName(display, XtWindow(toplevel), "xxgdb");#else sprintf(title, "xdbx %s (patch level %d)", VERSION, PATCHLEVEL); XStoreName(display, XtWindow(toplevel), title); XSetIconName(display, XtWindow(toplevel), "xdbx");#endif /* not GDB */ wmhints.input = True; if (app_resources.bigicon) wmhints.icon_pixmap = XCreateBitmapFromData(display, XtWindow(toplevel), xdbx64_bits, xdbx64_width, xdbx64_height); else wmhints.icon_pixmap = XCreateBitmapFromData(display, XtWindow(toplevel), xdbx48_bits, xdbx48_width, xdbx48_height); wmhints.flags = IconPixmapHint | InputHint; XSetWMHints(display, XtWindow(toplevel), &wmhints); if (!app_resources.delimiters || strcmp(app_resources.delimiters, "") == 0) app_resources.delimiters = XtNewString(DELIMITERS); if (app_resources.prompt && strcmp(app_resources.prompt, "") != 0) xdbxprompt = app_resources.prompt; else xdbxprompt = XtNewString(XDBXPROMPT); debug = app_resources.debug; DisableWindowResize(fileWindow);#ifdef GDB /* (PW)28DEC93: we can override the default .gdbinit file */ if (app_resources.gdbinit) strcpy(gdbinit, app_resources.gdbinit); else strcpy (gdbinit, ".gdbinit"); if (debug) fprintf(stderr,"Startup file would be \"%s\"\n", gdbinit); if (app_resources.nx) strcpy(xdbxinit, ""); else { strcpy(xdbxinit, gdbinit); if (access(xdbxinit, R_OK) == -1) { sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), gdbinit); if (access(xdbxinit, R_OK) == -1) strcpy(xdbxinit, ""); } }#else strcpy(xdbxinit, ".dbxinit"); if (access(xdbxinit, R_OK) == -1) { sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".dbxinit"); if (access(xdbxinit, R_OK) == -1) strcpy(xdbxinit, ""); }#endif /* not GDB */ source_init(); signs_init(); parser_init();}/* Reconstruct command line arguments for calling dbx. * Return the argument list for dbx and new value of argc. */static char **dbxoptions(argc, argv, app_resources) int *argc; char **argv; XdbxResources *app_resources;{ char **dbxargv;#ifndef GDB char *temp = (char *)XtNewString("xdbx.XXXXXX");#endif int i=0; dbxargv = (char **) XtMalloc (MAXARGS * sizeof(char *)); for (i=0; i < *argc; i++) dbxargv[i] = argv[i];#ifdef GDB dbxargv[i++] = "-fullname"; /* see gdb_regex.h */#endif /* GDB */ if (app_resources->dbxopt_r) dbxargv[i++] = "-r"; if (app_resources->dbxopt_i) dbxargv[i++] = "-i"; if (app_resources->includeDir) {#ifdef GDB dbxargv[i++] = "-d";#else dbxargv[i++] = "-I";#endif /* not GDB */ dbxargv[i++] = app_resources->includeDir; } if (app_resources->dbxopt_k) dbxargv[i++] = "-k"; if (app_resources->cfile) { dbxargv[i++] = "-c"; dbxargv[i++] = app_resources->cfile; } if (app_resources->dbxopt_kbd) dbxargv[i++] = "-kbd"; if (app_resources->fcount) { dbxargv[i++] = "-f"; dbxargv[i++] = app_resources->fcount; } /* If .dbxinit exists in the local or home directory, include the option * -c (Berkeley dbx) or -s (Sun dbx) and a dummy filename as the option * argument. This will prevent dbx from reading the user's command * initialization file. Xdbx will read each line and pass it to dbx * instead. */ #ifdef GDB /* for GDB, always use option -nx */ dbxargv[i++] = "-nx";#else if (strcmp(xdbxinit, "")) { /* .dbxinit or ~/.dbxinit exists */#ifdef BSD dbxargv[i++] = "-c";#else dbxargv[i++] = "-s";#endif dbxargv[i++] = (char *) mktemp(temp); }#endif /* not GDB */ if (app_resources->startup) { /* overwrites dbxinit */ Tstartup = False; strcpy(xdbxinit, app_resources->startup); } if (app_resources->tstartup) { /* overwrites dbxinit */ Tstartup = True; strcpy(xdbxinit, app_resources->tstartup); }#ifndef GDB#ifdef MIPS if (app_resources->pixie) { /* pixie output */ dbxargv[i++] = "-pixie"; }#endif#endif /* not GDB */ dbxargv[i] = NULL; *argc = i; return dbxargv;}void main(argc, argv)int argc;char **argv;{ char **dbxargv; progname = argv[0]; /* (MJH) */ #ifndef GDB /* (PW)12MAR93 : for gdb, use pwd command of gdb */#ifdef SYSV getcwd((char *)cwd, MAXPATHLEN);#endif#endif /* not GDB */ trap_signals(); toplevel = XtAppInitialize(&app_context, "XDbx", options, XtNumber(options), &argc, argv, fallback_resources, NULL, 0); if (argc > 3) Syntax(argv[0]); XtGetApplicationResources(toplevel, &app_resources, resources, XtNumber(resources), NULL, 0); XtAppAddActions(app_context, xdbx_actions, XtNumber(xdbx_actions)); CreateSubWindows(toplevel); XtRealizeWidget(toplevel); main_init(); #ifdef GDB AppendDialogText("XXGDB comes with ABSOLUTELY NO WARRANTY.\n");#endif dbxargv = dbxoptions(&argc, argv, &app_resources); calldbx(argc, dbxargv);#ifdef NEW_INTERFACE State_Transient(sourceToggle, sourceShell, NULL); State_Transient(commandToggle, commandShell, NULL);#ifdef GDB State_Transient(displayToggle, displayShell, NULL);#endif XtRealizeWidget(toplevel); /* just to bring the window ahead */#endif /* NEW_INTERFACE */ XtAppMainLoop(app_context);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -