Date : Wed, 01 Jun 1988 01:44:50 GMT
From : tektronix!midas!copper!michaelk@ucbvax.Berkeley.EDU (Michael D. Kersenbrock)
Subject: SIMCPM.IDX format converter
NOTE: Yes, this technically is a source listing, but it is REAL short to
be counted as just a "letter".
The file SIMCPM.IDX which has a CP/M filelist (with descriptions) is in a
DBASE-II format of some sort. Having a copy of the file, but NOT having
dbase results in a problem.
The real-short routine below was a 10-minute hack-job that converts that
format into a more-or-less nice readable format suitable for grepping.
Just thought I'd save y'all the ten minutes I spent....:-)
/*
* Filters SIMCPM.IDX into "nice text".
*
* A quickie-hack by: Michael D. Kersenbrock
* Aloha, Oregon
* Version 1.0 5/31/88
*/
#include <stdio.h>
char Line[500],Drive[100],Directory[100], Name[100];
char Description[100],Word2[100],Date[100];
int Version,Size,Type;
main() {
register char *ptr,*p2;
while (gets(Line) != NULL) {
for (ptr = Line ; *ptr != '\0' ; ptr++) {
if (*ptr == '"' || *ptr == ',') *ptr = ' ';
}
sscanf(Line,"%s %s %s %d %d %d %s %s %s",
Drive,Directory,Name,&Version,&Size,&Type,Date,
Description,Word2);
strcat(Description, " ");
strcat(Description, Word2);
for (ptr = Line ; *ptr != '\0' ; ptr++) {
if (strncmp(ptr,Description,strlen(Description)) == 0) {
strcpy(Description,ptr);
break;
}
}
printf("%s%11s %12s %d %3dK ",
Drive,Directory,Name,Version,(Size + 512)/1024);
putchar(Date[2]);
putchar(Date[3]);
putchar('-');
putchar(Date[0]);
putchar(Date[1]);
printf(" %s\n",Description);
}
}
--
Mike Kersenbrock
Tektronix Microcomputer Development Products
Aloha, Oregon
End of INFO-CPM Digest
******************************