# include "basic.h"

int opihi_setmode (int argc, char **argv) {

  int value;

  if (argc < 2) {
    gprint (GP_ERR, "USAGE: opihi (verbose) [on/off]\n");
    return (FALSE);
  }

  if (!strcasecmp(argv[1], "verbose")) {
      if (argc == 2) {
	  value = get_verbose_shell();
	  if (value) {
	    gprint (GP_ERR, "opihi verbose mode: on\n");
	  } else {
	    gprint (GP_ERR, "opihi verbose mode: off\n");
	  }
	  return (TRUE);
      }
      if (!strcasecmp(argv[2], "on")) {
	set_verbose_shell (TRUE);
	return (TRUE);
      }
      if (!strcasecmp(argv[2], "off")) {
	set_verbose_shell (FALSE);
	return (TRUE);
      }
      gprint (GP_ERR, "unknown verbose mode %s\n", argv[2]);
      return (FALSE);
  }

  gprint (GP_ERR, "unknown mode %s\n", argv[1]);
  return (FALSE);
}
