/* Eric Knibbe, David Streng
*  CS 232
*  Project 3
*/

#ifndef PROMPT_CPP
#define PROMPT_CPP

#include "prompt.h"
#include <unistd.h>

// constructor - calls setPrompt to set the initial prompt
Prompt:: Prompt()
{
	setPrompt();
}

// setPrompt - sets the prompt to whatever the current working directory is plus a $
void Prompt:: setPrompt()
{
	int n = 0;
	char cpth[500]; //should be more than enough characters
	getcwd(cpth, 500); //get the cwd into cpth, which has size of 500.
	prmpt = "";
	while (cpth[n])
	{
		prmpt += cpth[n];
		n++;
	}
	prmpt += '$';
}


//returns the prompt
string Prompt:: get()
{
	return prmpt;
}

#endif

