[Info-vax] Unix and DCL shells
Arne Vajhøj
arne at vajhoej.dk
Tue Jan 9 19:35:37 EST 2024
On 1/9/2024 2:32 PM, Simon Clubley wrote:
> On 2024-01-08, Lawrence D'Oliveiro <ldo at nz.invalid> wrote:
>> I don?t feel the need for CTRL/T simply because I have something like a
>> dozen or two dozen terminal sessions open at any one time, and it is easy
>> enough to check up on a hung-looking process from another session. I can
>> even rummage around in procfs to check the status of open files and memory
>> usage in the problem process, which is way more than you can do with CTRL/
>> T anyway.
>
> Programs can intercept Ctrl-T and output program-specific information.
Yes - it is a choice whether to use DCL default or a program
specific handler.
$ type some1.c
#include <stdio.h>
int main(int argc, char *argv[])
{
puts("Press enter to exit");
getchar();
return 0;
}
$ cc some1
$ link some1
$ r some1
Press enter to exit
ARNE4::ARNE 20:31:33 some1 CPU=00:00:12.63 PF=95154 IO=13861 MEM=330
ARNE4::ARNE 20:31:33 some1 CPU=00:00:12.63 PF=95155 IO=13862 MEM=331
ARNE4::ARNE 20:31:34 some1 CPU=00:00:12.63 PF=95155 IO=13863 MEM=331
$ type some2.c
#include <stdio.h>
#include <descrip.h>
#include <iodef.h>
#include <libclidef.h>
#include <lib$routines.h>
#include <starlet.h>
static int n = 0;
void catcher(int c)
{
n++;
printf("You pressed CTRL/T %d times\n", n);
}
int main(int argc, char *argv[])
{
long newmask, oldmask, oobmask;
$DESCRIPTOR(ttdesc, "TT:");
short chan;
newmask = LIB$M_CLI_CTRLT;
lib$disable_ctrl(&newmask, &oldmask);
sys$assign(&ttdesc, &chan, 0, 0);
oobmask = 1 << ('T' - 'A');
sys$qiow(0, chan, IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, catcher,
&oobmask, 0, 0, 0, 0);
puts("Press enter to exit");
getchar();
lib$enable_ctrl(&oldmask);
sys$dassgn(chan);
return 0;
}
$ cc some2
$ link some2
$ r some2
Press enter to exit
You pressed CTRL/T 1 times
You pressed CTRL/T 2 times
You pressed CTRL/T 3 times
Arne
PS: And note that I managed to get something strongly VMS
related into the post!
More information about the Info-vax
mailing list