/* THIS FILE IS AUTO-GENERATED, DO NOT EDIT */

#define VALUE_B (bval)
#define VALUE_S (val)
#define VALUE_I atoi(val)
#define VALUE_F atof(val)
#define BOOLEAN(x) ((x)=(bval==1?1:0))
#define RETURN return(1)
#define FAIL return(-1)

#include "ninox.h"

int _CMD_amean(char *arg, char *val, int bval)
	{
	BOOLEAN(AMean);
	return(1);
	}

int _HLP__CMD_amean(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","amean");
	Print("	Enable the alpha-trimmed-mean smoothing algorithm\n");
	exit(0);
	}

int _CMD_archiveoverridefilenames(char *arg, char *val, int bval)
	{
	BOOLEAN(ArchiveOverrideFilenames);
	return(1);
	}

int _HLP__CMD_archiveoverridefilenames(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","archiveoverridefilenames");
	Print("	no help available\n");
	exit(0);
	}

int _CMD_bayer8(char *arg, char *val, int bval)
	{
	BOOLEAN(Bayer8);
	return(1);
	}

int _CMD_bayer_x(char *arg, char *val, int bval)
	{
	BayerX = VALUE_I;
	return(1);
	}

int _CMD_bayer_y(char *arg, char *val, int bval)
	{
	BayerY = VALUE_I;
	return(1);
	}

int _CMD_bayerboost(char *arg, char *val, int bval)
	{
	BayerBoost = VALUE_F;
	if (BayerBoost == 0) BayerBoost = 1.0;
	return(1);
	}

int _CMD_centrefunc(char *arg, char *val, int bval)
	{
	if (! strcasecmp(VALUE_S,"left"))  CentreMode = CENTRE_LEFT;
	if (! strcasecmp(VALUE_S,"right")) CentreMode = CENTRE_RIGHT;
	return(1);
	}

int _HLP__CMD_centrefunc(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","centrefunc");
	Print("	Determines how ninox finds the centre of an image to be cut out. The default\n");
	Print("	(ie if centrefunc is omitted) is to find the centre of brightness of the whole image\n");
	Print("	known as the barycentre.\n");
	Print("	\n");
	Print("	If you give centrefunc=left then this process is modified to only count the \"first\" \n");
	Print("	object found in the frame (scanning left -> right).\n");
	Print("	\n");
	Print("	If you give centrefunc=right then the process is modified to only count the \"first\"\n");
	Print("	object found in the frame scanning from right -> left.\n");
	Print("	\n");
	Print("	The \"left\" and \"right\" modes are useful when you want to lock onto one particular object\n");
	Print("	in a frame that contains other objects that are moving relative to the one you want, and\n");
	Print("	you want to ignore everything other than the first object (looking from either left or right).\n");
	Print("	\n");
	exit(0);
	}

int _CMD_chain(char *arg, char *val, int bval)
	{
	BOOLEAN(ChainArchives);
	return(1);
	}

int _HLP__CMD_chain(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","chain");
	Print("	When playing or processing FITS Archive files (.fta), automatically\n");
	Print("	chain from the end of one archive to the start of the next\n");
	exit(0);
	}

int _CMD_config(char *arg, char *val, int bval)
	{
	char *params[32],*vals[32];
	char *c,*str,*cfgfile;
	int i,n,rval;
	cfgfile = strtok(val,",");
	if (! cfgfile || cfgfile[0]==0) {
	   printf("Error: Invalid filename for -config\n");
	   exit(1);
	   }
	if (access(cfgfile,R_OK)) {
	   printf("Error: Cannot find config file '%s'\n",cfgfile);
	   exit(1);
	   }
	// parse remainder of val into var=value tokens
	n=0;
	while(str = strtok(NULL,",")) {
	   char *c = strchr(str,'=');
	   if (c) {
		*c=0;
		params[n] = strdup(str);
		vals[n++] = strdup(c+1);
		}
	   }
	params[n]=NULL;
	vals[n]=NULL;
	rval=LoadConfigFile(cfgfile,params,vals);
	return rval;
	
	return(1);
	}

int _CMD_count(char *arg, char *val, int bval)
	{
	// How many images to process
	ImageCount=VALUE_I;
	return(1);
	}

int _CMD_cut(char *arg, char *val, int bval)
	{
	int x,y;
	if (sscanf(VALUE_S,"%d,%d",&x,&y)==2) {
		CutX = x;
		CutY = y;
		}
	else {
	   if (VALUE_I < 100 || VALUE_I>10000) {
		Print("%d: Outside valid bounds 100..10000\n",VALUE_I);
		FAIL;
		}
	   CutX = VALUE_I; CutY = VALUE_I;
	   newWidth = CutX;
	   newHeight = CutY;
	   }
	return(1);
	}

int _CMD_cutx(char *arg, char *val, int bval)
	{
	CutX = VALUE_I;
	if (CutX < 100) {
	   Print("-cutx: minimum supported size 100 pixels\n");
	   FAIL;
	   }
	return(1);
	}

int _CMD_cuty(char *arg, char *val, int bval)
	{
	CutY = VALUE_I;
	if (CutY < 100) {
	   Print("-cutx: minimum supported size 100 pixels\n");
	   FAIL;
	   }
	return(1);
	}

int _CMD_darkframe(char *arg, char *val, int bval)
	{
	double scale;
	char fname[512];
	if (sscanf(VALUE_S,"%lf,%s",&scale,fname) == 2) {
		DarkFrame = strdup(fname);
		DarkFrame_Scale = scale;
		}
	else {
		DarkFrame = strdup(VALUE_S);
		DarkFrame_Scale = 1.0;
		}
	return(1);
	}

int _CMD_dbf_diff(char *arg, char *val, int bval)
	{
	DBF_DIFF = VALUE_I;
	return(1);
	}

int _CMD_dbfedgecount(char *arg, char *val, int bval)
	{
	DBF_EDGE_COUNT = VALUE_I;
	return(1);
	}

int _HLP__CMD_dbfedgecount(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","dbfedgecount");
	Print("	With detectbrokenframes, this sets a threshhold for detecting\n");
	Print("	broken frames.\n");
	exit(0);
	}

int _CMD_debayer(char *arg, char *val, int bval)
	{
	if (VALUE_I) DoDeBayer = VALUE_I;
	else {
	   if (! strcasecmp(VALUE_S,"gbg")) DoDeBayer=1;
	   if (! strcasecmp(VALUE_S,"rgr")) DoDeBayer=2;
	   if (! strcasecmp(VALUE_S,"bgb")) DoDeBayer=3;
	   if (! strcasecmp(VALUE_S,"grg")) DoDeBayer=4;
	   }
	return(1);
	}

