Exemple #1
0
void
DCirfile::GetElemSets(void)
{
	if (!Section("ElementSets"))
		return;

	char *nm = NULL;
	long len = 0;
	while (NextItem()) {  // this gets higher-priority items first
		if ((nm = StrLeft()) == NULL)
			break;
		if (*nm == '$')
			nm++;
		len = strlen(nm);
		while (nm[len - 1] == ' ')
			nm[--len] = '\0';
		if (!*nm)
			continue;
		if (!ElemSetNames(nm)) {  // don't replace higher-priority ones
			ElemSetNames.add(nm, ++ElemSetNum);
			ElemSets.add(StrArrRight(), ElemSetNum);
		}
	}
}
Exemple #2
0
#ifndef _MICROC_
#include <string.h>
#include <stdlib.h>
#endif
#include <portable.h>
#include "dynstr.h"
#include "eno.loc"

#include "suppldbg.h"

#ifdef RCS_Version
static char const rcsid[] = 
	"$Id: dstrmid.c 1210 2006-06-17 03:25:06Z blairdude $";
#endif

char *StrMiddle(const char * const str, size_t pos, size_t length)
{
	DBG_ENTER("StrMiddle", Suppl_dynstr)

	if(!str) {
		eno_set(EINVAL);
		DBG_RETURN_S(0)
	}

	DBG_ARGUMENTS( ("str=\"%s\", pos=%u, len=%u", str, pos, length) )

	chkHeap
	DBG_RETURN_BS( strlen(str) <= pos? eno_strdup(""): StrLeft(str + pos, length))
}