dosutils: add RIGHTS and finish Novell-style display fixes

- add RIGHTS as a new multi-call DOS utility
- implement Client32 NCP87 effective-rights query helper
- map NCP effective-rights bits to Novell RIGHTS display order
- keep legacy directory-handle based rights lookup as fallback
- match Novell RIGHTS output for directories and files more closely
- remove hardcoded MARS/SYS and SYS display fallbacks from RIGHTS/FLAGDIR
- derive display prefixes from the active network drive where available
- adjust FLAGDIR output formatting to match Novell field alignment
- keep FLAG and SLIST unchanged after checking for hardcoded prefixes
This commit is contained in:
Mario Fetka
2026-05-24 11:20:07 +02:00
parent 456349088e
commit 9ab65e2f00
9 changed files with 682 additions and 13 deletions

View File

@@ -75,6 +75,61 @@ static int fd_current_dhandle(uint8 *dhandle)
return(0);
}
static int fd_current_prefix(char *out, int max)
{
uint8 connid = 0;
uint8 dhandle = 0;
uint8 flags = 0;
int drive;
char server[52];
char path[260];
char volume[32];
char *p;
int i = 0;
if (!out || max < 8)
return(-1);
out[0] = '\0';
drive = fd_get_current_drive();
if (get_drive_info((uint8)drive, &connid, &dhandle, &flags))
return(-1);
if (!connid || (flags & 0x80))
return(-1);
server[0] = '\0';
if (get_fs_name(connid, server))
server[0] = '\0';
path[0] = '\0';
if (get_dir_path(dhandle, path) || !path[0])
return(-1);
p = strchr(path, ':');
if (!p)
return(-1);
while (path + i < p && i < (int)sizeof(volume) - 1) {
volume[i] = path[i];
i++;
}
volume[i] = '\0';
if (!volume[0])
return(-1);
if (server[0])
sprintf(out, "%s/%s:", server, volume);
else
sprintf(out, "%s:", volume);
return(0);
}
static void fd_help(void)
{
fprintf(stdout, "386 Usage: Flagdir [path [option...]]\n");
@@ -118,17 +173,13 @@ static void fd_display(char *path, uint32 attrs)
fd_upcopy(up, path, sizeof(up));
/*
* Novell FLAGDIR style:
*
* MARS/SYS:UDIR
* UDIR System Hidden ...
*
* For now we match the tested MARS/SYS: environment used by PUBLIC/NPUBLIC.
* The NCP logic is independent from this cosmetic header.
*/
fprintf(stdout, "MARS/SYS:%s\n", up);
fprintf(stdout, " %-10s ", up);
{
char prefix[90];
if (fd_current_prefix(prefix, sizeof(prefix)))
prefix[0] = '\0';
fprintf(stdout, "%s%s \n", prefix, up);
}
fprintf(stdout, " %-12.12s ", up);
if (!(attrs & FD_DIR_BITS)) {
fprintf(stdout, "Normal\n");