
/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ident "$Header: colltbl.c 1.1 89/10/09 $@(#)nls:colltbl.c	1.1 88/01/06 AT&T UEL"

/* Preprocessor Statements */
#include "colltbl.h"
#define MAXPATH		32

/* Global Variables */
int	Status = 0, Lineno = 1;
int	regexp_flag;
char	*Cmd, *Infile;
char	codeset[30];

main(argc, argv)
int	argc;
char	**argv;
{
	extern char	*optarg;
	extern int	optind, yydebug;
	int		c;
	char		compstr[BUFSIZ];

	/*  Get name of command  */
	Cmd = argv[0];

	/*  Get command line options  */
	while ((c = getopt(argc, argv, "?dr")) != EOF) {
		switch (c) {
		case 'd':
			yydebug++;
			break;
		case 'r':
			regexp_flag++;
			break;
		case '?':
			usage();
			break;
		}
	}

	/*  Get input file argument  */
	switch (argc - optind) {
	case 0:
		Infile = "stdin";
		break;
	case 1:
		if (EQ(argv[optind+1], "-"))
			Infile = "stdin";
		else if (freopen((Infile = argv[optind]), "r", stdin) == NULL) {
			error(BAD_OPEN, Infile);
			exit(-1);
		}
		break;
	default:
		usage;
	}

	/*  Initialize lexical analyzer  */
	lexinit();

	/*  Run parser  */
	fprintf(stderr, "PHASE 1:  Parsing input file\n");
	yyparse();

	/*  Flush and close input and output files  */
	fflush(stdout);
	fclose(stdin);
	fclose(stdout);


	/*  Return with appropriate return status  */
	exit(Status);
}
