


     getopt(XPG4.os/genuRelease	4.4.4 (UniSoft Lgetopt(XPG4.os/genuts)



     NAME
	  XPG4.os/genuts/getopt	- command option parsing testset

     DESCRIPTION
	  Getopt tests the getopt() subroutine interface for
	  conformance to the XSI System	Interfaces Page:getopt()

     TESTS
     Compliance
	  1    When the	variable opterr	is not set to zero and a call
	       to getopt() is made with	optind and the arguments argc,
	       argv, and the option string optstring as	per the	table
	       below, then getopt() outputs the	corresponding
	       information, if any, to standard	error and returns the
	       value and sets the variables optind, optarg, and	optopt
	       as specified in the corresponding columns of the	table.

	       optstring Set of		 optind	 optarg	  Return stderr	    optopt
			 Arguments	 In  Out
	       ''	 --fred		 1   2	 Unset	  -1	 No O/P	    Unset
	       ''	 -a fred	 1   2	 Unset	  ?	 Diagnostic a
	       ''	 -a fred	 2   2	 Unset	  -1	 No O/P	    Unset
	       :	 --fred		 1   2	 Unset	  -1	 No O/P	    Unset
	       :	 -a fred	 1   2	 Unset	  ?	 No O/P	    a
	       :	 -a fred	 2   2	 Unset	  -1	 No O/P	    Unset
	       abcd	 -a -c fred	 1   2	 Unset	  a	 No O/P	    Unset
	       abcd	 -a -c fred	 2   3	 Unset	  c	 No O/P	    Unset
	       abcd	 -a -c fred	 3   3	 Unset	  -1	 No O/P	    Unset
	       abcd	 -ac fred	 1   1	 Unset	  a	 No O/P	    Unset
	       abcd	 -ac fred	 N/C 2	 Unset	  c	 No O/P	    Unset
	       abcd	 -ac fred	 2   2	 Unset	  -1	 No O/P	    Unset
	       abcd	 -z fred	 1   2	 Unset	  ?	 Diagnostic z
	       abcd	 -a -- -b	 1   2	 Unset	  a	 No O/P	    Unset
	       abcd	 -a -- -b	 2   3	 Unset	  -1	 No O/P	    Unset
	       abcd	 -a -c fred	 1   2	 Unset	  a	 No O/P	    Unset
	       abcd	 -a -c fred	 2   3	 Unset	  c	 No O/P	    Unset
	       abcd	 -a -c fred	 3   3	 Unset	  -1	 No O/P	    Unset
	       :abcd	 -z fred	 1   2	 Unset	  ?	 No O/P	    z
	       ab:cd:e	 -a -d opt fred	 1   2	 Unset	  a	 No O/P	    Unset
	       ab:cd:e	 -a -d opt fred	 2   4	 opt	  d	 No O/P	    Unset
	       ab:cd:e	 -a -d opt	 2   4	 opt	  d	 No O/P	    Unset
	       ab:cd:e	 -a -dopt fred	 2   3	 opt	  d	 No O/P	    Unset
	       ab:cd:e	 -a -dopt	 2   3	 opt	  d	 No O/P	    Unset
	       ab:cd:e	 -a -d opt fred	 4   4	 Unset	  -1	 No O/P	    Unset
	       ab:cd:e	 -a -d		 2   3	 Unset	  ?	 Diagnostic d
	       ab:cd:e	 -d -a fred	 1   3	 -a	  d	 No O/P	    Unset
	       ab:cd:e	 -d-a fred	 1   2	 -a	  d	 No O/P	    Unset
	       ab:cd:e	 -a opt	-d opt2	 1   2	 Unset	  a	 No O/P	    Unset
	       ab:cd:e	 -a opt	-d opt2	 2   2	 Unset	  -1	 No O/P	    Unset
	       ab:cd:e	 -abd fred	 1   1	 Unset	  a	 No O/P	    Unset
	       ab:cd:e	 -abd fred	 N/C 2	 d	  b	 No O/P	    Unset
	       ab:cd:e	 -abd		 1   1	 Unset	  a	 No O/P	    Unset



     Page 1					    (printed 2/21/103)






     getopt(XPG4.os/genuRelease	4.4.4 (UniSoft Lgetopt(XPG4.os/genuts)



	       ab:cd:e	 -abd		 N/C 2	 d	  b	 No O/P	    Unset
	       ab:cd:e	 -ab opt fred	 1   1	 Unset	  a	 No O/P	    Unset
	       ab:cd:e	 -ab opt fred	 N/C 3	 opt	  b	 No O/P	    Unset
	       ab:cd:e	 -ab opt	 1   1	 Unset	  a	 No O/P	    Unset
	       ab:cd:e	 -ab opt	 N/C 3	 opt	  b	 No O/P	    Unset
	       ab:cd:e	 -ab		 1   1	 Unset	  a	 No O/P	    Unset
	       ab:cd:e	 -ab		 N/C 2	 Unset	  ?	 Diagnostic b
	       ab:cd:e	 -b opt	-- fred	 1   3	 opt	  b	 No O/P	    Unset
	       ab:cd:e	 -b opt	-- fred	 3   4	 Unset	  -1	 No O/P	    Unset
	       ab:cd:e	 -b -- -c fred	 1   3	 --	  b	 No O/P	    Unset
	       ab:cd:e	 -b -- -c fred	 3   4	 Unset	  c	 No O/P	    Unset
	       ab:cd:e	 -b '' -c fred	 1   3	 Null	  b	 No O/P	    Unset
	       ab:cd:e	 -b '' -c fred	 3   4	 Unset	  c	 No O/P	    Unset
	       ab:cd:e	 -b 'o1	o2' fred 1   3	 o1 o2	  b	 No O/P	    Unset
	       ab:cd:e	 '-bo1 o2' fred	 1   2	 o1 o2	  b	 No O/P	    Unset
	       ab:cd:e	 '-b o1	o2' fred 1   2	 ' o1 o2' b	 No O/P	    Unset
	       :ab:cd:e	 -a -d opt fred	 2   4	 opt	  d	 No O/P	    Unset
	       :ab:cd:e	 -a -d opt	 2   4	 opt	  d	 No O/P	    Unset
	       :ab:cd:e	 -a -d opt fred	 4   4	 Unset	  -1	 No O/P	    Unset
	       :ab:cd:e	 -a -d		 2   3	 NULL	  :	 No O/P	    d
	       :ab:cd:e	 -ab		 1   1	 Unset	  a	 No O/P	    Unset
	       :ab:cd:e	 -ab		 N/C 2	 NULL	  :	 No O/P	    b
	       ab:	 -: -a fred	 1   2	 Unset	  ?	 Diagnostic :
	       :ab:	 -: -a fred	 1   2	 Unset	  :	 No O/P	    Unset

	  2    Prior to	the first call to getopt() the variable	optind
	       is set by the system to be equal	to 1.

	  3    When opterr is set to zero, then	a call to getopt()
	       does not	print diagnostics to standard error.

	  4    The formats of the diagnostics printed to standard
	       error by	a call to getopt() in the POSIX	locale are as
	       follows:
	       "%s: illegal option -- %c\n", <program name>, <option
	       character>
	       "%s: option requires an argument	-- %c\n", <program
	       name>, <option character>

     OUTPUTS
     Tests:
	  1    Pass/Fail indication - failure information includes
	       detected	and expected return value, optind, optarg,
	       optopt and output to stderr.

	  2    Pass/Fail indication - failure information includes
	       detected	and expected value of optind.

	  3-4  Pass/Fail indication - failure information includes
	       detected	and expected return value and output to
	       stderr.




     Page 2					    (printed 2/21/103)






     getopt(XPG4.os/genuRelease	4.4.4 (UniSoft Lgetopt(XPG4.os/genuts)



     NOTE
	  This testset supersedes XOPEN.os/genuts/getopt, which	is
	  only executed	in XPG3	mode (its tests	give NOTINUSE results
	  in other modes).

     RELEASE
	  4.4.4	(07/19/99)
















































     Page 3					    (printed 2/21/103)



