


     wordexp(XPG4.os/genRelease	4.4.1 (UniSoft wordexp(XPG4.os/genuts)



     NAME
	  XPG4.os/genuts/wordexp - perform word	expansions

     DESCRIPTION
	  Tests	the wordexp() and wordfree() system call interfaces
	  for conformance to the XSI System Interfaces Page:wordexp()

     TESTS
     Compliance
	  1    If wordexp() is supported:
		   When	words is a pointer to a	string containing one
		   or more words to be expanded, then a	call to
		   wordexp() performs shell word expansions, stores
		   the number of words generated in the	we_wordc
		   structure element addressed by pwordexp, stores a
		   pointer to a	NULL terminated	list of	pointers to
		   these words in the we_wordv structure element and
		   returns a value of zero.
		   Testing Requirements: The argument words should
		   include instances of	quoted <newline> , shell
		   special characters, parentheses and braces.	The
		   argument words should also include the use of shell
		   special characters, parentheses and braces in the
		   context of command substitution and the use of
		   parentheses and braces in the context of variable
		   substitution.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  2    If wordexp() is supported:
		   When	words contains an unquoted word	of the form
		   $var	or ${var}, then	a call to wordexp() replaces
		   the text $var or ${var} with	the contents of	the
		   environment variable	var, or	with an	empty string
		   if var is not defined in the	environment.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  3    If wordexp() is supported:
		   When	words contains an unquoted word	~  or ~/, then
		   a call to wordexp() replaces	the text ~ with	the
		   contents of the environment variable	HOME.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  4    If wordexp() is supported:
		   When	words contains an unquoted word	~user  or
		   ~user/, then	a call to wordexp() replaces the text
		   ~user with the path of the user's home directory.



     Page 1					    (printed 2/21/103)






     wordexp(XPG4.os/genRelease	4.4.1 (UniSoft wordexp(XPG4.os/genuts)



	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  5    If wordexp() is supported:
		   When	words contains text quoted in ', then a	call
		   to wordexp()	leaves the quoted text unchanged.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  6    If wordexp() is supported:
		   When	words contains an unquoted word	of the form
		   $(cmd), then	a call to wordexp() replaces the text
		   $(cmd) with the results of executing	the command
		   cmd.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  7    If wordexp() is supported:
		   When	words contains an unquoted word	of the form
		   `cmd`, then a call to wordexp() replaces the	text
		   `cmd` with the results of executing the command
		   cmd.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  8    If wordexp() is supported:
		   When	words contains a pair of matching quote
		   characters ", then a	call to	wordexp() removes the
		   quotes and performs parameter substitution where
		   $var	or ${var} occurs and command substitution
		   where $(cmd)	or `cmd` occurs, and leaves all	other
		   characters unaltered.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  9    If wordexp() is supported:
		   When	words contains a pair of matching quote
		   characters ', then a	call to	wordexp() removes the
		   quotes and leaves the text between the quotes
		   unchanged.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  10   If wordexp() is supported:
		   When	the value of IFS is exactly ' ', '\t', and
		   '\n', then on a call	to wordexp(), any sequence of



     Page 2					    (printed 2/21/103)






     wordexp(XPG4.os/genRelease	4.4.1 (UniSoft wordexp(XPG4.os/genuts)



		   IFS characters except newline serves	to delimit a
		   field, and sequences	of these characters at the
		   beginning or	end of input are ignored.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  11   If wordexp() is supported:
		   When	the value of IFS is ' ', '\t', '\n' and	some
		   other characters, then on a call to wordexp(),
		   sequences of	' ', '\t' and '\n' characters delimit
		   fields and sequences	of these characters at the
		   beginning or	end of input are ignored, as normal,
		   but single occurrences of the other IFS characters,
		   together with any adjacent parameter	expansion and
		   command substitution.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  12   If wordexp() is supported:
		   When	words contains an unquoted # character,	then a
		   call	to wordexp() either treats the # as a normal
		   character or	ignores	the # character	and any
		   characters following	it.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  13   If wordexp() is supported:
		   When	words contains the characters ?, * and [
		   inside a bracket expression,	then a call to
		   wordexp() attaches no special meaning to those
		   characters.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  14   If wordexp() is supported:
		   The wordexp() function only matches a slash in a
		   pathname to an explicit slash character in words.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  15   If wordexp() is supported:
		   When	words contains *, then a call to wordexp()
		   matches the * to any	characters except slash,
		   leading dot and dot following slash.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.



     Page 3					    (printed 2/21/103)






     wordexp(XPG4.os/genRelease	4.4.1 (UniSoft wordexp(XPG4.os/genuts)



	  16   If wordexp() is supported:
		   When	words contains ?, then a call to wordexp()
		   matches the ? to any	single character except	slash,
		   leading dot and dot following slash.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  17   If wordexp() is supported:
		   When	words contains [s], then a call	to wordexp()
		   matches the [s] to any one of the characters	in the
		   set s except	slash, leading dot and dot following
		   slash.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  18   Not in use.

	  19   If wordexp() is supported:
		   When	words contains [!s], then a call to wordexp()
		   matches the [!s] to any characters not in the set s
		   except slash, leading dot and dot following slash.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  20   If wordexp() is supported:
		   When	words commences	with a slash character,	then a
		   call	to wordexp() commences searching for matching
		   filenames at	the calling process' root directory.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  21   If wordexp() is supported:
		   When	words does not commence	with a slash
		   character, then a call to wordexp() commences
		   searching for matching filenames at the calling
		   process' current working directory, interpreting an
		   explicit pathname element of	dot-dot	(..) as	the
		   parent directory of the previous pathname element.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  22   If wordexp() is supported:
		   A call to wordexp() allocates the memory pointed to
		   by the we_wordv structure member addressed by the
		   pwordexp argument.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets



     Page 4					    (printed 2/21/103)






     wordexp(XPG4.os/genRelease	4.4.1 (UniSoft wordexp(XPG4.os/genuts)



		   errno to ENOSYS.

	  23   If wordexp() is supported:
		   When	the WRDE_APPEND	flag is	set in flags, then the
		   word	list generated from this call to wordexp() is
		   stored in the we_wordv element of the structure
		   addressed by	pwordexp after the current set of
		   stored words, which remain unchanged, and the
		   we_wordc element of the structure is	updated	to
		   provide the total number of words from the two
		   calls.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  24   If wordexp() is supported:
		   When	the WRDE_DOOFFS	flag is	set in flags, then a
		   call	to wordexp() commences the array of pointers
		   in the we_wordv element of the structure addressed
		   by pwordexp with the	number of NULL pointers
		   specified in	the we_offs element of the structure
		   and follows this with we_wordc pointers to words,
		   followed by the terminating NULL pointer.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  25   If wordexp() is supported:
		   When	the WRDE_REUSE flag is set in flags and	the
		   pwordexp argument refers to a structure whose
		   address was supplied	to a previous call to
		   wordexp(), then a call to wordexp() frees any space
		   associated with pwordexp before assigning the new
		   series of word pointers to pwordexp.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  26   If wordexp() is supported:
		   When	the WRDE_SHOWERR flag is not set in flags and
		   the expansion of words involves a command
		   substitution	that writes output to standard error,
		   then	a call to wordexp() redirects the standard
		   error to during execution of	the command.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  27   If wordexp() is supported:
		   When	the WRDE_SHOWERR flag is set in	flags and the
		   expansion of	words involves a command substitution
		   that	writes output to standard error, then a	call



     Page 5					    (printed 2/21/103)






     wordexp(XPG4.os/genRelease	4.4.1 (UniSoft wordexp(XPG4.os/genuts)



		   to wordexp()	writes these messages to the standard
		   error stream.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

     Deviance
	  28   If wordexp() is supported:
		   When	words contains one or more instances of
		   unquoted shell special characters or	unquoted
		   parentheses or braces, then a call to wordexp()
		   returns the value of	the macro WRDE_BADCHAR and the
		   contents of the structure pointed to	by pwordexp
		   remain unchanged.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  29   If wordexp() is supported:
		   When	the WRDE_UNDEF flag is set in flags and	words
		   contains a reference	to an undefined	shell
		   variable, then a call to wordexp() returns the
		   value of the	macro WRDE_BADVAL and the contents of
		   the structure pointed to by pwordexp	remain
		   unchanged.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  30   If wordexp() is supported:
		   When	words contains a string	that requires command
		   substitution	and the	WRDE_NOCMD flag	is set in
		   flags, then a call to wordexp() returns the value
		   of the macro	WRDE_CMDSUB and	the contents of	the
		   structure pointed to	by pwordexp remain unchanged.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

	  31   If wordexp() is supported:
		   When	an shell syntax	error occurs during the
		   expansion of	words then a call to wordexp() returns
		   the value of	the macro WRDE_SYNTAX and the contents
		   of the structure pointed to by pwordexp remain
		   unchanged.
	       Otherwise:
		   A call to wordexp() returns WRDE_NOSYS and sets
		   errno to ENOSYS.

     Untestable	Aspects
	  1    When a call to wordexp()	fails in an attempt to
	       allocate	memory,	then the error return value



     Page 6					    (printed 2/21/103)






     wordexp(XPG4.os/genRelease	4.4.1 (UniSoft wordexp(XPG4.os/genuts)



	       WRDE_NOSPACE is returned	and the	we_wordc and we_wordv
	       elements	of the structure pointed to by pwordexp
	       contain details of the words that have been
	       successfully expanded.

	  2    When the	pwordexp argument refers to a structure	whose
	       address was supplied to a previous call to wordexp(),
	       then a call to wordfree() frees any space associated
	       with the	structure addressed by wordexp.

     OUTPUTS
     Tests:
	  1-27 Pass/Fail indication - failure information includes
	       expected	and detected return values.

	  28-31
	       Pass/Fail indication - failure information includes
	       expected	and detected return values and contents	of
	       pwordexp[].

     RELEASE
	  4.4.1	(06/09/97)

































     Page 7					    (printed 2/21/103)



