/
roa/
roa/lib/boards/
roa/lib/config/
roa/lib/edits/
roa/lib/help/
roa/lib/misc/
roa/lib/plrobjs/
roa/lib/quests/
roa/lib/socials/
roa/lib/www/
roa/lib/www/LEDSign/
roa/lib/www/LEDSign/fonts/
roa/lib/www/LEDSign/scripts/
roa/src/s_inc/
roa/src/sclient/
roa/src/sclient/binary/
roa/src/sclient/text/
roa/src/util/
#include <stdio.h>
#include <ctype.h>

#ifdef HAVE_ANSIHEADERS
#  include <stdlib.h>
#  include <string.h>
#else
#  define strchr(str, c) index(str, c)
#endif

#define IN_LIBIDENT_SRC
#include "ident.h"


char *_id_strdup __P1(char *, str)
{
    char *cp;

    cp = (char *) malloc(strlen(str)+1);
    strcpy(cp, str);

    return cp;
}


char *_id_strtok __P3(char *, cp,
		      char *, cs,
		      char *, dc)
{
    static char *bp = 0;
    
    if (cp)
	bp = cp;
    
    /*
    ** No delimitor cs - return whole buffer and point at end
    */
    if (!cs)
    {
	while (*bp)
	    bp++;
	return cs;
    }
    
    /*
    ** Skip leading spaces
    */
    while (isspace(*bp))
	bp++;
    
    /*
    ** No token found?
    */
    if (!*bp)
	return 0;
    
    cp = bp;
    while (*bp && !strchr(cs, *bp))
	bp++;
    
    /*
    ** Remove trailing spaces
    */
    *dc = *bp;
    for (dc = bp-1; dc > cp && isspace(*dc); dc--)
	;
    *++dc = '\0';
    
    bp++;
    
    return cp;
}