int _CMD_debug(char *arg, char *val, int bval)
	{
	BOOLEAN(DEBUG);
	return(1);
	}

int _CMD_default_config(char *arg, char *val, int bval)
	{
	ShowGlobals();
	exit(1);
	return(1);
	}

int _CMD_detectbrokenframes(char *arg, char *val, int bval)
	{
	if (!strcasecmp(VALUE_S,"planet")) DBF_TYPE = DBF_PLANET;
	else if (!strcasecmp(VALUE_S,"lunar")) DBF_TYPE = DBF_LUNAR;
	else if (!strcasecmp(VALUE_S,"moon")) DBF_TYPE = DBF_LUNAR;
	DetectBrokenFrames = 1;
	return(1);
	}

int _HLP__CMD_detectbrokenframes(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","detectbrokenframes");
	Print("	ninox will use an algorithm to detect corrupted (broken) frames\n");
	Print("	by comparing each frame to its predecessor. Sudden large-scale\n");
	Print("	changes are interpreted as corruption and the frame is skipped.\n");
	exit(0);
	}

int _CMD_detecthotpixels(char *arg, char *val, int bval)
	{
	BOOLEAN(DetectHotPixels);
	return(1);
	}

int _CMD_display(char *arg, char *val, int bval)
	{
	DisplayFrames = 1;
	if (! strcasecmp(VALUE_S,"pause")) DisplayPause=1;
	return(1);
	}

int _CMD_dofft(char *arg, char *val, int bval)
	{
	double r1,r2,p;
	if (sscanf(VALUE_S,"%lf,%lf,%lf",&r1,&r2,&p) == 3) {
	   /* 3 operand version, all params given */
	   FFT_LPF_Radius1 = r1;
	   FFT_LPF_Radius2 = r2;
	   FFT_LPF_Pow = p;
	   }
	else if (sscanf(VALUE_S,"%lf,%lf",&r1,&r2) == 2) {
	   /* 2 operand version, assume p = 1 */
	   FFT_LPF_Radius1 = r1;
	   FFT_LPF_Radius2 = r2;
	   FFT_LPF_Pow = 1.0;
	   }
	else if (sscanf(VALUE_S,"%lf",&r1) == 1) {
	   /* single operand version, assume r2 = r1 * 2 and p = 1 */
	   FFT_LPF_Radius1 = r1;
	   FFT_LPF_Radius2 = r1 * 2.0;
	   FFT_LPF_Pow = 1.0;
	   }
	else {
	   FFT_LPF_Radius1 = 0;
	   FFT_LPF_Radius2 = 0;
	   FFT_LPF_Pow = 0;
	   }
	   
	DoFFT = 1;
	
	return(1);
	}

int _CMD_enablecutout(char *arg, char *val, int bval)
	{
	BOOLEAN(DoCutout);
	if (! VALUE_B) ForceProcess=1;
	return(1);
	}

int _HLP__CMD_enablecutout(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","enablecutout");
	Print("	ninox will attempt to locate and centre the dominant object in the\n");
	Print("	frame by finding the centre of brightness and \"cutting out\" a rectangle\n");
	Print("	around that point and moving it to the centre of the image.\n");
	exit(0);
	}

int _CMD_fft_filter(char *arg, char *val, int bval)
	{
	double r1,r2,p;
	if (sscanf(VALUE_S,"%lf,%lf,%lf",&r1,&r2,&p) == 3) {
	   /* 3 operand version, all params given */
	   FFT_LPF_Radius1 = r1;
	   FFT_LPF_Radius2 = r2;
	   FFT_LPF_Pow = p;
	   }
	else if (sscanf(VALUE_S,"%lf,%lf",&r1,&r2) == 2) {
	   /* 2 operand version, assume p = 1 */
	   FFT_LPF_Radius1 = r1;
	   FFT_LPF_Radius2 = r2;
	   FFT_LPF_Pow = 1.0;
	   }
	else if (sscanf(VALUE_S,"%lf",&r1) == 1) {
	   /* single operand version, assume r2 = r1 * 2 and p = 1 */
	   FFT_LPF_Radius1 = r1;
	   FFT_LPF_Radius2 = r1 * 2.0;
	   FFT_LPF_Pow = 1.0;
	   }
	else {
	   Print("fft-filter: Error, usage is fft-filter=r1,r2,p\n");
	   exit(1);
	   }
	FFT_Filter = 1;
	   
	return(1);
	}

int _CMD_fft_ref(char *arg, char *val, int bval)
	{
	FFT_Ref = strdup(VALUE_S);
	DoFFT = 1;
	return(1);
	}

int _CMD_fft_scan(char *arg, char *val, int bval)
	{
	FFT_Region = VALUE_I;
	return(1);
	}

int _CMD_flux(char *arg, char *val, int bval)
	{
	SumFlux = 1;
	FluxFile = VALUE_S;
	return(1);
	}

int _CMD_forceprocess(char *arg, char *val, int bval)
	{
	BOOLEAN(ForceProcess);
	return(1);
	}

int _CMD_gain(char *arg, char *val, int bval)
	{
	Gain = VALUE_F;
	if (Gain != 1.0) ChangeGain = 1;
	return(1);
	}

int _CMD_gaincomp(char *arg, char *val, int bval)
	{
         BOOLEAN(ApplyGainComp);
         if (ApplyGainComp && ! LoadGainCompRef(VALUE_S)) {
               Print("Error loading gain compensation reference\n");
               FAIL;
               }
	return(1);
	}

int _CMD_gamma(char *arg, char *val, int bval)
	{
	double g = VALUE_F;
	if (g < 0.3 || g > 1.5) {
	   Print("Gamma value %f is outside accepted range 0.3 <= gamma <= 1.5\n",g);
	   FAIL;
	   }
	Gamma = g;
	if (Gamma != 1.0) ChangeGamma = 1;
	return(1);
	}

int _CMD_grey(char *arg, char *val, int bval)
	{
	BOOLEAN(Grey);
	return(1);
	}

int _HLP__CMD_grey(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","grey");
	Print("	Converts 24bpp input into 8bpp monochrome\n");
	exit(0);
	}

int _CMD_height(char *arg, char *val, int bval)
	{
	newHeight = VALUE_I;
	if (newHeight < 100 || newHeight > 10000) {
	   Print("Height must be 100..10000\n");
	   FAIL;
	   }
	return(1);
	}

