// You may freely copy, distribute and reuse the code in this example.
// The author disclaims any warranty of any kind, expressed or implied,
// as to its fitness for any particular use.

// Grab20 and Capture written by Peter Eisch.

#import "other.h"

void parsePath(char *path, char *dir, char *name)
     /* Parse out the name and directory given a path */
{
	char *c1, *c2;
	int dirlen, namelen;

	c1 = strrchr(path, '.');
	c2 = strrchr(path, '/');
	dirlen = (c2) ? c2-path+1 : 0;
	namelen = ((c1) ? c1-path : strlen(path)) -dirlen;
	strncpy(dir,path,dirlen);
	dir[dirlen] = '\0';
	strncpy(name, path+dirlen, namelen);
	name[namelen] = '\0';
}

