Files
mcde/programs/dterror/dterror.c
T
lotherkandClaude Sonnet 5.5 c01da186a7 MCDE: dtksh is out; dterror.ds is a Motif program; dtterm keeps starting the login shell
Konrad, 2026-11-14: "was soll dtksh ueberhaupt sein... einfach ne shell von
CDE? fuck it. schmeiss das komplett raus aus MCDE."  dtksh is CDE's ksh93
with Motif bindings for scripting dialogs; its bundled ksh93 (AT&T ast's
bin/package) compiles and RUNS test programs while it builds, which a cross
build for NetBSD on a Linux host cannot do -- the reason wm/mcde did not
build for days ("cc: not found", userland-2026-11-14g.log).

- programs/dtksh removed (1204 files); not in programs/Makefile.am,
  configure.ac, the recipe (REPLACE_INTERPRETER dtksh, KSH_CC), PLIST (bin,
  lib, man page, six catalogues), msg.C.am (dtksh.cat), AGENTS.md.
- What used dtksh:
  * dterror.src, dtfile_error.cpp, types/error.ds.src: an error dialog with a
    message.  New programs/dterror/dterror.c (about 70 lines of Motif), built
    as dterror.ds: dterror.ds MESSAGE [TITLE [OK-LABEL]], the convention of
    every caller (the data types, dtopen, dtfile ModAttr.c).  dtfile_error
    was only the 'test' entry of dtfile.config and ModAttr.c's fallback; the
    entry is gone and ModAttr.c calls dterror.ds.
  * dthelpgen.dtsh: the "building help" dialog helpgen.c forked; it runs
    silently now (childPid stays -1).
  * dtprintegrate/dtlp.src: the print dialog (1711 lines of dtksh); printing
    is to come back through CUPS (tasksd t0177, t0193).  dtlp's man page is
    out of the doc build and PLIST with it.
  * The data types DTKSH_SCRIPT (*.ds) and DTKSH_CONV (*.dtsh) in dt.dt.src:
    they would have classed dterror.ds as a script.
- dtterm needs no change: lib/DtTerm/TermPrim/TermPrimSubproc.c takes /usr/bin/zsh,
  then the shell of the passwd entry, then /bin/sh, and never started dtksh.
- ksh93 stays as the NetBSD binary for the scripts that say ksh (Xsession).

Measured: make mcde-linux exit=0 (build/logs/mcde-linux-nodtksh-2026-11-14.log),
autogen picked up programs/dterror; dterror.ds under Xvfb shows the error
icon, a two-line message and one button "Understood", and exits 0 on Return.

Not in this commit: the other agents' pending dtfile edits (Search.c,
Navigation.c) and the regenerated distinfo files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 09:12:55 +00:00

73 lines
2.1 KiB
C

/*
* dterror.ds -- an error dialog with a message.
*
* usage: dterror.ds MESSAGE [TITLE [OK-LABEL]]
*
* For the places that have to tell the user something when the program that
* should do it cannot: an action whose command is missing, an exec that failed
* in a child, an error before an application's window exists (the data types
* of the desktop, dtopen, dtfile). It was a dtksh script (dterror.src,
* dtfile_error.cpp, types/error.ds.src); Konrad, 2026-11-14: dtksh is out of
* MCDE, this is a Motif program like the rest, in C.
*
* Copyright (c) 2026 The Makronix project. GNU LGPL 2.0 or later, as CDE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/MessageB.h>
static void
Quit(Widget w, XtPointer data, XtPointer call)
{
(void) w;
(void) data;
(void) call;
exit(0);
}
int
main(int argc, char **argv)
{
XtAppContext app;
Widget top, dialog;
Arg args[4];
XmString message, title, ok = NULL;
int n = 0;
top = XtVaOpenApplication(&app, "DtError", NULL, 0, &argc, argv, NULL,
applicationShellWidgetClass, NULL);
if (argc < 2) {
fprintf(stderr, "usage: dterror.ds MESSAGE [TITLE [OK-LABEL]]\n");
return 2;
}
/* LtoR: the message may have line ends */
message = XmStringCreateLtoR(argv[1], XmFONTLIST_DEFAULT_TAG);
title = XmStringCreateLocalized(argc > 2 ? argv[2] : "dt Error");
XtSetArg(args[n], XmNmessageString, message); n++;
XtSetArg(args[n], XmNdialogTitle, title); n++;
if (argc > 3) {
ok = XmStringCreateLocalized(argv[3]);
XtSetArg(args[n], XmNokLabelString, ok); n++;
}
dialog = XmCreateErrorDialog(top, "error", args, n);
XmStringFree(message);
XmStringFree(title);
if (ok != NULL)
XmStringFree(ok);
XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
XtAddCallback(dialog, XmNokCallback, Quit, NULL);
/* closed by the window manager: nothing keeps the process alive */
XtAddCallback(dialog, XmNunmapCallback, Quit, NULL);
XtManageChild(dialog);
XtAppMainLoop(app);
return 0;
}