int _CMD_help(char *arg, char *val, int bval)
	{
	int i;
	Print("\nUsage: ninox [ switches] [files or directories]\n\n");
	Print("Switches: \n\n");
	for(i=0; Names[i].func != NULL; ++i)
	   if (! strstr(Names[i].option,"help-"))
		Print("-%s ",Names[i].option);
	Print("\n\n");
	Print("Use \"ninox -help-X\" to see detailed help about switch X\n\n");
	exit(0);
	
	return(1);
	}

int _CMD_histo_warning(char *arg, char *val, int bval)
	{
	BOOLEAN(EnableHistoWarning);
	return(1);
	}

int _HLP__CMD_histo_warning(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","histo_warning");
	Print("	Usage: -histo-warning=off  OR  -nohisto-warning\n");
	exit(0);
	}

int _CMD_hnoisefilter(char *arg, char *val, int bval)
	{
	BOOLEAN(HNoiseFilter);
	return(1);
	}

int _CMD_i(char *arg, char *val, int bval)
	{
	BOOLEAN(InteractiveMode);
	return(1);
	}

int _HLP__CMD_i(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","i");
	Print("	Enter interactive mode\n");
	exit(0);
	}

int _CMD_input_type(char *arg, char *val, int bval)
	{
	if (!strcasecmp(VALUE_S,"bmp")) 	InputFileType = IMG_BMP;
	else if (!strncasecmp(VALUE_S,"fit",3)) InputFileType = IMG_FIT;
	else if (!strcasecmp(VALUE_S,"ppm")) 	InputFileType = IMG_PPM;
	else {
	   Print("input file type '%s' not understood\n",VALUE_S);
	   FAIL;
	   }
	return(1);
	}

int _CMD_inputfilter(char *arg, char *val, int bval)
	{
	if (InputFilter==0 && VALUE_F > 0) InputFilter_ThreshHold = VALUE_F;
	++InputFilter;
	return(1);
	}

int _HLP__CMD_inputfilter(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","inputfilter");
	Print("	Enables an input filter algorithm which replaces pixels that are too bright/dark\n");
	Print("	when compared to their neighbors. favours dark pixels.\n");
	exit(0);
	}

int _CMD_inputfilter_display(char *arg, char *val, int bval)
	{
	BOOLEAN(InputFilter_Display);
	return(1);
	}

int _HLP__CMD_inputfilter_display(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","inputfilter_display");
	Print("	Display the action of the input filter\n");
	exit(0);
	}

int _CMD_invert(char *arg, char *val, int bval)
	{
	BOOLEAN(doInvertImage);
	return(1);
	}

int _CMD_iquant(char *arg, char *val, int bval)
	{
	IQuant = VALUE_I;
	return(1);
	}

int _CMD_istretch(char *arg, char *val, int bval)
	{
	BOOLEAN(InputHistoStretch);
	return(1);
	}

int _CMD_levels(char *arg, char *val, int bval)
	{
	int min,max;
	if (sscanf(val,"%d,%d",&min,&max) != 2) {
	   printf("syntax error on 'levels'\n");
	   FAIL;
	   }
	LevelsMin = min;
	LevelsMax = max;
	doLevelsAdjust = 1;
	return(1);
	}

int _CMD_mean3(char *arg, char *val, int bval)
	{
	BOOLEAN(Do3x3Smooth);
	return(1);
	}

int _HLP__CMD_mean3(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","mean3");
	Print("	Enable a 3x3 mean smoothing on the image\n");
	exit(0);
	}

int _CMD_mergefile(char *arg, char *val, int bval)
	{
	MergeFile = strdup(VALUE_S);
	return(1);
	}

int _CMD_mergethreshhold(char *arg, char *val, int bval)
	{
	MergeThreshHold = VALUE_F;
	return(1);
	}

int _CMD_minpixels(char *arg, char *val, int bval)
	{
	MinPixels = VALUE_I;
	if (MinPixels<10 || MinPixels > 1000) {
	   Print("Minpixels: %d out of alloed range 10..1000\n",MinPixels);
	   FAIL;
	   }
	return(1);
	}

int _CMD_mirror(char *arg, char *val, int bval)
	{
	BOOLEAN(doMirrorImage);
	return(1);
	}

int _HLP__CMD_mirror(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","mirror");
	Print("	Flip the image vertically\n");
	exit(0);
	}

int _CMD_mkdirs(char *arg, char *val, int bval)
	{
	BOOLEAN(MkDirs);
	return(1);
	}

int _HLP__CMD_mkdirs(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","mkdirs");
	Print("	Usage: -mkdirs=yes\n");
	Print("	Creates all parent directories for the -outdir directory\n");
	exit(0);
	}

int _CMD_morph_across(char *arg, char *val, int bval)
	{
	// Number of control points across the image
	Morph_Across = VALUE_I;
	return(1);
	}

int _CMD_morph_de(char *arg, char *val, int bval)
	{
	// Enable extra debugging
	Morph_Debug = VALUE_I;
	printf("[%d]\n",Morph_Debug);
	return(1);
	}

int _CMD_morph_down(char *arg, char *val, int bval)
	{
	// Number of control points down the image
	Morph_Down = VALUE_I;
	
	return(1);
	}

int _CMD_morph_dr(char *arg, char *val, int bval)
	{
	Morph_Drift = VALUE_I;
	return(1);
	}

int _CMD_morph_it(char *arg, char *val, int bval)
	{
	// Number of morph iterations to run
	Morph_Iterations = VALUE_I;
	return(1);
	}

int _CMD_morph_max_translate(char *arg, char *val, int bval)
	{
	Morph_MaxTranslate = VALUE_I;
	return(1);
	}

int _CMD_morph_min_divisor(char *arg, char *val, int bval)
	{
	Morph_Min_Divisor = VALUE_I;
	
	return(1);
	}

int _CMD_morph_ref(char *arg, char *val, int bval)
	{
	Morph_Ref = strdup(VALUE_S);
	if (access(Morph_Ref,0)) {
	   Print("morph_ref: Reference image '%s' does not exist\n",val);
	   FAIL;
	   }
	return(1);
	}

int _CMD_morphing(char *arg, char *val, int bval)
	{
	Morphing = atoi(val);
	return(1);
	}

int _CMD_nocutout(char *arg, char *val, int bval)
	{
	DoCutout=0;
	ForceProcess = 1;
	return(1);
	}

int _HLP__CMD_nocutout(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","nocutout");
	Print("	Flip the image horizontally\n");
	exit(0);
	}

int _CMD_nosave(char *arg, char *val, int bval)
	{
	BOOLEAN(NoSave);
	return(1);
	}

