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
Index: ┃ T g

⟦c677f2884⟧ TextFile

    Length: 879 (0x36f)
    Types: TextFile
    Names: »getword.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/stat-5.3/eu/stat/src/getword.c« 

TextFile

/*  Copyright 1984 Gary Perlman */

/* LINTLIBRARY */
#include "stat.h"
FUN(getword,read a string from a file,5.0,2/23/85)

/*
	getword (string, ioptr) is equivalent to fscanf (ioptr, "%s", string)
	but much faster.  It returns a NULL pointer on EOF or the end
	of the string when one is found.  The return result can be used
	to find the length of the obtained string.
*/

char *
getword (string, ioptr)
register	char	*string;
register	FILE	*ioptr;
	{
	register	int 	C;
	while ((C = getc (ioptr)) != EOF && isspace (C));
	if (C == EOF) return (NULL);
	do
		{
		*string++ = C;
	} while ((C = getc (ioptr)) != EOF && !isspace (C));
	*string = '\0';
	return (string); /* pointer to the end of string */
	}

#ifdef	STANDALONE

main ()
	{
	char	word[BUFSIZ];
	char	*endword;
	while (endword = getword (word, stdin))
		printf ("%4d	'%s'\n", endword-word, word);
	exit (0);
	}

#endif