
/*
 * Copyright (c) 2001 BBNT Solutions LLC
 *
 * Permission to use, copy, modify, and distribute this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice and this permission
 * appear in all copies and in supporting documentation, and that the
 * name of BBN Technologies not be used in advertising or publicity
 * pertaining to distribution of the software without specific,
 * written prior permission.  BBN makes no representations about the
 * suitability of this software for any purposes.  It is provided "AS
 * IS" without express or implied warranties.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stats.h"

unsigned short silent = FALSE;


void set_usage ()
{
    fprintf (stderr,"\nusage: set variable [params]\n");
    fprintf (stderr,"  variables:\n");
    fprintf (stderr,"   silent - true/false default is toggle\n");
/*     fprintf (stderr,"   cdf-int - true/false default is toggle\n"); */
    fprintf (stderr,"\n");
}


void cmd_set ()
{
    char *var, *val;

    if ((var = strtok (NULL," ")) == NULL)
    {
	set_usage ();
	if (script_file)
	    exit (1);
	return;
    }
    if (!strcmp (var,"silent"))
    {
	if ((val = strtok (NULL," ")) == NULL)
            silent = silent ? FALSE : TRUE;
	else
	{
	    if (!strcasecmp (val,"true"))
		silent = TRUE;
	    else if (!strcasecmp (val,"false"))
		silent = FALSE;
	    else
	    {
		set_usage ();
		if (script_file)
		    exit (1);
		return;
	    }
	}
    }
    else
    {
	set_usage ();
	if (script_file)
	    exit (1);
	return;
    }
}