int _CMD_outdir(char *arg, char *val, int bval)
	{
	int i;
	OutDir = strdup(VALUE_S);
	for(i=0; OutDir[i]; ++i) if (OutDir[i]=='\\') OutDir[i]='/';
	if (MkDirs) {
	   char *strtmp = strdup(OutDir);
	   char *ptr = strchr(strtmp,'/');
	   while(ptr) {
		*ptr = 0;
		if (! isDirectory(strtmp)) {
		   Print("Creating directory '%s'\n",strtmp);
		   Mkdir(strtmp);
		   if (! isDirectory(strtmp)) {
			Print("Mkdir on '%s' failed, cannot continue\n");
			exit(0);
			}
		   }
		else {
		   Print("Directory '%s' exists\n",strtmp);
		   }
		*ptr = '/';
		ptr = strchr(ptr+1,'/');
		}
	   free(strtmp);
	   }
	return(1);
	}

int _CMD_output_depth(char *arg, char *val, int bval)
	{
	OutputFileDepth = VALUE_I;
	return(1);
	}

int _CMD_output_stack_depth(char *arg, char *val, int bval)
	{
	OutputStackFileDepth = VALUE_I;
	return(1);
	}

int _CMD_output_type(char *arg, char *val, int bval)
	{
	if (!strcasecmp(VALUE_S,"bmp")) 	OutputFileType = IMG_BMP;
	else if (!strncasecmp(VALUE_S,"fit",3)) OutputFileType = IMG_FIT;
	else if (!strcasecmp(VALUE_S,"ppm")) 	OutputFileType = IMG_PPM;
	else {
	   Print("output file type '%s' not understood\n",VALUE_S);
	   FAIL;
	   }
	return(1);
	}

int _CMD_overwrite(char *arg, char *val, int bval)
	{
	BOOLEAN(AllowOverwrite);
	return(1);
	}

int _CMD_popfilter(char *arg, char *val, int bval)
	{
 	char when[32];
	int sz = 5;
	if (sscanf(VALUE_S,"%d,%s",&sz,when) == 2) {
	   if (!strcasecmp(when,"before")) PopFilter_When = POPFILTER_BEFORE;
	   else if (!strcasecmp(when,"after")) PopFilter_When = POPFILTER_AFTER;
	   else {
		Print("Unknown option '%s' to popfilter\n",when);
		FAIL;
		}
	   if (sz<=0) {
		Print("invalid size arg '%d' to popfilter\n",sz);
		FAIL;
		}
	   PopFilter = sz;
	   }
	else if (! strcasecmp(VALUE_S,"before")) {
		PopFilter_When = POPFILTER_BEFORE;
		PopFilter = 5;
		}
	else if (! strcasecmp(VALUE_S,"after")) {
		PopFilter_When = POPFILTER_AFTER;
		PopFilter = 5;
		}
	else if (VALUE_I > 0) {
		PopFilter = VALUE_I;
		PopFilter_When = POPFILTER_BEFORE;
		}
	else {
		PopFilter = 5;
		PopFilter_When = POPFILTER_BEFORE;
		}
	return(1);
	}

int _CMD_process(char *arg, char *val, int bval)
	{
	// process=Offset,Skip for cooperatively processing a video sequence
	if (sscanf(VALUE_S,"%d,%d",&ProcessOffset,&ProcessSkip) != 2) {
	   printf("process: invalid argument, wanted process=offset,skip\n");
	   FAIL;
	   }
	return(1);
	}

int _HLP__CMD_process(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","process");
	Print("	Useful on multi-core or multi-processor machines. Allows you to specify\n");
	Print("	a subset of the available images to be processed on the assumption that\n");
	Print("	another invocation of ninox will be processing the skipped images.\n");
	Print("	\n");
	Print("	Usage: -process=offset,skip\n");
	Print("	\n");
	Print("	Offset is the starting image number (0 = first)\n");
	Print("	Skip is the number of images to skip after processing an image (default=0)\n");
	Print("	\n");
	Print("	eg, to run 2 copies of ninox, use:\n");
	Print("	\n");
	Print("	ninox -process=0,1 ...\n");
	Print("	and\n");
	Print("	ninox -process=1,1 ...\n");
	Print("	\n");
	Print("	with all other switches identical. The first invocation here will process\n");
	Print("	images 0,2,4,6,... and the second will process images 1,3,5,7 ...\n");
	exit(0);
	}

int _CMD_protect(char *arg, char *val, int bval)
	{
	BOOLEAN(HistoProtect);
	return(1);
	}

int _CMD_qcount(char *arg, char *val, int bval)
	{
	QualityMaxCount = VALUE_I;
	return(1);
	}

int _CMD_qestimator(char *arg, char *val, int bval)
	{
	int min,max,ch,step;
	BOOLEAN(QEstimator);
	// Possible value "n,m" representing min and max subsampling
	// or "n,m,i" for sampling between n and m with increment i
	if (sscanf(val,"%d%c%d%c%d",&min,&ch,&max,&ch,&step)==5) {
	   QSUBSAMPLE_MIN = min;
	   QSUBSAMPLE_MAX = max;
	   QSUBSAMPLE_INC = step;
	   QEstimator = 1;
	   }
	else if (sscanf(val,"%d%c%d",&min,&ch,&max)==3) {
	   QSUBSAMPLE_MIN = min;
	   QSUBSAMPLE_MAX = max;
	   QEstimator = 1;
	   }
	return(1);
	}

int _CMD_qfunc(char *arg, char *val, int bval)
	{
	if (! strncasecmp(VALUE_S,"hist",4)) QualityFunction = HISTO;
	else if (! strncasecmp(VALUE_S,"grad",4))   QualityFunction = GRADIENT; // default
	else if (! strncasecmp(VALUE_S,"thresh",4)) QualityFunction = BR_THRESH; // default
	else {
		printf("Unknown quality function '%s'\n",val);
		FAIL;
		}
	return(1);
	}

int _CMD_qhistfile(char *arg, char *val, int bval)
	{
	   QHISTO_FILE = strdup(VALUE_S);
	return(1);
	}

int _CMD_qhisto(char *arg, char *val, int bval)
	{
	int x1,y1,x2,y2,min,max;
	if (sscanf(val,"%d,%d-%d,%d:%d-%d",&x1,&y1,&x2,&y2,&min,&max)==6)
		QAddRegion(x1,y1,x2,y2,min,max);
	if (sscanf(val,"%d,%d",&min,&max)==2) {
	   	QHISTO_MIN = min;
		QHISTO_MAX = max;
		}
	else {
		printf("Usage: -qhisto=min,max (8 bit values)\n");
		FAIL;
		}
	return(1);
	}

int _CMD_qmargin(char *arg, char *val, int bval)
	{
	   // -qmargin=0.25 for 25% margin on all borders
	   QMargin = VALUE_F;
	return(1);
	}

