/*
	Z-Prompt
*/

#include <exec/exec.h>
#include <proto/exec.h>
#include <dos/dos.h>
#include <proto/dos.h>

extern struct DosLibrary *DOSBase;

int main (void)
{
	register struct DosLibrary *DOSBase;

	if (DOSBase = OpenLibrary ("dos.library",37))
	{
		char buf[256];
		register BPTR cdlock;
		
		if (cdlock = Lock("",ACCESS_READ))
		{
			if (NameFromLock (cdlock,buf,256))
			{
				register int i=0;

				while (buf[i++]);			/* strlen */
				while ((buf[--i]!='/')
					&& (buf[i]!=':')		/* case check */
					&& (i>=0));
				if (!buf[++i]) i=0;			/* last case check */
				
				/* and now the colorful print.. */
				
				PutStr("\33[0;31;42;>2m[\33[1;31;42;>2m");
				PutStr (&(buf[i]));
				PutStr("\33[0;31;42;>2m]> ");
			}
			else PrintFault(IoErr(),0);
			UnLock(cdlock);
		}
		else PrintFault(IoErr(),0);

		CloseLibrary (DOSBase);
		return 0;
	}
	return 20;
}
