Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #66728

Re: Useless Use Of Regexes

From Chris Ahlstrom <OFeem1987@teleworm.us>
Newsgroups comp.os.linux.misc
Subject Re: Useless Use Of Regexes
Date 2025-03-29 11:40 -0400
Organization None
Message-ID <vs94a2$1kobq$1@dont-email.me> (permalink)
References (12 earlier) <vs3s5l$f45n$1@news1.tnib.de> <vs4eja$14bph$1@dont-email.me> <vs60ng$2gkd0$1@dont-email.me> <vs6g1e$2vor8$6@dont-email.me> <m4o94mFs1lhU1@mid.individual.net>

Show all headers | View raw


rbowman wrote this post while blinking in Morse code:

> On Fri, 28 Mar 2025 11:42:37 -0400, Chris Ahlstrom wrote:
>
>> The getopt family is a pain in the ass. I wrote my own command-line
>> parsing,
>> though I do not use it in legacy apps.
>
> I've never used getopt_long() but I find getopt() to be cleaner than DIY 
> parsing. 

My parser accepts an array of option structures specifying the long name, the
character code (if any), the type of data represented by the option,
enabling/disabling of options, the default value, the current value,
a dirty flag, and a description.  It generates color-coded help. It has
common built-in options for help and verbosity, for example. And of
course a number of test apps.

Options can be grouped into sections suitable for read/write from an INI-style
file, complete with descriptions of each section.

It's written in C++, but with a C interface also provided.

During my recent wrestling with getopt_long(), I noticed a couple other
features to cover.  

I'm not claiming anyone other than I will ever want to use it :-)

-- 
The departing division general manager met a last time with his young
successor and gave him three envelopes.  "My predecessor did this for me,
and I'll pass the tradition along to you," he said.  "At the first sign
of trouble, open the first envelope.  Any further difficulties, open the
second envelope.  Then, if problems continue, open the third envelope.
Good luck."  The new manager returned to his office and tossed the envelopes
into a drawer.
	Six months later, costs soared and earnings plummeted. Shaken, the
young man opened the first envelope, which said, "Blame it all on me."
	The next day, he held a press conference and did just that.  The
crisis passed.
	Six months later, sales dropped precipitously.  The beleaguered
manager opened the second envelope.  It said, "Reorganize."
	He held another press conference, announcing that the division
would be restructured.  The crisis passed.
	A year later, everything went wrong at once and the manager was
