the suggestion was to:
        pick any ast command that uses optget() or script that uses getopts
"ast command" is key to that suggestion

to get all ast commands download the ast-open package
you can look at the source or you can use the suggested --usage technique

On Mon, 8 Feb 2010 07:39:40 -0800 Eric Peterson wrote:
> No go.  Looks like I may have a version of GNU/Linux that is different enough 
> from AST.  Also, on my MacBookPro I get similar results ('fmt -o' is not 
> available on the Mac). Without the '—usage' command returning anything, then 
> getting a copy of the AST fmt command wouldn't help.

> >uname -a
> Linux xxx.xxx.com 2.6.18-92.1.13.el5 #1 SMP Wed Sep 24 19:33:52 EDT 2008 i686 
> i686 i386 GNU/Linux
> >print ${.sh.version}
> Version M 93s+ 2008-01-31

> >uname -a
> Darwin EricPeterson-MacBook.local 10.2.0 Darwin Kernel Version 10.2.0: Tue 
> Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386
> >print ${.sh.version}
> Version M 1993-12-28 s+

> >ls --usage
> ls: unrecognized option `--usage'
> Try `ls --help' for more information.

> >fmt --usage
> fmt: unrecognized option `--usage'
> Try `fmt --help' for more information.

> >fmt -o
> fmt: invalid option -- o
> Try `fmt --help' for more information.

> >ls --man
> ls: unrecognized option `--man'
> Try `ls --help' for more information.

> >fmt --help
> Usage: fmt [-DIGITS] [OPTION]... [FILE]...
> Reformat each paragraph in the FILE(s), writing to standard output.
> If no FILE or if FILE is `-', read standard input.

> Mandatory arguments to long options are mandatory for short options too.
>   -c, --crown-margin        preserve indentation of first two lines
>   -p, --prefix=STRING       reformat only lines beginning with STRING,
>                               reattaching the prefix to reformatted lines
>   -s, --split-only          split long lines, but do not refill
>   -t, --tagged-paragraph    indentation of first line different from second
>   -u, --uniform-spacing     one space between words, two after sentences
>   -w, --width=WIDTH         maximum line width (default of 75 columns)
>       --help     display this help and exit
>       --version  output version information and exit

> With no FILE, or when FILE is -, read standard input.

> Report bugs to <[email protected]>.

> >ls --version  # similar for fmt --version
> ls (GNU coreutils) 5.97
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software.  You may redistribute copies of it under the terms of
> the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
> There is NO WARRANTY, to the extent permitted by law.

> Written by Richard Stallman and David MacKenzie.

> On 7 Feb 2010, at 21:22 , Glenn Fowler wrote:

> > 
> > pick any ast command that uses optget() or script that uses getopts
> > and this will give the usage string
> > 
> >     ast-command --usage
> > 
> > if you have the ast fmt(1) command (from the ast-open package)
> > then use the -o option to format the usage
> > 
> >     fmt --usage 2>&1 | fmt -o
> > 
> > the ast ls(1) command exercises most of the optget/getopts features
> > 
> >     ls --usage 2>&1 | fmt -o
> > 
> > you can stuff this into a ksh script for testing with getopts
> > 
> >     astcmd=ls
> >     {
> >             print -r $'USAGE=$\''
> >             $astcmd '--??usage' 2>&1 | fmt -o
> >             print $'\n\'\ngetopts -a '$astcmd$' "$USAGE" OPT'
> >     } > test-$astcmd
> >     chmod +x test-$astcmd
> >     test-$astcmd --man
> > 
> > 
> > On Sun, 7 Feb 2010 20:10:44 -0800 Eric Peterson wrote:
> >> Yes, I am use $'?' to quote.  Trying various ways, I get the following.  I 
> >> must be staring at this too much.  I've been trying to search for 
> >> examples, but there aren't many that use this format.  Most getopts 
> >> example use the simpler form getops ":fd:h" and don't mess with the man 
> >> page.  I've been asked to write some apps that I will not be running, so I 
> >> want to give as much help as I can.  
> > 

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to