1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-05-02 14:40:45 +00:00

Replaces shadowed "-t <interval>" with "-timer <interval>"

At some point option "-t" was introduced as an abbreviation for
"-title" but "-t" was already in use, though undocumented, for overriding
the timer interval.  This commit changes the command line timer option
to "-timer" and adds "timer" to the options that are processed from
the X11 resources.
This commit is contained in:
Nick Briggs
2024-12-16 19:59:03 -08:00
parent b13a35e16e
commit 66721ccc1c
2 changed files with 13 additions and 4 deletions

View File

@@ -407,20 +407,20 @@ int main(int argc, char *argv[])
} }
} }
/* -t and -m are undocumented and somewhat dangerous... */ /* -timer and -m are undocumented and somewhat dangerous... */
else if (!strcmp(argv[i], "-t")) { /**** timer interval ****/ else if (!strcmp(argv[i], "-timer")) { /**** timer interval ****/
if (argc > ++i) { if (argc > ++i) {
errno = 0; errno = 0;
tmpint = strtol(argv[i], (char **)NULL, 10); tmpint = strtol(argv[i], (char **)NULL, 10);
if (errno == 0 && tmpint > 0) { if (errno == 0 && tmpint > 0) {
TIMER_INTERVAL = tmpint; TIMER_INTERVAL = tmpint;
} else { } else {
(void)fprintf(stderr, "Bad value for -t (integer > 0)\n"); (void)fprintf(stderr, "Bad value for -timer (integer > 0)\n");
exit(1); exit(1);
} }
} else { } else {
(void)fprintf(stderr, "Missing argument after -t\n"); (void)fprintf(stderr, "Missing argument after -timer\n");
exit(1); exit(1);
} }
} }

View File

@@ -36,6 +36,7 @@ extern int LispDisplayRequestedX, LispDisplayRequestedY;
extern unsigned LispDisplayRequestedWidth, LispDisplayRequestedHeight; extern unsigned LispDisplayRequestedWidth, LispDisplayRequestedHeight;
extern int xsync; extern int xsync;
extern int TIMER_INTERVAL;
static XrmOptionDescRec opTable[] = { static XrmOptionDescRec opTable[] = {
{"-help", "*help", XrmoptionIsArg, (XPointer)NULL}, {"-help", "*help", XrmoptionIsArg, (XPointer)NULL},
@@ -297,6 +298,14 @@ void read_Xoption(int *argc, char *argv[])
noscroll = 1; noscroll = 1;
} }
if (XrmGetResource(rDB, "ldex.timer", "Ldex.timer", str_type, &value) == True) {
(void)strncpy(tmp, value.addr, value.size);
errno = 0;
i = (int)strtol(tmp, (char **)NULL, 10);
if (errno == 0 && i > 0)
TIMER_INTERVAL = i;
}
/* if (XrmGetResource(rDB, /* if (XrmGetResource(rDB,
"ldex.maxpages", "ldex.maxpages",
"Ldex.maxpages", "Ldex.maxpages",