/* MPMorph - Amiga Morphing program */
/* Copyright (C) © 1996 Mark John Paddock */

/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* any later version. */

/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
/* GNU General Public License for more details. */

/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */

/* mark@topic.demon.co.uk */

#include "unix.h"

char *ArgString(char **ArgArray,char *check,char *def) {
	char **p;
	p = ArgArray;
	while (**p) {
		if (!strncmp(*p,check,strlen(check))) {
			return (*p)+strlen(check)+1;
		}
		++p;
	}
	return def;
}

extern char **ArgArray;

unsigned char *MyArgString(unsigned char *check,unsigned char *def,int ignore) {
	return ArgString(ArgArray,check,def);
}

extern unsigned long MyArgInt(unsigned char *check,long def,int ignore) {
	char *c;
	c = ArgString(ArgArray,check,NULL);
	if (!c) {
		return (unsigned long)def;
	}
	else {
		return strtoul(c,NULL,10);
	}
}

extern BOOL MatchToolValue(char *a,char *b) {
	if (a) {
		return !strcmp(a,b);
	}
	else {
		return FALSE;
	}
}
