/* * ----------------------------------------------------------------- * This Rexx program is called by several of the uni-XEDIT macros in * the Sample Library. To use this program in any other context * requires a license for uni-REXX on the host computer where the * program is to be run. * ----------------------------------------------------------------- * * * * justone - program to test a string for a single word. If the * string contains more or less than one word, an error * message is set. This routine also sets a boolean * return code for use in the calling program. * * Syntax: justone() * * is a string of filenames * * Returns a '1' if the string contains a single word. Returns '0' * if no words, or more than one word is found. * * Must be invoked as a function * * Must be in a directory specified in the environment variable XEDITPATH. * * Modification History: * * 04 Aug 94 twg Initial implementation * */ procedure expose msg parse arg filename if words(filename) \= 1 then do /* if not exactly ONE file, then error */ if words(filename) = 0 then /* got nothing - file expansion error */ msg = 'Could not resolve or expand filename' if words(filename) > 1 then /* got more than one - too many files */ msg = 'Filename expanded to numerous files' return 0 /* return 0 if error was detected */ end else return 1 /* return 1 if ONE file was found */