|
JA3PYC > MSYS 24.04.95 05:01l 102 Lines 2349 Bytes #-11102 (0) @ WW
BID : 2160_JA3PYC
Read: F1SMF GUEST
Subj: Delete Old BIDs
Path: DB0AAB<DB0LNA<DB0RGB<DB0ABH<DB0SRS<DB0MW<DB0AIS<DB0HOM<DB0GE<LX0PAC<
F6KAT<F6KIF<F6PTT<F5MSQ<SV1GH<SV1SV<SV1IW<LY1BZB<UA6CL<RK9CWW<UA0SNV<
BV3AD<JA3PYC
Sent: 950416/1239Z 2160@JA3PYC.25.JNET3.JPN.AS
It has been my desire for long time if MSYS can be operated automatically.
But there was a big difficulty to overcome. I have to once stop the MSYS
and then delete old BIDs manually using MUTIL 21.
I made a program for automatic cleaning BID-SLOT of MSYS and the
following are sample files for such automatic operation and C-programs.
I have compiled these C-programs by Turbo C.
AUTOEXEC.BAT
EXPBID 10 --> keep 10days BIDs.
MSYS
REBOOT
MSYSTODO.DAT
????0400 SHUT ON
????0405 QUIT
EXPBID.C
#include <stdio.h>
#include <process.h>
#include <time.h>
/* Each slot has the following definition: */
struct biddef {
unsigned int n; /* message number */
char type; /* messegae type */
char status; /* message status */
time_t t; /* time stamp secs */
char bid[16];
};
void main(int argc, char *argv[])
{
FILE *bid_fp;
char bid_name[32];
long n;
struct biddef slot;
time_t now_time;
time_t diff;
long del, kept;
strcpy(bid_name, "BIDLIST.DAT");
time(&now_time);
if (argc == 2) {
diff = atol(argv[1]);
}
else {
diff = 5L;
}
/* h m s */
diff *= (24L * 60L * 60L);
if ((bid_fp = fopen(bid_name,"rb+")) == NULL) {
printf("\nCan't open: %s", bid_name);
exit(1);
}
n = 0L;
del = kept = 0L;
while (fseek(bid_fp, (long)n * sizeof(slot), 0) == 0) {
if (fread(&slot, sizeof(slot), 1, bid_fp) < 1)
break;
/*
printf("Slot %lu:", n);
printf(" %u %c%c %s %s", slot.n, slot.type, slot.status,
&slot.bid[0], ctime(&slot.t));
*/
if (slot.n != 0) {
if (slot.t < (now_time - diff)) {
fseek(bid_fp, (long)n * sizeof(slot), 0);
memset(&slot, 0, sizeof(slot));
fwrite(&slot, sizeof(slot), 1, bid_fp);
++del;
}
else {
++kept;
}
}
++n;
}
fclose(bid_fp);
printf("Slot: %lu Deleted: %lu Kept: %lu", n, del, kept);
exit(0);
}
REBOOT.C
#include <stdio.h>
#include <dos.h>
void main(void)
{
outportb(0x64, 0xfe);
}
Any comments/suggestions are welcome.
Best 73 de yamamoto JA3PYC@JA3PYC.25.JNET3.JPN.AS
E-MAIL: yamamoto@furuno.co.jp
Read previous mail | Read next mail
| |