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 s

⟦711928e61⟧ TextFile

    Length: 728 (0x2d8)
    Types: TextFile
    Names: »str.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/prep/str.c« 

TextFile

/* A few string functions missing from the Sun unix library */

#include <stdio.h>
#include "string.h"

/* Find the first occurrence of c in string */
char	*strchr( s, c )
char	*s, c ;
{
int	length, i ;
	length = strlen(s) ;

	for ( i=0; i<=length; i++ ) if ( s[i] == c ) return( &s[i] ) ;
	return( NULL ) ;
}

/* find the index of the first char in s1 that is not in s2 */
int	strspn( s1, s2 )
char	*s1, *s2 ;
{
int	i ;

	for ( i=0 ; s1[i] != NULL ; i++ ) {
		if ( NULL == strchr(s2,s1[i]) ) break ;
		}
	return(i) ;
}


/* find the index of the first char in s1 that is in s2 */
int	strcspn( s1, s2 )
char	*s1, *s2 ;
{
int	i ;

	for ( i=0 ; s1[i] != NULL ; i++ ) {
		if ( NULL != strchr(s2,s1[i]) ) break ;
		}
	return(i) ;
}