--
--	getopt.occ - test command-line option parsing
--	Copyright (C) 2008 University of Kent
--
--	This program is free software; you can redistribute it and/or modify
--	it under the terms of the GNU General Public License as published by
--	the Free Software Foundation; either version 2 of the License, or
--	(at your option) any later version.
--
--	This program is distributed in the hope that it will be useful,
--	but WITHOUT ANY WARRANTY; without even the implied warranty of
--	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--	GNU General Public License for more details.
--
--	You should have received a copy of the GNU General Public License
--	along with this program; if not, write to the Free Software
--	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
--

#INCLUDE "file.module"
#INCLUDE "course.module"

PROC main (CHAN BYTE out!)
  CHAN GETOPT opts:
  PAR
    file.get.options ("xya:b:", opts!)
    INITIAL BOOL running IS TRUE:
    WHILE running
      BYTE o:
      MOBILE []BYTE a:
      opts ? CASE
        opt; o
          SEQ
            out.string ("opt *'", 0, out!)
            out ! o
            out.string ("*'; ", 0, out!)
        opt.arg; o; a
          SEQ
            out.string ("opt.arg *'", 0, out!)
            out ! o
            out.string ("*' *'", 0, out!)
            out.string (a, 0, out!)
            out.string ("*'; ", 0, out!)
        arg; a
          SEQ
            out.string ("arg *'", 0, out!)
            out.string (a, 0, out!)
            out.string ("*'; ", 0, out!)
        bad; o
          SEQ
            out.string ("bad *'", 0, out!)
            out ! o
            out.string ("*'; ", 0, out!)
        done
          SEQ
            out.string ("done*n", 0, out!)
            running := FALSE
:
