sys/vms/*.c - mostly reformatting
I'm not sure whether basic formatting cleanup belongs in 3.6.1, but there are also a couple of strings that got split and require the implicit concatenation of adjacent string literals introduced with C89/C90. The code itself compiles with pre-ANSI compilers, or at least used to--most of it was developed with one.... Much of it is tabs in comments. But there was one substantive item: an obsolete reference to "use 'Q' to Quit" after however many years....
This commit is contained in:
+42
-33
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 vmsfiles.c $NHDT-Date: 1432512790 2015/05/25 00:13:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 vmsfiles.c $NHDT-Date: 1449801740 2015/12/11 02:42:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -208,13 +208,13 @@ const char *d1, *d2;
|
||||
f2.fab$b_fns = strlen(f2.fab$l_fna = (char *) d2);
|
||||
f1.fab$l_nam = (genericptr_t) &n1; /* link nam to fab */
|
||||
f2.fab$l_nam = (genericptr_t) &n2;
|
||||
n1.nam$b_nop = n2.nam$b_nop =
|
||||
NAM$M_NOCONCEAL; /* want true device name */
|
||||
/* want true device name */
|
||||
n1.nam$b_nop = n2.nam$b_nop = NAM$M_NOCONCEAL;
|
||||
|
||||
return (
|
||||
vms_success(sys$parse(&f1)) && vms_success(sys$parse(&f2))
|
||||
return (vms_success(sys$parse(&f1)) && vms_success(sys$parse(&f2))
|
||||
&& n1.nam$t_dvi[0] == n2.nam$t_dvi[0]
|
||||
&& !strncmp(&n1.nam$t_dvi[1], &n2.nam$t_dvi[1], n1.nam$t_dvi[0])
|
||||
&& !strncmp(&n1.nam$t_dvi[1], &n2.nam$t_dvi[1],
|
||||
n1.nam$t_dvi[0])
|
||||
&& !memcmp((genericptr_t) n1.nam$w_did,
|
||||
(genericptr_t) n2.nam$w_did,
|
||||
sizeof n1.nam$w_did)); /*{ short nam$w_did[3]; }*/
|
||||
@@ -251,37 +251,46 @@ int code;
|
||||
{
|
||||
register int trans;
|
||||
|
||||
/* clang-format off */
|
||||
/* *INDENT-OFF* */
|
||||
switch ((code & 0x0FFFFFF8) >> 3) { /* strip upper 4 and bottom 3 bits */
|
||||
CASE2(RMS$_PRV, SS$_NOPRIV) : VALUE(EPERM); /* not owner */
|
||||
CASE2(RMS$_DNF, RMS$_DIR)
|
||||
: CASE2(RMS$_FNF, RMS$_FND)
|
||||
: CASE1(SS$_NOSUCHFILE)
|
||||
: VALUE(ENOENT); /* no such file or directory */
|
||||
CASE2(RMS$_IFI, RMS$_ISI) : VALUE(EIO); /* i/o error */
|
||||
CASE1(RMS$_DEV)
|
||||
: CASE2(SS$_NOSUCHDEV, SS$_DEVNOTMOUNT)
|
||||
: VALUE(ENXIO); /* no such device or address codes */
|
||||
CASE1(RMS$_DME)
|
||||
: /* CASE1(LIB$INSVIRMEM): */
|
||||
CASE2(SS$_VASFULL, SS$_INSFWSL)
|
||||
: VALUE(ENOMEM); /* not enough core */
|
||||
CASE1(SS$_ACCVIO) : VALUE(EFAULT); /* bad address */
|
||||
CASE2(RMS$_DNR, SS$_DEVASSIGN)
|
||||
: CASE2(SS$_DEVALLOC, SS$_DEVALRALLOC)
|
||||
: CASE2(SS$_DEVMOUNT, SS$_DEVACTIVE)
|
||||
: VALUE(EBUSY); /* mount device busy codes to name a few */
|
||||
CASE2(RMS$_FEX, SS$_FILALRACC) : VALUE(EEXIST); /* file exists */
|
||||
CASE2(RMS$_IDR, SS$_BADIRECTORY)
|
||||
: VALUE(ENOTDIR); /* not a directory */
|
||||
CASE1(SS$_NOIOCHAN) : VALUE(EMFILE); /* too many open files */
|
||||
CASE1(RMS$_FUL)
|
||||
: CASE2(SS$_DEVICEFULL, SS$_EXDISKQUOTA)
|
||||
: VALUE(ENOSPC); /* no space left on disk codes */
|
||||
CASE2(RMS$_WLK, SS$_WRITLCK)
|
||||
: VALUE(EROFS); /* read-only file system */
|
||||
CASE2(RMS$_PRV, SS$_NOPRIV):
|
||||
VALUE(EPERM); /* not owner */
|
||||
CASE2(RMS$_DNF, RMS$_DIR):
|
||||
CASE2(RMS$_FNF, RMS$_FND):
|
||||
CASE1(SS$_NOSUCHFILE):
|
||||
VALUE(ENOENT); /* no such file or directory */
|
||||
CASE2(RMS$_IFI, RMS$_ISI):
|
||||
VALUE(EIO); /* i/o error */
|
||||
CASE1(RMS$_DEV):
|
||||
CASE2(SS$_NOSUCHDEV, SS$_DEVNOTMOUNT):
|
||||
VALUE(ENXIO); /* no such device or address codes */
|
||||
CASE1(RMS$_DME):
|
||||
/* CASE1(LIB$INSVIRMEM): */
|
||||
CASE2(SS$_VASFULL, SS$_INSFWSL):
|
||||
VALUE(ENOMEM); /* not enough core */
|
||||
CASE1(SS$_ACCVIO):
|
||||
VALUE(EFAULT); /* bad address */
|
||||
CASE2(RMS$_DNR, SS$_DEVASSIGN):
|
||||
CASE2(SS$_DEVALLOC, SS$_DEVALRALLOC):
|
||||
CASE2(SS$_DEVMOUNT, SS$_DEVACTIVE):
|
||||
VALUE(EBUSY); /* mount device busy codes to name a few */
|
||||
CASE2(RMS$_FEX, SS$_FILALRACC):
|
||||
VALUE(EEXIST); /* file exists */
|
||||
CASE2(RMS$_IDR, SS$_BADIRECTORY):
|
||||
VALUE(ENOTDIR); /* not a directory */
|
||||
CASE1(SS$_NOIOCHAN):
|
||||
VALUE(EMFILE); /* too many open files */
|
||||
CASE1(RMS$_FUL):
|
||||
CASE2(SS$_DEVICEFULL, SS$_EXDISKQUOTA):
|
||||
VALUE(ENOSPC); /* no space left on disk codes */
|
||||
CASE2(RMS$_WLK, SS$_WRITLCK):
|
||||
VALUE(EROFS); /* read-only file system */
|
||||
default:
|
||||
VALUE(EVMSERR);
|
||||
};
|
||||
/* clang-format on */
|
||||
/* *INDENT-ON* */
|
||||
|
||||
errno = trans;
|
||||
vaxc$errno = code;
|
||||
|
||||
+44
-36
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 vmsmail.c $NHDT-Date: 1432512789 2015/05/25 00:13:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 vmsmail.c $NHDT-Date: 1449801741 2015/12/11 02:42:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ */
|
||||
/* Copyright (c) Robert Patrick Rankin, 1991. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -136,8 +136,8 @@ char *buf; /* input: filtered broadcast text */
|
||||
|
||||
if (!strncmpi(buf, "new mail", 8)) {
|
||||
/*
|
||||
New mail [on node FOO] from [SPAM::]BAR [\"personal_name\"]
|
||||
[\(HH:MM:SS\)]
|
||||
* New mail [on node FOO] from [SPAM::]BAR
|
||||
* [\"personal_name\"] [\(HH:MM:SS\)]
|
||||
*/
|
||||
nam = "VMSmail"; /* assume VMSmail */
|
||||
cmd = "MAIL";
|
||||
@@ -147,8 +147,8 @@ char *buf; /* input: filtered broadcast text */
|
||||
} else if (!strncmpi(buf, "new all-in-1", 12)) {
|
||||
int i;
|
||||
/*
|
||||
New ALL-IN-1 MAIL message [on node FOO] from Personal Name
|
||||
\(BAR@SPAM\) [\(DD-MMM-YYYY HH:MM:SS\)]
|
||||
* New ALL-IN-1 MAIL message [on node FOO] from Personal Name
|
||||
* \(BAR@SPAM\) [\(DD-MMM-YYYY HH:MM:SS\)]
|
||||
*/
|
||||
nam = "A1mail";
|
||||
cmd = "A1M";
|
||||
@@ -159,7 +159,7 @@ char *buf; /* input: filtered broadcast text */
|
||||
*--p = '\0';
|
||||
} else if (!strncmpi(buf, "software tools", 14)) {
|
||||
/*
|
||||
Software Tools mail has arrived on FOO from \'BAR\' [in SPAM]
|
||||
* Software Tools mail has arrived on FOO from \'BAR\' [in SPAM]
|
||||
*/
|
||||
nam = "STmail";
|
||||
cmd = "MSG";
|
||||
@@ -167,20 +167,20 @@ char *buf; /* input: filtered broadcast text */
|
||||
cmd = strcat(strcpy(cmd_buf, "MSG +"), p + 4);
|
||||
} else if (q - 2 >= buf && !strncmpi(q - 2, "mm", 2)) {
|
||||
/*
|
||||
{MultiNet\ |PMDF\/}MM mail has arrived on FOO from BAR\n
|
||||
[Subject: subject_text] (PMDF only)
|
||||
* {MultiNet\ |PMDF\/}MM mail has arrived on FOO from BAR\n
|
||||
* [Subject: subject_text] (PMDF only)
|
||||
*/
|
||||
nam = "MMmail"; /* MultiNet's version of MM */
|
||||
cmd = "MM"; /*{ perhaps "MM READ"? }*/
|
||||
} else if (!strncmpi(buf, "wpmail:", 7)) {
|
||||
/*
|
||||
WPmail: New mail from BAR. subject_text
|
||||
* WPmail: New mail from BAR. subject_text
|
||||
*/
|
||||
nam = "WPmail"; /* WordPerfect [sic] Office */
|
||||
cmd = "OFFICE/MAIL";
|
||||
} else if (!strncmpi(buf, "**m400 mail", 7)) {
|
||||
/*
|
||||
**M400 mail waiting**
|
||||
* **M400 mail waiting**
|
||||
*/
|
||||
nam = "M400mail"; /* Messenger 400 [not seen] */
|
||||
cmd = "M400";
|
||||
@@ -193,13 +193,13 @@ char *buf; /* input: filtered broadcast text */
|
||||
|
||||
if (!txt)
|
||||
txt = strcat(strcpy(txt_buf, "Mail for you: "), buf);
|
||||
|
||||
/*
|
||||
: end of mail recognition; now check for call-type
|
||||
interruptions...
|
||||
* end of mail recognition; now check for call-type interruptions...
|
||||
*/
|
||||
} else if ((q = strstri(buf, " phoning")) != 0) {
|
||||
/*
|
||||
BAR is phoning you [on FOO] \(HH:MM:SS\)
|
||||
* BAR is phoning you [on FOO] \(HH:MM:SS\)
|
||||
*/
|
||||
typ = MSG_CALL;
|
||||
nam = "Phone call";
|
||||
@@ -210,9 +210,9 @@ char *buf; /* input: filtered broadcast text */
|
||||
} else if ((q = strstri(buf, " talk-daemon")) != 0
|
||||
|| (q = strstri(buf, " talk_daemon")) != 0) {
|
||||
/*
|
||||
Message from TALK-DAEMON@FOO at HH:MM:SS\n
|
||||
Connection request by BAR@SPAM\n
|
||||
\[Respond with: TALK[/OLD] BAR@SPAM\]
|
||||
* Message from TALK-DAEMON@FOO at HH:MM:SS\n
|
||||
* Connection request by BAR@SPAM\n
|
||||
* \[Respond with: TALK[/OLD] BAR@SPAM\]
|
||||
*/
|
||||
typ = MSG_CALL;
|
||||
nam = "Talk request"; /* MultiNet's TALK and/or TALK/OLD */
|
||||
@@ -239,7 +239,7 @@ char *buf; /* input: filtered broadcast text */
|
||||
} else if (is_jnet_send) { /* sscanf(,"(%[^)])%s -%c",,,)==3 */
|
||||
jnet_send:
|
||||
/*
|
||||
\(SPAM\)BAR - arbitrary_message_text (from BAR@SPAM)
|
||||
* \(SPAM\)BAR - arbitrary_message_text (from BAR@SPAM)
|
||||
*/
|
||||
typ = MSG_CALL;
|
||||
nam = "Bitnet noise"; /* RSCS/NJE message received via JNET */
|
||||
@@ -247,17 +247,19 @@ char *buf; /* input: filtered broadcast text */
|
||||
cmd = cmd_buf;
|
||||
/*{ perhaps just vanilla SEND instead of XYZZY? }*/
|
||||
Sprintf(txt_buf, "Message from %s@%s:%s", user, node,
|
||||
&buf[1 + strlen(node) + 1 + strlen(user) + 2
|
||||
- 1]); /* "(node)user -" */
|
||||
/* "(node)user -" */
|
||||
&buf[1 + strlen(node) + 1 + strlen(user) + 2 - 1]);
|
||||
txt = txt_buf;
|
||||
|
||||
/*
|
||||
: end of call recognition; anything else is none-of-the-above...
|
||||
* end of call recognition; anything else is none-of-the-above...
|
||||
*/
|
||||
} else {
|
||||
other:
|
||||
#endif /* SHELL */
|
||||
/* arbitrary broadcast: batch job completed, system shutdown imminent,
|
||||
* &c */
|
||||
/* arbitrary broadcast: batch job completed, system shutdown
|
||||
* imminent, &c
|
||||
*/
|
||||
typ = MSG_OTHER;
|
||||
nam = (char *) 0; /*"captured broadcast message"*/
|
||||
cmd = (char *) 0;
|
||||
@@ -300,21 +302,22 @@ register char *buf; /* in: original text; out: filtered text */
|
||||
/* filter the text; restrict consecutive spaces or dots to just two */
|
||||
for (p = buf_p = buf; *buf_p; buf_p++) {
|
||||
c = *buf_p & '\177';
|
||||
if (c == ' ' || c == '\t' || c == '\n')
|
||||
if (c == ' ' || c == '\t' || c == '\n') {
|
||||
if (p == buf || /* ignore leading whitespace */
|
||||
(p >= buf + 2 && *(p - 1) == ' ' && *(p - 2) == ' '))
|
||||
continue;
|
||||
else
|
||||
c = ' ';
|
||||
else if (c == '.' || c < ' ' || c == '\177')
|
||||
} else if (c == '.' || c < ' ' || c == '\177') {
|
||||
if (p == buf || /* skip leading beeps & such */
|
||||
(p >= buf + 2 && *(p - 1) == '.' && *(p - 2) == '.'))
|
||||
continue;
|
||||
else
|
||||
c = '.';
|
||||
else if (c == '%' && /* trim %%% OPCOM verbosity %%% */
|
||||
p >= buf + 2 && *(p - 1) == '%' && *(p - 2) == '%')
|
||||
} else if (c == '%' && /* trim %%% OPCOM verbosity %%% */
|
||||
p >= buf + 2 && *(p - 1) == '%' && *(p - 2) == '%') {
|
||||
continue;
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
*p = '\0'; /* terminate, then strip trailing junk */
|
||||
@@ -369,27 +372,26 @@ static void flush_broadcasts() /* called from disable_broadcast_trapping() */
|
||||
}
|
||||
}
|
||||
|
||||
/* AST routine called when the terminal's associated mailbox receives a
|
||||
* message
|
||||
/* AST routine called when terminal's associated mailbox receives a message
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
broadcast_ast(dummy) /* called asynchronously by terminal driver */
|
||||
int dummy; /* not used */
|
||||
int dummy UNUSED;
|
||||
{
|
||||
broadcasts++;
|
||||
}
|
||||
|
||||
/* initialize the broadcast manipulation code; SMG makes this easy
|
||||
*/
|
||||
unsigned long init_broadcast_trapping() /* called by setftty() [once only] */
|
||||
unsigned long
|
||||
init_broadcast_trapping() /* called by setftty() [once only] */
|
||||
{
|
||||
unsigned long sts, preserve_screen_flag = 1;
|
||||
|
||||
/* we need a pasteboard to pass to the broadcast setup/teardown routines
|
||||
*/
|
||||
sts =
|
||||
smg$create_pasteboard(&pasteboard_id, 0, 0, 0, &preserve_screen_flag);
|
||||
/* we need a pasteboard to pass to the broadcast setup/teardown routines */
|
||||
sts = smg$create_pasteboard(&pasteboard_id, 0, 0, 0,
|
||||
&preserve_screen_flag);
|
||||
if (!vms_ok(sts)) {
|
||||
errno = EVMSERR, vaxc$errno = sts;
|
||||
raw_print("");
|
||||
@@ -402,7 +404,8 @@ unsigned long init_broadcast_trapping() /* called by setftty() [once only] */
|
||||
|
||||
/* set up the terminal driver to deliver $brkthru data to a mailbox device
|
||||
*/
|
||||
unsigned long enable_broadcast_trapping() /* called by setftty() */
|
||||
unsigned long
|
||||
enable_broadcast_trapping() /* called by setftty() */
|
||||
{
|
||||
unsigned long sts = 1;
|
||||
|
||||
@@ -423,7 +426,8 @@ unsigned long enable_broadcast_trapping() /* called by setftty() */
|
||||
|
||||
/* return to 'normal'; $brkthru data goes straight to the terminal
|
||||
*/
|
||||
unsigned long disable_broadcast_trapping() /* called by settty() */
|
||||
unsigned long
|
||||
disable_broadcast_trapping() /* called by settty() */
|
||||
{
|
||||
unsigned long sts = 1;
|
||||
|
||||
@@ -436,7 +440,9 @@ unsigned long disable_broadcast_trapping() /* called by settty() */
|
||||
}
|
||||
return sts;
|
||||
}
|
||||
|
||||
#else /* MAIL */
|
||||
|
||||
/* simple stubs for non-mail configuration */
|
||||
unsigned long
|
||||
init_broadcast_trapping()
|
||||
@@ -458,6 +464,7 @@ parse_next_broadcast()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* MAIL */
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -538,6 +545,7 @@ void
|
||||
wait_synch()
|
||||
{
|
||||
char dummy[BUFSIZ];
|
||||
|
||||
printf("\nPress <return> to continue: ");
|
||||
fflush(stdout);
|
||||
(void) gets(dummy);
|
||||
|
||||
+5
-9
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 vmsmain.c $NHDT-Date: 1432512790 2015/05/25 00:13:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.31 $ */
|
||||
/* NetHack 3.6 vmsmain.c $NHDT-Date: 1449801742 2015/12/11 02:42:22 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.32 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
/* main.c - VMS NetHack */
|
||||
@@ -225,7 +225,7 @@ attempt_restore:
|
||||
moveloop(resuming);
|
||||
exit(EXIT_SUCCESS);
|
||||
/*NOTREACHED*/
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -357,8 +357,8 @@ static void
|
||||
whoami()
|
||||
{
|
||||
/*
|
||||
* Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS
|
||||
* 2. Use lowercase of $USER (if 1. fails)
|
||||
* Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS;
|
||||
* 2. Use lowercase of $USER (if 1. fails).
|
||||
* The resulting name is overridden by command line options.
|
||||
* If everything fails, or if the resulting name is some generic
|
||||
* account like "games" then eventually we'll ask him.
|
||||
@@ -416,7 +416,7 @@ genericptr_t sigargs, mechargs; /* [0] is argc, [1..argc] are the real args */
|
||||
program_state.done_hup = TRUE; /* pretend hangup has been attempted */
|
||||
#ifndef BETA
|
||||
if (wizard)
|
||||
#endif /* !BETA */
|
||||
#endif
|
||||
abort(); /* enter the debugger */
|
||||
}
|
||||
return SS$_RESIGNAL;
|
||||
@@ -442,10 +442,6 @@ port_help()
|
||||
}
|
||||
#endif /* PORT_HELP */
|
||||
|
||||
/* for KR1ED config, WIZARD is 0 or 1 and WIZARD_NAME is a string;
|
||||
for usual config, WIZARD is the string and vmsconf.h forces WIZARD_NAME
|
||||
to match it, avoiding need to test which one to use in string ops */
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
|
||||
+17
-8
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 vmstty.c $NHDT-Date: 1432512790 2015/05/25 00:13:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
|
||||
/* NetHack 3.6 vmstty.c $NHDT-Date: 1449801743 2015/12/11 02:42:23 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.17 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
/* tty.c - (VMS) version */
|
||||
@@ -221,7 +221,7 @@ vms_getchar()
|
||||
}
|
||||
} else {
|
||||
/* abnormal input--either SMG didn't initialize properly or
|
||||
vms_getchar() has been called recursively (via SIGINT handler).
|
||||
* vms_getchar() has been called recursively (via SIGINT handler).
|
||||
*/
|
||||
if (kb != 0) /* must have been a recursive call */
|
||||
smg$cancel_input(&kb); /* from an interrupt handler */
|
||||
@@ -265,8 +265,7 @@ Keypad codes are prefixed by 7 bit (\033 O) or 8 bit SS3:
|
||||
Arrows are prefixed by either SS3 or CSI (either 7 or 8 bit), depending on
|
||||
whether the terminal is in application or numeric mode (ditto for PF keys):
|
||||
arrows: <up> <dwn> <lft> <rgt> A B D C
|
||||
Additional function keys (vk201/vk401) generate CSI nn ~ (nn is 1 or 2
|
||||
digits):
|
||||
Additional function keys (vk201/vk401) generate CSI nn ~ (nn is 1 or 2 digits):
|
||||
vk201 keys: F6 F7 F8 F9 F10 F11 F12 F13 F14 Help Do F17 F18 F19 F20
|
||||
'nn' digits: 17 18 19 20 21 23 24 25 26 28 29 31 32 33 34
|
||||
alternate: ^C ^[ ^H ^J (when in VT100 mode)
|
||||
@@ -310,6 +309,7 @@ register int c;
|
||||
if (vms_ok(sts) || sts == SS$_TIMEOUT) {
|
||||
register int cnt = iosb.trm_offset + iosb.trm_siz + inc;
|
||||
register char *p = seq_buf;
|
||||
|
||||
if (c == ESC) /* check for 7-bit vt100/ANSI, or vt52 */
|
||||
if (*p == '[' || *p == 'O')
|
||||
c = META(CTRL(*p++)), cnt--;
|
||||
@@ -317,6 +317,7 @@ register int c;
|
||||
c = SS3; /*CSI*/
|
||||
if (cnt > 0 && (c == SS3 || (c == CSI && strchr(arrow_or_PF, *p)))) {
|
||||
register char *q = strchr(smg_keypad_codes, *p);
|
||||
|
||||
if (q)
|
||||
result = 256 + (q - smg_keypad_codes);
|
||||
p++, --cnt; /* one more char consumed */
|
||||
@@ -334,6 +335,7 @@ register int c;
|
||||
}; /* note: there are several missing nn in CSI nn ~ values */
|
||||
int nn;
|
||||
char *q;
|
||||
|
||||
*(p + cnt) = '\0'; /* terminate string */
|
||||
q = strchr(p, '~');
|
||||
if (q && sscanf(p, "%d~", &nn) == 1) {
|
||||
@@ -373,7 +375,9 @@ setctty()
|
||||
}
|
||||
}
|
||||
|
||||
static void resettty() /* atexit() routine */
|
||||
/* atexit() routine */
|
||||
static void
|
||||
resettty()
|
||||
{
|
||||
if (settty_needed) {
|
||||
bombing = TRUE; /* don't clear screen; preserve traceback info */
|
||||
@@ -451,7 +455,8 @@ const char *s;
|
||||
disable_broadcast_trapping();
|
||||
#if 0 /* let SMG's exit handler do the cleanup (as per doc) */
|
||||
/* #ifndef USE_QIO_INPUT */
|
||||
if (kb) smg$delete_virtual_keyboard(&kb), kb = 0;
|
||||
if (kb)
|
||||
smg$delete_virtual_keyboard(&kb), kb = 0;
|
||||
#endif /* 0 (!USE_QIO_INPUT) */
|
||||
if (ctrl_mask)
|
||||
(void) lib$enable_ctrl(&ctrl_mask, 0);
|
||||
@@ -502,12 +507,16 @@ setftty()
|
||||
settty_needed = TRUE;
|
||||
}
|
||||
|
||||
void intron() /* enable kbd interupts if enabled when game started */
|
||||
/* enable kbd interupts if enabled when game started */
|
||||
void
|
||||
intron()
|
||||
{
|
||||
intr_char = CTRL('C');
|
||||
}
|
||||
|
||||
void introff() /* disable kbd interrupts if required*/
|
||||
/* disable kbd interrupts if required*/
|
||||
void
|
||||
introff()
|
||||
{
|
||||
intr_char = 0;
|
||||
}
|
||||
|
||||
+33
-39
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 vmsunix.c $NHDT-Date: 1432512790 2015/05/25 00:13:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.14 $ */
|
||||
/* NetHack 3.6 vmsunix.c $NHDT-Date: 1449801743 2015/12/11 02:42:23 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.15 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -51,10 +51,10 @@ int fd;
|
||||
struct stat buf;
|
||||
|
||||
if (fstat(fd, &buf))
|
||||
return (0); /* cannot get status */
|
||||
return 0; /* cannot get status */
|
||||
#ifndef INSURANCE
|
||||
if (buf.st_size != sizeof(int))
|
||||
return (0); /* not an xlock file */
|
||||
return 0; /* not an xlock file */
|
||||
#endif
|
||||
(void) time(&date);
|
||||
if (date - buf.st_mtime < 3L * 24L * 60L * 60L) { /* recent */
|
||||
@@ -81,8 +81,8 @@ int fd;
|
||||
}
|
||||
set_levelfile_name(lock, 0);
|
||||
if (delete (lock))
|
||||
return (0); /* cannot remove it */
|
||||
return (1); /* success! */
|
||||
return 0; /* cannot remove it */
|
||||
return 1; /* success! */
|
||||
}
|
||||
|
||||
void
|
||||
@@ -167,7 +167,7 @@ register char *s;
|
||||
int
|
||||
vms_getuid()
|
||||
{
|
||||
return (getgid() << 16) | getuid();
|
||||
return ((getgid() << 16) | getuid());
|
||||
}
|
||||
|
||||
#ifndef FAB$C_STMLF
|
||||
@@ -189,7 +189,7 @@ int fd;
|
||||
#else
|
||||
rfm = buf.st_fab_rfm;
|
||||
#endif
|
||||
return rfm == FAB$C_STMLF;
|
||||
return (boolean) (rfm == FAB$C_STMLF);
|
||||
}
|
||||
|
||||
/*------*/
|
||||
@@ -398,9 +398,9 @@ boolean screen_manip;
|
||||
|
||||
#ifdef SHELL
|
||||
unsigned long dosh_pid = 0, /* this should cover any interactive escape */
|
||||
mail_pid = 0; /* this only covers the last mail or phone; */
|
||||
/*(mail & phone commands aren't expected to leave any process hanging
|
||||
* around)*/
|
||||
mail_pid = 0; /* this only covers the last mail or phone;
|
||||
(mail & phone commands aren't expected to
|
||||
leave any process hanging around) */
|
||||
|
||||
int
|
||||
dosh()
|
||||
@@ -408,20 +408,18 @@ dosh()
|
||||
return vms_doshell("", TRUE); /* call for interactive child process */
|
||||
}
|
||||
|
||||
/* vms_doshell -- called by dosh() and readmail() */
|
||||
|
||||
/* If execstring is not a null string, then it will be executed in a spawned
|
||||
/* vms_doshell -- called by dosh() and readmail()
|
||||
*
|
||||
* If execstring is not a null string, then it will be executed in a spawned
|
||||
* subprocess, which will then return. It is for handling mail or phone
|
||||
* interactive commands, which are only available if both MAIL and SHELL are
|
||||
* #defined, but we don't bother making the support code conditionalized on
|
||||
* MAIL here, just on SHELL being enabled.
|
||||
*
|
||||
* Normally, all output from this interaction will be 'piped' to the user's
|
||||
* screen (SYS$OUTPUT). However, if 'screenoutput' is set to FALSE, output
|
||||
* will be piped into oblivion. Used for silent phone call rejection.
|
||||
*/
|
||||
/* subprocess, which will then return. It is for handling mail or phone */
|
||||
/* interactive commands, which are only available if both MAIL and SHELL are
|
||||
*/
|
||||
/* #defined, but we don't bother making the support code conditionalized on */
|
||||
/* MAIL here, just on SHELL being enabled. */
|
||||
|
||||
/* Normally, all output from this interaction will be 'piped' to the user's */
|
||||
/* screen (SYS$OUTPUT). However, if 'screenoutput' is set to FALSE, output */
|
||||
/* will be piped into oblivion. Used for silent phone call rejection. */
|
||||
|
||||
int
|
||||
vms_doshell(execstring, screenoutput)
|
||||
const char *execstring;
|
||||
@@ -449,9 +447,8 @@ boolean screenoutput;
|
||||
}
|
||||
|
||||
hack_escape(screenoutput,
|
||||
command ? (const char *) 0 : " \"Escaping\" into a "
|
||||
"subprocess; LOGOUT to "
|
||||
"reconnect and resume play. ");
|
||||
command ? (const char *) 0
|
||||
: " \"Escaping\" into a subprocess; LOGOUT to reconnect and resume play. ");
|
||||
|
||||
if (command || !dosh_pid || !vms_ok(status = lib$attach(&dosh_pid))) {
|
||||
#ifdef CHDIR
|
||||
@@ -494,15 +491,15 @@ dosuspend()
|
||||
if (owner_pid == -1) /* need to check for parent */
|
||||
owner_pid = getppid();
|
||||
if (owner_pid == 0) {
|
||||
pline(" No parent process. Use '!' to Spawn, 'S' to Save, or 'Q' "
|
||||
"to Quit. ");
|
||||
pline(
|
||||
" No parent process. Use '!' to Spawn, 'S' to Save, or '#quit' to Quit. ");
|
||||
mark_synch();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* restore normal tty environment & clear screen */
|
||||
hack_escape(1, " Attaching to parent process; use the ATTACH command to "
|
||||
"resume play. ");
|
||||
hack_escape(1,
|
||||
" Attaching to parent process; use the ATTACH command to resume play. ");
|
||||
|
||||
status = lib$attach(&owner_pid); /* connect to parent */
|
||||
|
||||
@@ -543,7 +540,7 @@ char ***array;
|
||||
free((genericptr_t) *array);
|
||||
*array = newarray;
|
||||
}
|
||||
(*array)[indx] = strcpy((char *) alloc(strlen(name) + 1), name);
|
||||
(*array)[indx] = dupstr(name);
|
||||
}
|
||||
|
||||
struct dsc {
|
||||
@@ -551,8 +548,7 @@ struct dsc {
|
||||
char *adr;
|
||||
}; /* descriptor */
|
||||
typedef unsigned long vmscond; /* vms condition value */
|
||||
vmscond FDECL(lib$find_file,
|
||||
(const struct dsc *, struct dsc *, genericptr *));
|
||||
vmscond FDECL(lib$find_file, (const struct dsc *, struct dsc *, genericptr *));
|
||||
vmscond FDECL(lib$find_file_end, (void **));
|
||||
|
||||
/* collect a list of character names from all save files for this player */
|
||||
@@ -605,15 +601,11 @@ int how; /* 1: exit after traceback; 2: stay in debugger */
|
||||
union dbgcmd {
|
||||
struct ascic {
|
||||
unsigned char len; /* 8-bit length prefix */
|
||||
char
|
||||
str[79]; /* could be up to 255, but we don't need that much */
|
||||
char str[79]; /* could be up to 255, but we don't need so much */
|
||||
} cmd_fields;
|
||||
char cmd[1 + 79];
|
||||
};
|
||||
#define DBGCMD(arg) \
|
||||
{ \
|
||||
(unsigned char)(sizeof arg - sizeof ""), arg \
|
||||
}
|
||||
#define DBGCMD(arg) { (unsigned char) (sizeof arg - sizeof ""), arg }
|
||||
static union dbgcmd dbg[3] = {
|
||||
/* prologue for less verbose feedback (when combined with
|
||||
$ define/User_mode dbg$output _NL: ) */
|
||||
@@ -760,6 +752,7 @@ const unsigned char *imghdr;
|
||||
unsigned long trnadr1;
|
||||
|
||||
(void) lib$establish(lib$sig_to_ret); /* set up condition handler */
|
||||
|
||||
/*
|
||||
* Check the first of three transfer addresses to see whether
|
||||
* it is SYS$IMGSTA(). Note that they come from a file,
|
||||
@@ -854,4 +847,5 @@ psect_attr=lib$initialize, Con,Usr,noPic,Rel,Gbl,noShr,noExe,Rd,noWrt,Long
|
||||
*/
|
||||
#endif /* C_LIB$INITIALIZE */
|
||||
/* End of debugger hackery. */
|
||||
|
||||
/*vmsunix.c*/
|
||||
|
||||
Reference in New Issue
Block a user