TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Bob Lawrence
from: Paul Edwards
date: 1996-10-29 08:30:24
subject: Special Requests

BL> That's alright! All you have to do is strip "-- archived --" lines
BL> from FILE.TXT, save the name from that line, and use the name to strip
BL> that entry from files.20. You could even keep a list of the names of
BL> the files you've wiped in a separate file.

Yes, that's right.

BL> Seeing you're so uncreative, I did it for you. Borland reckons it's
BL> ANSI C so you ought to be able to compile it for OS/2. 

NULLZERO.C(3): Error! E1055: Unable to open 'alloc.h'
NULLZERO.C(29): Warning! W102: Type mismatch
NULLZERO.C(53): Error! E1082: Statement required after label
NULLZERO.C(12): Warning! W301: No prototype found for 'clrscr'
NULLZERO.C(29): Warning! W301: No prototype found for 'malloc'
NULLZERO.C(54): Warning! W301: No prototype found for 'free'
Error: Compiler returned a bad status compiling 'NULLZERO.C'


BL> I've erased
BL> your original message, and I can't remember what you did in you BAT
BL> file, so you'll have to rewrite that for yourself.

No probs.  BTW, why don't you get organized with a decent messagebase? You
could even use it in conjunction with your stupid QWK.

BL> nullzero.c takes the full path of FILES.TXT as a command line
BL> parameter and only looks in Special Requests. NULLZERO.EXE goes in the
BL> same directory as FILES.20 and creates the modified file as TEMP.20.
BL> It leaves FILES.TXT as it is, the same as your BAT file.

Fine.

BL> All you have to do is erase your zero-length files, run DOWNSORT
BL> to create FILES.TXT, run  NULLZERO c:\arseup\files.txt and then erase
BL> the old files.20 and rename temp.20 to files.20 in your BAT file.

BL> btw, the EXE is twice the size of the Pascal version and it runs a bit
BL> slower.

The non-Pascal version that did a lot less, you mean?  Or did you write
this new program twice?  And how the hell would you know if it ran slower? 
Did you do a 5000-times trial or what?

Anyway, here's a version that actually compiles, I'll try it out later...

#include 
#include 
#include 

int main(int argc, char *argv[])
{
	FILE *in, *tmp;
	int	i, n;
	char 	line[128], *names[128];

	if(argc != 2) {
		printf("FATAL ERROR!! Include the complete path of FILES.TXT as
parameter");
		return 1;
	}
	if(( in = fopen(argv[1], "rt")) == NULL) {
		fprintf(stderr, "FATAL ERROR!!  Cannot open FILES.TXT\n");
		return 1;
	}
	n = 0;
	while(!feof(in)) {
		fgets(line, 128, in);
		if(strstr(line, "บ Special Requests")) {
			while(1 == 1){
				if(strstr(line, "-- archived --")){
					strtok(line, " ");
					line[16] = '\0';
					names[n] = malloc(16);
					strcpy(names[n], line);
					n++;
				}
				if ((strstr(line, "ออออออออออ")) || (feof(in))) goto loop;
				fgets(line, 128, in);
			}
		}
	}
loop:
	fclose(in);
	if(( in = fopen("files.20", "rt")) == NULL) {
		fprintf(stderr, "FATAL ERROR!! Cannot open FILES.20\n");
		return 1;
	}
	if(( tmp = fopen("temp.20", "wt")) == NULL) {
		fprintf(stderr, "Cannot open temporary fil\n");
		return 1;
	}
	while (!feof(in)){
		fgets(line, 128, in);
		for (i = 0; i < n; i++) if (strstr(line, names[i])) goto skip;
		fputs(line, tmp);
skip: ;
	}
	for (i = 0; i < n; i++) free(names[i]);
	fclose(in); fclose(tmp);
	return 0;
}
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.