Pete's Log: what was I thinking
Entry #625, (Coding, Hacking, & CS stuff)(posted when I was 22 years old.)
Odd. My io redirection code for my shell is less than ideal. I'm not sure what I was on when I wrote it. Through strategic advances in parser technology (cuz I rock) and by rewriting some of the io redirection code, I've been able to ditch an entire source file (and corresponding header file) from my shell. I like it when I'm efficient.
Just when I thought tcsh loved me and was gonna make my life totally easy, I discovered this: when you do a glob on a command line for a background job, the background job listing will show the command typed in with the glob, not the expanded command. Which means for compatibility, I'll need to store the typed command line as well as the expanded argv array. I guess this actually wasn't an issue until I added glob matching. Oh well. Such is life. Easy fix: add a string to the command structure that holds the command line as it was typed (with some rearranging, a la tcsh) ... and voila, life is good again.
I have an abstract hurdle I still have issues with sometimes. When doing stuff in C with dynamic strings, where I have to manage memory, I feel like I'm being vastly less efficient than if I were using a C++ string, simply because I have to write more code. I always need to remind myself that the C++ string has to do the same memory management I'm doing, I just don't see it. I think that's the only problem I have when doing hacking of this sorts, I always feel like I'm being inefficient, even tho realistically it's hard to be more efficient without wasting tons of storage and/or risking buffer overflows.
My io code rewrite introduced a subtle bug: it forces shell builtins to be executed in child processes. Which is bad for things like setenv. Need to fix that.
This code could definitely benefit from being printed out and perused on paper. And luckily enough, I've got one class tomorrow which is ideal for such a perusal.