From b3e75eb94c34c42b98bb044c8e56d31663184763 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 2 Dec 2001 17:10:49 +0000 Subject: [PATCH] Updated lines/cols definitions --- ChangeLog | 5 ++++ lib/common.h | 4 +++ lib/mbse.h | 1 - mbfido/mbflist.c | 63 ++++++++++++++++++++++++++++++++++++++---------- mbmon/common.h | 4 +++ 5 files changed, 63 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f7b59ad..6b8e2635 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4343,6 +4343,9 @@ v0.33.19 26-Oct-2001 The tic file import function now sorts and tests on long file- names, with the new mangle function an DOS 8.3 filename is also stored in the file database. + For all files received in tic area, the crc of the tic area + name is stored in the filerecord. This is for the future + rescan option. mbfile: During check the file databases are reset to filemode 0660. @@ -4364,6 +4367,8 @@ v0.33.19 26-Oct-2001 The mbfile check function now converts the short filenames to DOS 8.3 filenames. (The first time this logs lots of errors). + The mbfile list function now gives a listing of the contents + of a file area if the area number is given as argument. mball: The index function is now obsolete, this is added to mbfile. diff --git a/lib/common.h b/lib/common.h index 687b27be..c49412f5 100644 --- a/lib/common.h +++ b/lib/common.h @@ -151,8 +151,12 @@ #define KEY_PGDN 209 +#ifndef LINES #define LINES 24 +#endif +#ifndef COLS #define COLS 80 +#endif /* diff --git a/lib/mbse.h b/lib/mbse.h index ef0ffaf5..d209de64 100644 --- a/lib/mbse.h +++ b/lib/mbse.h @@ -31,7 +31,6 @@ #ifndef _MBSE_H #define _MBSE_H -#define LINES 24 /* Lines for MoreFile */ #define LANG 500 /* Amount of Language Entries */ diff --git a/mbfido/mbflist.c b/mbfido/mbflist.c index b7dc07db..dce8dc27 100644 --- a/mbfido/mbflist.c +++ b/mbfido/mbflist.c @@ -44,11 +44,11 @@ extern int do_quiet; /* Supress screen output */ void ListFileAreas(int Area) { - FILE *pAreas, *pFile; + FILE *pAreas, *pFile, *pTic; int i, iAreas, fcount, tcount = 0; int iTotal = 0; long fsize, tsize = 0; - char *sAreas, *fAreas, flags[6]; + char *sAreas, *fAreas, *sTic, flags[6], *ticarea; /* * If nothing to display allowed, return at once. @@ -57,11 +57,12 @@ void ListFileAreas(int Area) return; colour(LIGHTRED, BLACK); - sAreas = calloc(PATH_MAX, sizeof(char)); - fAreas = calloc(PATH_MAX, sizeof(char)); + sAreas = calloc(PATH_MAX, sizeof(char)); + fAreas = calloc(PATH_MAX, sizeof(char)); + sTic = calloc(PATH_MAX, sizeof(char)); + ticarea = calloc(21, sizeof(char)); sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT")); - if ((pAreas = fopen (sAreas, "r")) == NULL) { WriteError("Can't open %s", sAreas); printf("Can't open %s\n", sAreas); @@ -71,10 +72,18 @@ void ListFileAreas(int Area) fread(&areahdr, sizeof(areahdr), 1, pAreas); fseek(pAreas, 0, SEEK_END); iAreas = (ftell(pAreas) - areahdr.hdrsize) / areahdr.recsize; - + if (Area) { IsDoing("List area %d", Area); + sprintf(sTic, "%s/etc/tic.data", getenv("MBSE_ROOT")); + if ((pTic = fopen(sTic, "r")) == NULL) { + WriteError("Can't open %s", sTic); + printf("Can't open %s\n", sTic); + die(0); + } + fread(&tichdr, sizeof(tichdr), 1, pTic); + if (fseek(pAreas, ((Area - 1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET)) { WriteError("$Can't seek area %d", Area); printf("Can't seek area %d\n", Area); @@ -104,8 +113,12 @@ void ListFileAreas(int Area) fsize = 0L; colour(CYAN, BLACK); printf("File listing of area %d, %s\n\n", Area, area.Name); - printf("File name Kbytes File date Dnlds Flags Description\n"); - printf("------------ ------ ---------- ----- ----- ------------------------------------\n"); + printf("Short name Kb. File date Down Flags TIC Area Long name\n"); + printf("------------ ----- ---------- ---- ----- -------------------- "); + for (i = 63; i < COLS; i++) + printf("-"); + printf("\n"); + colour(LIGHTGRAY, BLACK); while (fread(&file, sizeof(file), 1, pFile) == 1) { @@ -121,18 +134,37 @@ void ListFileAreas(int Area) if (file.Announced) flags[4] = 'A'; - if (strlen(file.Desc[0]) > 36) - file.Desc[0][36] = '\0'; - printf("%-12s %6ld %s %5ld %s %s\n", + if (file.TicAreaCRC) { + /* + * Fill the default answer + */ + sprintf(ticarea, "Not found"); + fseek(pTic, tichdr.hdrsize, SEEK_SET); + while (fread(&tic, tichdr.recsize, 1, pTic)) { + if (StringCRC32(tic.Name) == file.TicAreaCRC) { + sprintf(ticarea, "%s", tic.Name); + break; + } + fseek(pTic, tichdr.syssize, SEEK_CUR); + } + } else { + sprintf(ticarea, "N/A"); + } + + file.LName[COLS - 63] = '\0'; + printf("%-12s %5ld %s %4ld %s %-20s %s\n", file.Name, (long)(file.Size / 1024), StrDateDMY(file.FileDate), - (long)(file.TimesDL + file.TimesFTP + file.TimesReq), flags, file.Desc[0]); + (long)(file.TimesDL + file.TimesFTP + file.TimesReq), flags, ticarea, file.LName); fcount++; fsize = fsize + file.Size; } fsize = fsize / 1024; colour(CYAN, BLACK); - printf("-------------------------------------------------------------------------------\n"); + printf("--------------------------------------------------------------"); + for (i = 63; i < COLS; i++) + printf("-"); + printf("\n"); printf("%d file%s, %ld Kbytes\n", fcount, (fcount == 1) ? "":"s", fsize); } else { @@ -141,8 +173,11 @@ void ListFileAreas(int Area) return; } + fclose(pTic); + free(ticarea); free(sAreas); free(fAreas); + free(sTic); return; } @@ -189,7 +224,9 @@ void ListFileAreas(int Area) printf("----- ----- ----- ---------------------------------------------------------\n"); printf("%5d %5d %5ld \n", iTotal, tcount, tsize); fclose(pAreas); + free(ticarea); free(sAreas); free(fAreas); + free(sTic); } diff --git a/mbmon/common.h b/mbmon/common.h index 204ca9e6..7e2985b0 100644 --- a/mbmon/common.h +++ b/mbmon/common.h @@ -28,8 +28,12 @@ #define KEY_PGDN 209 +#ifndef LINES #define LINES 24 +#endif +#ifndef COLS #define COLS 80 +#endif /*