/*
 * nasd_getopt.c
 *
 * Do "getopt" in platform-independent ways
 *
 * Author: Jim Zelenka
 */
/*
 * Copyright (c) of Carnegie Mellon University, 1999.
 *
 * Permission to reproduce, use, and prepare derivative works of
 * this software for internal use is granted provided the copyright
 * and "No Warranty" statements are included with all reproductions
 * and derivative works. This software may also be redistributed
 * without charge provided that the copyright and "No Warranty"
 * statements are included in all redistributions.
 *
 * NO WARRANTY. THIS SOFTWARE IS FURNISHED ON AN "AS IS" BASIS.
 * CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER
 * EXPRESSED OR IMPLIED AS TO THE MATTER INCLUDING, BUT NOT LIMITED
 * TO: WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY
 * OF RESULTS OR RESULTS OBTAINED FROM USE OF THIS SOFTWARE. CARNEGIE
 * MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT
 * TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
 */


#include <nasd/nasd_options.h>
#define NASD_GETOPT_C
#include <nasd/nasd_getopt.h>
#include <stdio.h>

extern char *optarg;
extern int   optind;
extern int   optopt;

char *nasd_optarg;
int   nasd_optind;
int   nasd_optopt;

int
nasd_getopt(
  int    argc,
  char **argv,
  char  *optstring,
  char  *optchar)
{
  char c;

  c = getopt(argc, argv, optstring);

  *optchar = c;
  nasd_optarg = optarg;
  nasd_optind = optind;
  nasd_optopt = optopt;

  if (c == (char)EOF)
    return(0);

  return(1);
}

/* Local Variables:  */
/* indent-tabs-mode: nil */
/* tab-width: 2 */
/* End: */
