I guess I can't disappoint my lorde, so I'll have to keep writing updates when I get the chance. My brain could use some rest after the last 2 hours I spent crafting some marvel of ancient computer science.
A few things. gets() is dangerous. Don't use it. Sure, I won't tell you what to do instead of gets(), but I will tell you that its dangerous. Oh yeah, and you aren't supposed to know why its dangerous, either.
Now that the compiler mentality is out of the way, I'll explain. I was compiling locally on my Linux box, and after about 1 hour of trying to get a parser working with scanf (stupid me, because scanf is for formatted input) I decided to give up and use gets(), which was much simpler. I then come accross a strange error.
bash-2.05a# gcc -o prog source.c /tmp/ccOBYqXI.o:
In function `parse':
/tmp/ccOBYqXI.o(.text+0x16f): the `gets' function is dangerous and should not be used.
Odd, to the layman (which I myself am), so I continue and to my surprise, my program works. Great. Now, to get rid of that linker warning. I search online as to why the gets function is dangerous, and find out just why I'm using gets in just about the worst possible position.
gets() doesn't really care about the bounds of the character you are throwing the input into, and if your input goes over it, it starts writing to the code stack (or something like that). Basically, it is the reason for the C buffer overflow security problem is that people use gets() and don't listen to the linker warning. what morons..
Instead, use fgets() on the stdin stream, and use sscanf with a ^\n to get rid of the \n on your output. Voila, you are secure from the gets() thing. I guess. Anyway, now that my parser is done I need to go code the disk ADT. What a neat assignment; coding your own filesystem and what seems to be a very rudimentary shell-like operating system. 13 days left to do it, hopefully I'll survive. I've started early enough though, and already have made quite a bit of progress. I'll write something funny later maybe. I guess I'm a big liar. JING(DJ) out.