![]() |
| | #1 |
| Registered User Join Date: Apr 2002
Posts: 4
| builtin command The only bit i'm confused about is the builtin command - can anyone explain it to me? This is what I've found on the web site - and I don't understand it :-( builtin() { if (check("exit")) exit (0); else if (check("cd")) return do_cd(); else if (check("history")) return do_history(); else if (check("!")) return do_repeat_connand(); else return 0; } The do_cd() function can then extract a directory name from the line[] array and use the chdir() system call to make the change. For the ! and history commands, you need to modify the getline() function so that lines entered at the keyboard are stored as they are entered. The history command can then list all the commands in the store and the command can copy the appropriate stored command back into the line[] array. do_repeat_command() can then return a zero from builtin() so that line[] will be parsed as normal. Do I need to specify the path of my program in the def.h??? How do I carry out my own script within the builtin command?!!! Thanks in advanced. J |
| jon21 is offline | |
| | #2 |
| Registered User Join Date: Mar 2002
Posts: 87
| In the forkexec function you should see the following code. Code: execvp(ptr->av[0],ptr->av); exit(1); Code: execv("cd.exe",ptr->av);
exit(1);
__________________ PuterPaul.co.uk - Portfolio site |
| pdstatha is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to sort a simple linked list using swap-sort method | JOCAAN | C Programming | 24 | 08-07-2009 11:48 AM |
| problem with "touch" command in c program | Moony | C Programming | 10 | 08-01-2006 09:56 AM |
| Batch file programming | year2038bug | Tech Board | 10 | 09-05-2005 03:30 PM |
| Ping problem | bladerunner627 | C++ Programming | 12 | 02-02-2005 12:54 PM |
| exe files in -c- language | enjoy | C Programming | 6 | 05-18-2004 04:36 PM |