int _CMD_qtrim(char *arg, char *val, int bval)
	{
	int b,a;
	if (sscanf(val,"%d,%d",&b,&a) == 2) {
	   QTrim_Before = b;
	   QTrim_After = a;
	   }
	else {
	   QTrim_Before = QTrim_After = VALUE_I;
	   }
	return(1);
	}

int _CMD_quiet(char *arg, char *val, int bval)
	{
	Quiet = bval;
	return(1);
	}

int _CMD_qwrite(char *arg, char *val, int bval)
	{
	BOOLEAN(QWriteIntermediateFiles);
	return(1);
	}

int _CMD_renumber(char *arg, char *val, int bval)
	{
	BOOLEAN(QRenumberFiles);
	if (!strcasecmp(VALUE_S,"last")) QRenumberFiles = QRENUMBER_LAST;
	return(1);
	}

int _CMD_rotate(char *arg, char *val, int bval)
	{
	RotateAngle = VALUE_F;
	if (RotateAngle != 0) do_Rotate=1;
	return(1);
	}

int _CMD_rotatecutoff(char *arg, char *val, int bval)
	{
	RotateCutoff = VALUE_I;
	return(1);
	}

int _CMD_runfile(char *arg, char *val, int bval)
	{
	RunFile = strdup(VALUE_S);
	return(1);
	}

int _CMD_scan(char *arg, char *val, int bval)
	{
	// give a non-central place to start scanning for FindCentre()
	int x1,y1;
	char fname[512];
	if (sscanf(VALUE_S,"%d,%d",&x1,&y1) != 2) {
	   printf("-scan: invalid format, should be -scan=x,y\n");
	   FAIL;
	   }
	Sub_x = x1;
	Sub_y = y1;
	return(1);
	}

int _CMD_smoothing(char *arg, char *val, int bval)
	{
	if (!strcasecmp(VALUE_S,"before")) {
	   UpScale_Smoothing_When = SMOOTHING_BEFORE;
	   UpScale_Smoothing = 1;
	   }
	else if (!strcasecmp(VALUE_S,"after")) {
	   UpScale_Smoothing_When = SMOOTHING_AFTER;
	   UpScale_Smoothing = 1;
	   }
	else BOOLEAN(UpScale_Smoothing);
	return(1);
	}

int _CMD_stack(char *arg, char *val, int bval)
	{
	StackFile = strdup(VALUE_S);
	return(1);
	}

int _CMD_stackcount(char *arg, char *val, int bval)
	{
	StackMax = VALUE_I;
	return(1);
	}

int _CMD_streamfilter(char *arg, char *val, int bval)
	{
	StreamFilter = 1;
	if (VALUE_I)
	   StreamFilter_History = VALUE_I;
	return(1);
	}

int _CMD_stretch(char *arg, char *val, int bval)
	{
	HistoStretch = VALUE_I;
	if (HistoStretch==0) HistoStretch = 200;
	return(1);
	}

int _CMD_subdirs(char *arg, char *val, int bval)
	{
	BOOLEAN(SubDirs);
	return(1);
	}

int _CMD_subregion(char *arg, char *val, int bval)
	{
	// subregion specifies a region to be used after the image has been centered
	// and cutout. This subregion replaces the centered image
	int x1,y1,x2,y2;
	char fname[512];
	if (sscanf(val,"%d,%d,%d,%d",&x1,&y1,&x2,&y2) != 4) {
	   printf("-subregion: Invalid format, should be -subregion=x1,y1,x2,y2\n");
	   FAIL;
	   }
	EnableSubRegion = 1;
	SR_X1 = x1;
	SR_X2 = x2;
	SR_Y1 = y1;
	SR_Y2 = y2;
	DoCutout=0;
	return(1);
	}

int _CMD_subsample_max_offset(char *arg, char *val, int bval)
	{
	Subsample_max_offset = VALUE_F;
	return(1);
	}

int _CMD_subsample_min_offset(char *arg, char *val, int bval)
	{
	Subsample_min_offset = VALUE_F;
	return(1);
	}

int _CMD_subsample_nframes(char *arg, char *val, int bval)
	{
	Subsample_nframes = VALUE_I;
	return(1);
	}

int _CMD_subsample_noise(char *arg, char *val, int bval)
	{
	Subsample_noise = VALUE_I;
	return(1);
	}

int _CMD_subsample_pixel_height(char *arg, char *val, int bval)
	{
	Subsample_pixel_height = VALUE_I;
	return(1);
	}

int _CMD_subsample_pixel_size(char *arg, char *val, int bval)
	{
	Subsample_pixel_height = Subsample_pixel_width = VALUE_I;
	return(1);
	}

int _CMD_subsample_pixel_width(char *arg, char *val, int bval)
	{
	Subsample_pixel_width = VALUE_I;
	return(1);
	}

int _CMD_subsample_prefix(char *arg, char *val, int bval)
	{
	Subsample_prefix = strdup(VALUE_S);
	return(1);
	}

int _CMD_subsample_scan(char *arg, char *val, int bval)
	{
	BOOLEAN(Subsample_scan);
	return(1);
	}

int _CMD_subsample_smooth(char *arg, char *val, int bval)
	{
	Subsample_smooth = VALUE_I;
	return(1);
	}

int _CMD_subsample_upscale(char *arg, char *val, int bval)
	{
	Subsample_upscale = VALUE_I;
	return(1);
	}

int _CMD_subsample_xpixels(char *arg, char *val, int bval)
	{
	Subsample_xpixels= VALUE_I;
	return(1);
	}

int _CMD_subsample_ypixels(char *arg, char *val, int bval)
	{
	Subsample_ypixels= VALUE_I;
	return(1);
	}

int _CMD_subsamplemode(char *arg, char *val, int bval)
	{
       SubsampleMode = VALUE_I;
       NoSave = 1;
	return(1);
	}

int _CMD_threshhold(char *arg, char *val, int bval)
	{
	int t = VALUE_I;
	if (t<5 || t > 250) {
	   Print("Threshhold %d out of allowed range 5..250\n",t);
	   FAIL;
	   }
	ThreshHold = t;
	return(1);
	}

int _CMD_upscale(char *arg, char *val, int bval)
	{
	char *ptr = strstr(VALUE_S,"/");
	int up=1,down=1;
	if (ptr) {
	   *ptr = 0;
	   down = atoi(ptr+1);
	   }
	up = VALUE_I;
	if (up < 1 || up > 6 || down<1 || down>6) {
	   Print("UpScale: %d/%d out of accepted range (1..6)/(1..6) \n",up,down);
	   FAIL;
	   }
	UpScale = up;
	DownScale = down;
 	if (UpScale_Smoothing < 0) {
             double scalef = (double)UpScale / (double) DownScale;
             if (scalef <= 2) UpScale_Smoothing = 0;
	     else UpScale_Smoothing = 1;
	     }
	return(1);
	}

