DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦6aa9a9ae5⟧ TextFile

    Length: 351 (0x15f)
    Types: TextFile
    Names: »safegets.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/news/misc/search/lib/safegets.c« 

TextFile

/* Call fgets but also truncate long line. */

#include "defs.h"

char *
safegets(buf, size, fp)
	char *buf;
	int size;
	register FILE *fp;
{
	register char *q;
	register char *p= fgets(buf, size, fp);
	register int c;
	
	if (p != NULL) {
		q= p+strlen(p);
		if (q[-1] != '\n') {
			while ((c= getc(fp)) != '\n' && c != EOF)
				;
		}
	}
	return p;
}