Thanks, I'll see what I can find... If anyone comes across a code snippet please let me know!
Type: Posts; User: slevytam
Thanks, I'll see what I can find... If anyone comes across a code snippet please let me know!
Well unfortunately, I have no idea how to do this... Currently, my main method looks like this....
for(;;) {
/* display prompt, read input */
printf("%s%s", getcwd(NULL,64),">");
...
I have tried searching sample code but have not found a script that is smart enough to catch when the background process ends or displays output. I need to be able to catch this in order to reprint...
It seems as though what happens is that I(and my program) doesn't know how to reprint the command line prompt and current buffer to screen when the process finishes. In unix if I had something on...
I've changed the code to look like this:
pid = fork();
if (pid < 0) {
fprintf(stderr, "ERROR: cannot fork!\n");
return(-1);
}
else if (pid) {
...
Im sorry could you explain this a little more.
The way the code is right now it does wait for the function to finish.
ie if I call sleep 10, i won't back to the command prompt for 10 seconds.
...
This is the code I am using currently...
How might it need to be modified?
Thanks,
slevytam
pid = fork();
if (pid < 0) {
Hi,
Currently, I have a shell which uses fork and execvp to execute commands. However, I am wondering how I can implement the ampersand feature of unix. ie program will not wait for process to...
ok thanks, ill take a look!
thanks for your reply.
chdir worked great!
sorry to be a bother but I also need to do a dir function. is there a c function which will produce a directory listing?
thanks,
slevytam
Hello,
Sorry to bother; however, I was wondering if anyone could assist me in code for a change directory function as an internal command.
Pretty much I am coding my own unix shell. I need to...
Thanks!
Hi,
I am starting to do some C coding after a break for a year or two. I have already forgotten a really simple thing.
Can anyone remind me how to get the current directory from unix.
ie. ...