int _CMD_white(char *arg, char *val, int bval)
	{
	White = VALUE_I;
	return(1);
	}

int _CMD_width(char *arg, char *val, int bval)
	{
	newWidth = VALUE_I;
	if (newWidth < 100 || newWidth>10000) {
	   Print("Width must be 100..10000\n");
	   FAIL;
	   }
	return(1);
	}

int _CMD_writeemptyfiles(char *arg, char *val, int bval)
	{
	BOOLEAN(forceWriteEmptyFiles);
	BOOLEAN(WriteEmptyFiles);
	return(1);
	}

int _CMD_zblack(char *arg, char *val, int bval)
	{
	ZBlack = VALUE_I;
	return(1);
	}

int _HLP__CMD_zblack(char *arg, char *val, int bval)
	{
	Print("\nHelp for '%s'\n\n","zblack");
	Print("	Used when decompressing .ftz archives, sets the background default\n");
	Print("	pixel brightness. range 0..255\n");
	exit(0);
	}



struct cfunc Names[] = {
	{"amean" , _CMD_amean },
	{"help-amean" , _HLP__CMD_amean },
	{"archiveoverridefilenames" , _CMD_archiveoverridefilenames },
	{"help-archiveoverridefilenames" , _HLP__CMD_archiveoverridefilenames },
	{"bayer8" , _CMD_bayer8 },
	{"bayer_x" , _CMD_bayer_x },
	{"bayer_y" , _CMD_bayer_y },
	{"bayerboost" , _CMD_bayerboost },
	{"centrefunc" , _CMD_centrefunc },
	{"help-centrefunc" , _HLP__CMD_centrefunc },
	{"chain" , _CMD_chain },
	{"help-chain" , _HLP__CMD_chain },
	{"config" , _CMD_config },
	{"count" , _CMD_count },
	{"cut" , _CMD_cut },
	{"cutout" , _CMD_enablecutout },
	{"help-cutout" , _HLP__CMD_enablecutout },
	{"cutx" , _CMD_cutx },
	{"cuty" , _CMD_cuty },
	{"darkframe" , _CMD_darkframe },
	{"dbf" , _CMD_detectbrokenframes },
	{"help-dbf" , _HLP__CMD_detectbrokenframes },
	{"dbf-diff" , _CMD_dbf_diff },
	{"dbfedgecount" , _CMD_dbfedgecount },
	{"help-dbfedgecount" , _HLP__CMD_dbfedgecount },
	{"debayer" , _CMD_debayer },
	{"debug" , _CMD_debug },
	{"default-config" , _CMD_default_config },
	{"detectbrokenframes" , _CMD_detectbrokenframes },
	{"help-detectbrokenframes" , _HLP__CMD_detectbrokenframes },
	{"detecthotpixels" , _CMD_detecthotpixels },
	{"dhp" , _CMD_detecthotpixels },
	{"display" , _CMD_display },
	{"dofft" , _CMD_dofft },
	{"enablecutout" , _CMD_enablecutout },
	{"help-enablecutout" , _HLP__CMD_enablecutout },
	{"fft-filter" , _CMD_fft_filter },
	{"fft-ref" , _CMD_fft_ref },
	{"fft-scan" , _CMD_fft_scan },
	{"fft_scan" , _CMD_fft_scan },
	{"flux" , _CMD_flux },
	{"forceprocess" , _CMD_forceprocess },
	{"gain" , _CMD_gain },
	{"gaincomp" , _CMD_gaincomp },
	{"gamma" , _CMD_gamma },
	{"grey" , _CMD_grey },
	{"help-grey" , _HLP__CMD_grey },
	{"height" , _CMD_height },
	{"help" , _CMD_help },
	{"hinvert" , _CMD_mirror },
	{"help-hinvert" , _HLP__CMD_mirror },
	{"histo-warning" , _CMD_histo_warning },
	{"help-histo-warning" , _HLP__CMD_histo_warning },
	{"hnoisefilter" , _CMD_hnoisefilter },
	{"i" , _CMD_i },
	{"help-i" , _HLP__CMD_i },
	{"ifd" , _CMD_inputfilter_display },
	{"help-ifd" , _HLP__CMD_inputfilter_display },
	{"ift" , _CMD_input_type },
	{"ini" , _CMD_config },
	{"inifile" , _CMD_config },
	{"input-type" , _CMD_input_type },
	{"inputfilter" , _CMD_inputfilter },
	{"help-inputfilter" , _HLP__CMD_inputfilter },
	{"inputfilter-display" , _CMD_inputfilter_display },
	{"help-inputfilter-display" , _HLP__CMD_inputfilter_display },
	{"invert" , _CMD_invert },
	{"iquant" , _CMD_iquant },
	{"istretch" , _CMD_istretch },
	{"levels" , _CMD_levels },
	{"ma" , _CMD_morph_across },
	{"maxq" , _CMD_qfunc },
	{"md" , _CMD_morph_down },
	{"mdbg" , _CMD_morph_de },
	{"mdebug" , _CMD_morph_de },
	{"mean3" , _CMD_mean3 },
	{"help-mean3" , _HLP__CMD_mean3 },
	{"mergefile" , _CMD_mergefile },
	{"mergethreshhold" , _CMD_mergethreshhold },
	{"mi" , _CMD_morph_it },
	{"minpixels" , _CMD_minpixels },
	{"mirror" , _CMD_mirror },
	{"help-mirror" , _HLP__CMD_mirror },
	{"mkdirs" , _CMD_mkdirs },
	{"help-mkdirs" , _HLP__CMD_mkdirs },
	{"morph-across" , _CMD_morph_across },
	{"morph-de" , _CMD_morph_de },
	{"morph-down" , _CMD_morph_down },
	{"morph-dr" , _CMD_morph_dr },
	{"morph-drift" , _CMD_morph_dr },
	{"morph-it" , _CMD_morph_it },
	{"morph-iterations" , _CMD_morph_it },
	{"morph-max-translate" , _CMD_morph_max_translate },
	{"morph-min-divisor" , _CMD_morph_min_divisor },
	{"morph-ref" , _CMD_morph_ref },
	{"morph_across" , _CMD_morph_across },
	{"morph_debug" , _CMD_morph_de },
	{"morph_down" , _CMD_morph_down },
	{"morph_drift" , _CMD_morph_dr },
	{"morph_it" , _CMD_morph_it },
	{"morph_iterations" , _CMD_morph_it },
	{"morph_max_translate" , _CMD_morph_max_translate },
	{"morph_min_divisor" , _CMD_morph_min_divisor },
	{"morph_ref" , _CMD_morph_ref },
	{"morphing" , _CMD_morphing },
	{"mr" , _CMD_morph_ref },
	{"mx" , _CMD_morph_max_translate },
	{"nocutout" , _CMD_nocutout },
	{"help-nocutout" , _HLP__CMD_nocutout },
	{"nosave" , _CMD_nosave },
	{"ob" , _CMD_histo_warning },
	{"help-ob" , _HLP__CMD_histo_warning },
	{"od" , _CMD_output_depth },
	{"oft" , _CMD_output_type },
	{"osd" , _CMD_output_stack_depth },
	{"outdir" , _CMD_outdir },
	{"output-depth" , _CMD_output_depth },
	{"output-stack-depth" , _CMD_output_stack_depth },
	{"output-type" , _CMD_output_type },
	{"overbright" , _CMD_histo_warning },
	{"help-overbright" , _HLP__CMD_histo_warning },
	{"overwrite" , _CMD_overwrite },
	{"popfilter" , _CMD_popfilter },
	{"process" , _CMD_process },
	{"help-process" , _HLP__CMD_process },
	{"protect" , _CMD_protect },
	{"qc" , _CMD_qcount },
	{"qcount" , _CMD_qcount },
	{"qe" , _CMD_qestimator },
	{"qestimator" , _CMD_qestimator },
	{"qf" , _CMD_qfunc },
	{"qfunc" , _CMD_qfunc },
	{"qhistfile" , _CMD_qhistfile },
	{"qhisto" , _CMD_qhisto },
	{"qmargin" , _CMD_qmargin },
	{"qrenumber" , _CMD_renumber },
	{"qsort" , _CMD_renumber },
	{"qtrim" , _CMD_qtrim },
	{"quiet" , _CMD_quiet },
	{"qwrite" , _CMD_qwrite },
	{"renumber" , _CMD_renumber },
	{"resample" , _CMD_upscale },
	{"rescale" , _CMD_upscale },
	{"rotate" , _CMD_rotate },
	{"rotatecutoff" , _CMD_rotatecutoff },
	{"runfile" , _CMD_runfile },
	{"scan" , _CMD_scan },
	{"smoothing" , _CMD_smoothing },
	{"stack" , _CMD_stack },
	{"stackcount" , _CMD_stackcount },
	{"stackfile" , _CMD_stack },
	{"streamfilter" , _CMD_streamfilter },
	{"stretch" , _CMD_stretch },
	{"subdirs" , _CMD_subdirs },
	{"subregion" , _CMD_subregion },
	{"subsample_max_offset" , _CMD_subsample_max_offset },
	{"subsample_min_offset" , _CMD_subsample_min_offset },
	{"subsample_nframes" , _CMD_subsample_nframes },
	{"subsample_noise" , _CMD_subsample_noise },
	{"subsample_pixel_height" , _CMD_subsample_pixel_height },
	{"subsample_pixel_size" , _CMD_subsample_pixel_size },
	{"subsample_pixel_width" , _CMD_subsample_pixel_width },
	{"subsample_prefix" , _CMD_subsample_prefix },
	{"subsample_scan" , _CMD_subsample_scan },
	{"subsample_smooth" , _CMD_subsample_smooth },
	{"subsample_upscale" , _CMD_subsample_upscale },
	{"subsample_xpixels" , _CMD_subsample_xpixels },
	{"subsample_ypixels" , _CMD_subsample_ypixels },
	{"subsamplemode" , _CMD_subsamplemode },
	{"threshhold" , _CMD_threshhold },
	{"trim" , _CMD_qtrim },
	{"upsample" , _CMD_upscale },
	{"upscale" , _CMD_upscale },
	{"white" , _CMD_white },
	{"width" , _CMD_width },
	{"writeemptyfiles" , _CMD_writeemptyfiles },
	{"zblack" , _CMD_zblack },
	{"help-zblack" , _HLP__CMD_zblack },
	{ "", NULL }};

