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.
| 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 ;;
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.
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
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
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!
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