So, I am back in that place where I don’t know what to do. I have a good list going, though, of what is NOT helpful:
- Browsing unrelated topics on Stack Overflow
- Looking up origins of “free as in beer“
- Browsing career advice on New York Times
- Signing up for a dance class
- Checking out Patrick Rothfuss’s blog
So, what might be helpful?
- Open the source code
- Find the bug list
- Try to repro the bug
- Make a new to-do list
- Make some tea
OK, tea is pri 1.
>>>
Sweet! Now I’ve done everything on both lists, except make a new to-do list. So:
- Try to find where “search” is written and called
- Try to step through code… using my IDE that does not step through code. This may be the first time in my life I’ve used this expression, but: d’oh.
Finding the spot where “search” is called…
>>>
Um… O Gods. What?
>>>
No, seriously… what?!
>>>
Holy mother of God… I feel really, really dumb.
>>>
So! “The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters,” says you. And you claim that “The variable optind is the index of the next element to be processed in argv.” And you go so far as imply–no, state quite baldly–that “[t]here are at least two arguments to main
: argc
and argv
. The first of these is a count of the arguments supplied to the program and the second is an array of pointers to the strings which are those arguments.”
I had never actually seen argc and argv used! I thought they were just window dressing.
So! We are checking to see whether the string passed in equals some other string, even if we pass in many many things as arguments. We check one at a time.
>>>
Yes, but that doesn’t explain why all these people on the ‘tubes are running around saying:
if(!strcasecmp(doWhatVar, “Do This Thing”)
{
doThisThing();
}
That seems like… the opposite of what it should do.
Is 0 the same as not something? Oh god. How could I be so ignorant?
>>>
This is the part where I remind myself that I am still learning, don’t expect myself to know everything, etc., etc., etc. And maybe pour myself some beer. Because if I’m going to be ashamed and irrationally afraid that I’ll never get a job, I might as well do it with a tasty beverage.
>>>
Why are there slashes everywhere? Do I know this language at all?
>>>
Oh… slashes are line continuations inside a giant macro. Haven’t used macros before. That explains a lot!
>>>
Now there’s the part where I wonder if the answer is to soldier on and Get Back On The Penguin, as it were, or take a break and come back all fresh-faced and dewy. If it weren’t 11 o’clock at night, I’d go for a run. Maybe instead I’ll do some pushups. And ask my ever-patient roommate for help. And then maybe… maybe sleep.