int ShowGlobals()
	{
	Print("[ninox]\n");
	Print("AllowOverwrite=%d\n",AllowOverwrite);
	Print("AMean=%d\n",AMean);
	Print("ApplyGainComp=%d\n",ApplyGainComp);
	Print("ArchiveOverrideFilenames=%d\n",ArchiveOverrideFilenames);
	Print("Bayer8=%d\n",Bayer8);
	Print("BayerBoost=%lf\n",BayerBoost);
	Print("BayerX=%d\n",BayerX);
	Print("BayerY=%d\n",BayerY);
	Print("CentreMode=%d\n",CentreMode);
	Print("ChainArchives=%d\n",ChainArchives);
	Print("ChangeGain=%d\n",ChangeGain);
	Print("ChangeGamma=%d\n",ChangeGamma);
	Print("cur_Sub_x=%d\n",cur_Sub_x);
	Print("cur_Sub_y=%d\n",cur_Sub_y);
	Print("CurrentFile=%s\n",CurrentFile);
	Print("CutX=%d\n",CutX);
	Print("CutY=%d\n",CutY);
	Print("DarkFrame=%s\n",DarkFrame);
	Print("DarkFrame_Scale=%lf\n",DarkFrame_Scale);
	Print("DBF_DIFF=%d\n",DBF_DIFF);
	Print("DBF_EDGE_COUNT=%d\n",DBF_EDGE_COUNT);
	Print("DBF_TYPE=%d\n",DBF_TYPE);
	Print("DEBUG=%d\n",DEBUG);
	Print("DetectBrokenFrames=%d\n",DetectBrokenFrames);
	Print("DetectHotPixels=%d\n",DetectHotPixels);
	Print("DisplayFrames=%d\n",DisplayFrames);
	Print("DisplayPause=%d\n",DisplayPause);
	Print("Do3x3Smooth=%d\n",Do3x3Smooth);
	Print("do_Rotate=%d\n",do_Rotate);
	Print("DoCutout=%d\n",DoCutout);
	Print("DoDeBayer=%d\n",DoDeBayer);
	Print("DoFFT=%d\n",DoFFT);
	Print("doInvertImage=%d\n",doInvertImage);
	Print("doLevelsAdjust=%d\n",doLevelsAdjust);
	Print("doMirrorImage=%d\n",doMirrorImage);
	Print("DownScale=%d\n",DownScale);
	Print("EnableHistoWarning=%d\n",EnableHistoWarning);
	Print("EnableSubRegion=%d\n",EnableSubRegion);
	Print("FFT_Filter=%d\n",FFT_Filter);
	Print("FFT_LPF_Pow=%lf\n",FFT_LPF_Pow);
	Print("FFT_LPF_Radius1=%lf\n",FFT_LPF_Radius1);
	Print("FFT_LPF_Radius2=%lf\n",FFT_LPF_Radius2);
	Print("FFT_Ref=%s\n",FFT_Ref);
	Print("FFT_Region=%d\n",FFT_Region);
	Print("FluxFile=%s\n",FluxFile);
	Print("ForceProcess=%d\n",ForceProcess);
	Print("forceWriteEmptyFiles=%d\n",forceWriteEmptyFiles);
	Print("Gain=%lf\n",Gain);
	Print("Gamma=%lf\n",Gamma);
	Print("Grey=%d\n",Grey);
	Print("HaveWindow=%d\n",HaveWindow);
	Print("HistoProtect=%d\n",HistoProtect);
	Print("HistoStretch=%d\n",HistoStretch);
	Print("HNoiseFilter=%d\n",HNoiseFilter);
	Print("ImageCount=%d\n",ImageCount);
	Print("InputFileType=%d\n",InputFileType);
	Print("InputFilter=%d\n",InputFilter);
	Print("InputFilter_Display=%d\n",InputFilter_Display);
	Print("InputFilter_ThreshHold=%lf\n",InputFilter_ThreshHold);
	Print("InputHistoStretch=%d\n",InputHistoStretch);
	Print("InteractiveMode=%d\n",InteractiveMode);
	Print("IQuant=%d\n",IQuant);
	Print("LevelsMax=%d\n",LevelsMax);
	Print("LevelsMin=%d\n",LevelsMin);
	Print("LoadedConfig=%d\n",LoadedConfig);
	Print("MergeFile=%s\n",MergeFile);
	Print("MergeThreshHold=%lf\n",MergeThreshHold);
	Print("MinPixels=%d\n",MinPixels);
	Print("MkDirs=%d\n",MkDirs);
	Print("Morph_Across=%d\n",Morph_Across);
	Print("Morph_Debug=%d\n",Morph_Debug);
	Print("Morph_Down=%d\n",Morph_Down);
	Print("Morph_Drift=%d\n",Morph_Drift);
	Print("Morph_Iterations=%d\n",Morph_Iterations);
	Print("Morph_MaxTranslate=%d\n",Morph_MaxTranslate);
	Print("Morph_Min_Divisor=%d\n",Morph_Min_Divisor);
	Print("Morph_Ref=%s\n",Morph_Ref);
	Print("Morphing=%d\n",Morphing);
	Print("newHeight=%d\n",newHeight);
	Print("newWidth=%d\n",newWidth);
	Print("NoSave=%d\n",NoSave);
	Print("OutDir=%s\n",OutDir);
	Print("OutputFileDepth=%d\n",OutputFileDepth);
	Print("OutputFileType=%d\n",OutputFileType);
	Print("OutputStackFileDepth=%d\n",OutputStackFileDepth);
	Print("PopFilter=%d\n",PopFilter);
	Print("PopFilter_When=%d\n",PopFilter_When);
	Print("ProcessOffset=%d\n",ProcessOffset);
	Print("ProcessSkip=%d\n",ProcessSkip);
	Print("QEstimator=%d\n",QEstimator);
	Print("QHISTO_FILE=%s\n",QHISTO_FILE);
	Print("QHISTO_MAX=%d\n",QHISTO_MAX);
	Print("QHISTO_MIN=%d\n",QHISTO_MIN);
	Print("QMargin=%lf\n",QMargin);
	Print("QRenumberFiles=%d\n",QRenumberFiles);
	Print("QSUBSAMPLE_INC=%d\n",QSUBSAMPLE_INC);
	Print("QSUBSAMPLE_MAX=%d\n",QSUBSAMPLE_MAX);
	Print("QSUBSAMPLE_MIN=%d\n",QSUBSAMPLE_MIN);
	Print("QTrim_After=%d\n",QTrim_After);
	Print("QTrim_Before=%d\n",QTrim_Before);
	Print("QualityFunction=%d\n",QualityFunction);
	Print("QualityMaxCount=%d\n",QualityMaxCount);
	Print("Quiet=%d\n",Quiet);
	Print("QWriteIntermediateFiles=%d\n",QWriteIntermediateFiles);
	Print("RotateAngle=%lf\n",RotateAngle);
	Print("RotateCutoff=%d\n",RotateCutoff);
	Print("RunFile=%s\n",RunFile);
	Print("SR_X1=%d\n",SR_X1);
	Print("SR_X2=%d\n",SR_X2);
	Print("SR_Y1=%d\n",SR_Y1);
	Print("SR_Y2=%d\n",SR_Y2);
	Print("StackCount=%d\n",StackCount);
	Print("StackFile=%s\n",StackFile);
	Print("StackMax=%d\n",StackMax);
	Print("StreamFilter=%d\n",StreamFilter);
	Print("StreamFilter_History=%d\n",StreamFilter_History);
	Print("Sub_x=%d\n",Sub_x);
	Print("Sub_y=%d\n",Sub_y);
	Print("SubDirs=%d\n",SubDirs);
	Print("Subsample_max_offset=%lf\n",Subsample_max_offset);
	Print("Subsample_min_offset=%lf\n",Subsample_min_offset);
	Print("Subsample_nframes=%d\n",Subsample_nframes);
	Print("Subsample_noise=%d\n",Subsample_noise);
	Print("Subsample_pixel_height=%d\n",Subsample_pixel_height);
	Print("Subsample_pixel_width=%d\n",Subsample_pixel_width);
	Print("Subsample_prefix=%s\n",Subsample_prefix);
	Print("Subsample_scan=%d\n",Subsample_scan);
	Print("Subsample_smooth=%d\n",Subsample_smooth);
	Print("Subsample_upscale=%d\n",Subsample_upscale);
	Print("Subsample_xpixels=%d\n",Subsample_xpixels);
	Print("Subsample_ypixels=%d\n",Subsample_ypixels);
	Print("SubsampleMode=%d\n",SubsampleMode);
	Print("SumFlux=%d\n",SumFlux);
	Print("ThreshHold=%d\n",ThreshHold);
	Print("UpScale=%d\n",UpScale);
	Print("UpScale_Smoothing=%d\n",UpScale_Smoothing);
	Print("UpScale_Smoothing_When=%d\n",UpScale_Smoothing_When);
	Print("White=%d\n",White);
	Print("WriteEmptyFiles=%d\n",WriteEmptyFiles);
	Print("ZBlack=%d\n",ZBlack);
	}
