Results 1 to 4 of 4
I made a while loop which exits if the user types 'exit'
But when my shell exit the whole linux become stuck.and there no way lefts behind instead of stoping ...
- 03-08-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 8
problem in while loop of shell and problem in gets(char *s)
I made a while loop which exits if the user types 'exit'
But when my shell exit the whole linux become stuck.and there no way lefts behind instead of stoping and rebooting the linux on VMware.
kindly help me if there is another way of closing the loop and returning to the original positio;
e.g
[MyshellOS]$ exit
it must show that
[root@localDesktop]# what is the proper way??
second problem:
I had used it to get the input from the user to enter commands...
Is there any other way of getting a line from user instead of gets() and readline();
"warning: the 'gets' function is dangerous and should not e used ."
- 03-08-2009 #2Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
Did you write your own implementation of a shell? Iʼm afraid the description of your problemʼs context is too tenuous to expect any assisting answers.
Originally Posted by Rida
Yes, there is:
Originally Posted by Rida
Code:$> man 3 gets […] BUGS Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store char‐ acters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead. […]
- 03-09-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 8
Shell loop problem
Yes I wrote my own shell!!
please if there is any solution do help me!!
- 03-09-2009 #4Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
Originally Posted by Rida I have further questions. I cannot help you unless you answer these questions:
Originally Posted by Rida
- What instructions follow after the user typed “exit”? Could it be that you forgot to handle certain signals or your signal handlers execute an infinite loop?
- Which terminal(-emulator) do you use your shell with?
- Do you implement job control?
- Can you reduce the code in question to a minimum where the error still occurs? This way you could post the code here.
- As for:
Can you elaborate? I donʼt understand what you tried to convey with this sequence of letters.
Originally Posted by Rida


Reply With Quote