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:
PatR
2015-12-10 18:42:27 -08:00
parent ef5b37a03a
commit ebdfafb42d
5 changed files with 261 additions and 245 deletions

View File

@@ -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. */
@@ -29,7 +29,7 @@ int FDECL(c__translate, (int));
extern unsigned long sys$parse(), sys$search(), sys$enter(), sys$remove();
extern int VDECL(lib$match_cond, (int, int, ...));
#define vms_success(sts) ((sts) &1) /* odd, */
#define vms_success(sts) ((sts) & 1) /* odd, */
#define vms_failure(sts) (!vms_success(sts)) /* even */
/* vms_link() -- create an additional directory for an existing file */
@@ -208,30 +208,30 @@ 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))
&& 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])
&& !memcmp((genericptr_t) n1.nam$w_did,
(genericptr_t) n2.nam$w_did,
sizeof n1.nam$w_did)); /*{ short nam$w_did[3]; }*/
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])
&& !memcmp((genericptr_t) n1.nam$w_did,
(genericptr_t) n2.nam$w_did,
sizeof n1.nam$w_did)); /*{ short nam$w_did[3]; }*/
}
}
/*
* c__translate -- substitute for VAXCRTL routine C$$TRANSLATE.
*
* Try to convert a VMS status code into its Unix equivalent,
* then set `errno' to that value; use EVMSERR if there's no
* appropriate translation; set `vaxc$errno' to the original
* status code regardless.
* Try to convert a VMS status code into its Unix equivalent,
* then set `errno' to that value; use EVMSERR if there's no
* appropriate translation; set `vaxc$errno' to the original
* status code regardless.
*
* These translations match only a subset of VAXCRTL's lookup
* table, but work even if the severity has been adjusted or
* the inhibit-message bit has been set.
* These translations match only a subset of VAXCRTL's lookup
* table, but work even if the severity has been adjusted or
* the inhibit-message bit has been set.
*/
#include <errno.h>
#include <ssdef.h>
@@ -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;