#322054 Added GNU --long options support (for scripts)

Package:
logcheck
Source:
logcheck
Submitter:
Jari Aalto
Date:
2021-09-22 04:39:29 UTC
Severity:
wishlist
Tags:
#322054#5
Date:
2005-08-08 22:30:04 UTC
From:
To:
Add GNU --long option alternatived as well. They are more readable
in scripts where cryptic "-s" or "-o" can't be remembered after
a month.

#322054#10
Date:
2005-08-17 21:27:02 UTC
From:
To:
well the built in bash getopts can't handle long options.
that's what logcheck uses.
so i guess that bug should be reassigned to bash as wishlist.

#322054#15
Date:
2005-08-18 14:28:22 UTC
From:
To:
| On Tue, 09 Aug 2005, Jari Aalto wrote:
|
| > Add GNU --long option alternatived as well. They are more readable
| > in scripts where cryptic "-s" or "-o" can't be remembered after
| > a month.
|
| well the built in bash getopts can't handle long options.
| that's what logcheck uses.
| so i guess that bug should be reassigned to bash as wishlist.

Would it be possible to switch to use getopt(1) which is pretty
standard in Linux. An example in bash follows.

Jari
------- local retval="/tmp/$0.$FUNCNAME.$$" getopt \ -n $id \ --long checkout,debug:,Debug:,email:,file:,passphrase:,nomore-space,sign:,release:,Prefix:,sign:,test,verbose,Version,no-strip \ --option cDd:e:f:mp:Pr:s:tvVx -- "$@" \ > $retval if [ $? != 0 ] ; then Exit 1 "$id: Cannot read options." fi eval set -- $(< $retval) while true do case $1 in -c|--checkout) OPTION_VC_PACKAGE="yes" # global-def shift 1 ;; -d|--debug) if [[ "$2" != [0-9] ]]; then Exit 1 "-- [FATAL] Debug is not numeric; got [$2]" fi OPTION_DEBUG=$2 # global-def shift 2 ;;
#322054#20
Date:
2005-08-24 18:03:00 UTC
From:
To:
yes it would be possible, we could also parse the args ourself.
thanks for your nice example.
getopts is builtin in bash, getopt is from util-linux.

i'll leave it for now and wait for some 3rd party input.
it's not hight priority, but i agree that it would be nice.

#322054#27
Date:
2008-09-18 15:26:32 UTC
From:
To:
Here is patches that addresses the bug report:

- Add GNU --long options. This is implemented with pure sh.
- The "-v" option is many times understood (cf. "ssh")
  as "--verbose", so this was changed to -V|--version instead.

There were also few EOL whitespaces. The last patch removes
those.Alternatively you might want to run this at top level:

    perl -i.bak -pe 's/[ \t]+$//;' $(find debian src docs -type f)
    find . -name "*.bak" | xargs rm

Jari

#322054#34
Date:
2009-08-16 09:40:21 UTC
From:
To:
Hi,

Could you brief me if these patches in BTS could be integrated to next
logcheck release.

http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=27;filename=0001-Change-code-remove-getopt-to-support-long-option.patch;att=1;bug=322054
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=27;filename=0001-docs-logcheck.sgml-Document-new-long-options.patch;att=2;bug=322054

After testing, they apply without problems to the latest logcheck GIT
repository.

Thanks,
Jari

#322054#43
Date:
2009-08-24 17:52:18 UTC
From:
To:
You're a very patient man, Jari.  :)


I've got some bugs and comments on your patch.  First, the bugs:

- Your second while loop will run endlessly and never exit.

- Most of your options are missing a shift.  Incidentally, try to keep
  the shifts at the end of each case, for consistency.

- logcheck currently does two passes of the arguments list, so that some
  options are handled before the others.  Your patch only does one pass,
  and requires that those options appear first on the command line.


And now the comments:

- Suddenly changing the -v option might not be seen as very nice.
  (Although I doubt there are many scripts out there asking for
  logcheck's version, it's best to play it safe.)  I would suggest
  adding the -V|--version option, but keeping -v for compatibility,
  perhaps deprecated.

- The --server option is inconsistent with the other two similar
  options.  Given the rather long names, I would suggest a --reportlevel
  option that takes 'paranoid', 'server' or 'workstation' as argument.

- I'd prefer --hostname to --host; it makes it clearer that we're not
  connecting to that host or anything.

- --log sounds like an action instead of an option.  How about --logfile
  and --logfiles-list?  (Although --logfile typically means logging *to*
  that file, so I welcome any suggestion.)

- I'm ambivalent on --email-subject-reboot; what about simply --reboot?
  (Maybe logcheck will eventually do more than change the subject on
  reboots, who knows.)

- Good catch on $CONFFILE not existing.  All it needs is a little
  quoting, actually; [ -r "" ] will return false.

- There are many unrelated whitespace changes, which should be kept
  separate.  (I'll take your suggestion and try to apply them
  beforehand.)

- No need to submit two patches; go ahead and fix both the script and
  documentation in one swoop.


Thank you for your work!

#322054#48
Date:
2021-09-22 04:26:56 UTC
From:
To:
Hello,

Good morning,

We have gone through your samples from a partner and Here is our  Order
List. Please do bear in mind that we are very much in  need of this
order, quote your competitive prices.

Kindly send the Order confirmation.

Your early reply will be much appreciated.

Best Regards,

Maryanah Erwin.

PT FINDORA INTERNUSA

Jln Pahlawan 66 Kec. Arjawinangun

45162 CIREBON West-Java INDONESIA

tel : +62 231 357334

fax: +62 231 357260

email: marketing@findora.com