blamed for all of it.  The harried executive closed his office door, sank
into his chair, and opened the third envelope.
	"Prepare three envelopes..." it said.

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-24 20:34 +0000
  Re: Useless Use Of Regexes Pancho <Pancho.Jones@protonmail.com> - 2025-03-24 21:48 +0000
    Re: Useless Use Of Regexes The Natural Philosopher <tnp@invalid.invalid> - 2025-03-24 22:57 +0000
    Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-24 22:59 +0000
      Re: Useless Use Of Regexes Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-03-25 08:30 +0100
        Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-26 00:35 +0000
          Re: Useless Use Of Regexes Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-03-26 08:20 +0100
      Re: Useless Use Of Regexes Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2025-03-25 11:09 +0200
        Re: Useless Use Of Regexes Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-03-25 13:03 +0100
          Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-26 00:42 +0000
            Re: Useless Use Of Regexes Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-03-26 08:21 +0100
              Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-26 19:45 +0000
                Re: Useless Use Of Regexes Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-03-26 21:43 +0100
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-26 23:50 +0000
                Re: Useless Use Of Regexes Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-03-27 07:58 +0100
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-27 07:25 +0000
                Re: Useless Use Of Regexes Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-03-27 16:51 +0100
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-27 21:05 +0000
                Re: Useless Use Of Regexes marrgol <marrgol@address.invalid> - 2025-03-28 12:21 +0100
                Re: Useless Use Of Regexes Chris Ahlstrom <OFeem1987@teleworm.us> - 2025-03-28 11:42 -0400
                Re: Useless Use Of Regexes rbowman <bowman@montana.com> - 2025-03-28 18:46 +0000
                Re: Useless Use Of Regexes Chris Ahlstrom <OFeem1987@teleworm.us> - 2025-03-29 11:40 -0400
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-28 20:25 +0000
                Re: Useless Use Of Regexes Wayne <wayne@nospam.invalid> - 2025-03-31 23:54 -0400
                Re: Useless Use Of Regexes c186282 <c186282@nnada.net> - 2025-03-27 04:08 -0400
          Re: Useless Use Of Regexes c186282 <c186282@nnada.net> - 2025-03-26 00:47 -0400
            Re: Useless Use Of Regexes rbowman <bowman@montana.com> - 2025-03-26 16:51 +0000
              Re: Useless Use Of Regexes c186282 <c186282@nnada.net> - 2025-03-27 03:13 -0400
      Re: Useless Use Of Regexes Pancho <Pancho.Jones@protonmail.com> - 2025-03-25 12:08 +0000
    Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-03-30 14:04 +0000
  Re: Useless Use Of Regexes Ben Collver <bencollver@tilde.pink> - 2025-03-25 15:29 +0000
  Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-03-30 14:02 +0000
    Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-30 21:15 +0000
      Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-03-30 22:04 +0000
        Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-31 01:26 +0000
          Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-04-06 08:40 +0000
            Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-07 21:39 +0000
              Re: Useless Use Of Regexes c186282 <c186282@nnada.net> - 2025-04-07 21:00 -0400
              Re: Useless Use Of Regexes Eli the Bearded <*@eli.users.panix.com> - 2025-04-08 02:05 +0000
                Re: Useless Use Of Regexes c186282 <c186282@nnada.net> - 2025-04-07 22:06 -0400
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-08 05:49 +0000
                Re: Useless Use Of Regexes Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2025-04-08 15:39 +0300
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-09 01:16 +0000
                Re: Useless Use Of Regexes c186282 <c186282@nnada.net> - 2025-04-08 22:32 -0400
                Shell command history (was: Useless Use Of Regexes) Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2025-04-09 13:26 +0100
                Re: Shell command history (was: Useless Use Of Regexes) Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-12 06:55 +0000
                Re: Shell command history (was: Useless Use Of Regexes) Eli the Bearded <*@eli.users.panix.com> - 2025-04-12 23:55 +0000
                Re: Shell command history Nuno Silva <nunojsilva@invalid.invalid> - 2025-04-14 09:47 +0100
                Re: Shell command history Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-14 22:37 +0000
                Re: Shell command history Eli the Bearded <*@eli.users.panix.com> - 2025-04-15 23:28 +0000
                Re: Shell command history Andreas Eder <a_eder_muc@web.de> - 2025-04-16 10:09 +0200
                Re: Shell command history Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-16 21:33 +0000
                Re: Shell command history Eli the Bearded <*@eli.users.panix.com> - 2025-04-18 04:22 +0000
                Re: Shell command history Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-19 22:34 +0000
                Re: Shell command history Eli the Bearded <*@eli.users.panix.com> - 2025-04-20 18:26 +0000
                Re: Shell command history Nuno Silva <nunojsilva@invalid.invalid> - 2025-04-18 10:31 +0100
                Re: Useless Use Of Regexes Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2025-04-09 10:53 +0300
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-12 06:55 +0000
                Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-04-12 13:07 +0000
              Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-04-12 11:23 +0000
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-13 04:54 +0000
                Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-04-13 18:25 +0000
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-14 22:39 +0000
                Re: Useless Use Of Regexes Stéphane CARPENTIER <sc@fiat-linux.fr> - 2025-04-17 19:44 +0000
                Re: Useless Use Of Regexes Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-18 02:18 +0000
                Re: Useless Use Of Regexes candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2025-04-13 19:00 +0000

csiph-web