in reply to Re: Parsing the command line: manual or module?
in thread Parsing the command line: manual or module?

You can pass mutiple arguments via a struct in C in just the same way you use an arg hash in Perl. You can use getopt(3C) in C in just the same way you use Getopt::Long in Perl. Similar techniques exist for other languages.
  • Comment on Re^2: Parsing the command line: manual or module?

Replies are listed 'Best First'.
Re^3: Parsing the command line: manual or module?
by talexb (Chancellor) on Aug 18, 2006 at 03:21 UTC

    Yeah, I know that -- but every time you want to add a parameter you have to modify the struct definition and do a make, so it's not a simple thing to do. I didn't want to confuse the post with that situation.

    In Perl, if you want to add something to an arg hash, the caller and the callee need to be modified; no one else cares, and that's the way it should be.

    I deleted a paragraph from my original post that talked about how I wrote a device independent video graphics module for two graphics cards (heh), CGA (if you can call 640x400 useful) and Hercules (720x348 or something like that -- ok, wikipedia says it was 720x350, close enough). To use these two cards, I would call a subsystem with function pointers for pointers to each of a dozen function pointers functions, when obviously a pointer to a structure containing function pointers would have been way more efficient way to implement that.

    Like I said, it was my first big project. My coding standards have improved immensely since then -- hey, I discovered make back then and thought it was a pretty advanced tool. It was only later that I discovered it had been ported from Unix.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

    Updated Sunday August 20, 2006 at 1222 After re-reading, realized that my purple prose needed a little clarification. Old is struck through, new is in italics.