rfbLog("bad -scale arg: %s\n", tstr);
rfbLogEnable(1); rfbLog("invalid -scale arg: %s\n", tstr);
void parse_scale_string(char *str, double *factor, int *scaling, int *blend,    int *nomult4, int *pad, int *interpolate, int *numer, int *denom) {	int m, n;	char *p, *tstr;	double f;	*factor = 1.0;	*scaling = 0;	*blend = 1;	*nomult4 = 0;	*pad = 0;	*interpolate = 0;	*numer = 0, *denom = 0;	if (str == NULL || str[0] == '\0') {		return;	}	tstr = strdup(str);		if ( (p = strchr(tstr, ':')) != NULL) {		/* options */		if (strstr(p+1, "nb") != NULL) {			*blend = 0;		}		if (strstr(p+1, "fb") != NULL) {			*blend = 2;		}		if (strstr(p+1, "n4") != NULL) {			*nomult4 = 1;		}		if (strstr(p+1, "in") != NULL) {			*interpolate = 1;		}		if (strstr(p+1, "pad") != NULL) {			*pad = 1;		}		if (strstr(p+1, "cr") != NULL) {			/* global */			got_scrollcopyrect = 1;			got_wirecopyrect = 1;		}		*p = '\0';	}	if (strchr(tstr, '.') != NULL) {		double test, diff, eps = 1.0e-7;		if (sscanf(tstr, "%lf", &f) != 1) {			rfbLog("bad -scale arg: %s\n", tstr);			clean_up_exit(1);		}		*factor = (double) f;		/* look for common fractions from small ints: */		for (n=2; n<=10; n++) {			for (m=1; m<n; m++) {				test = ((double) m)/ n;				diff = *factor - test;				if (-eps < diff && diff < eps) {					*numer = m;					*denom = n;					break;								}			}			if (*denom) {				break;			}		}		if (*factor < 0.01) {			rfbLog("-scale factor too small: %f\n", scale_fac);			clean_up_exit(1);		}	} else {		if (sscanf(tstr, "%d/%d", &m, &n) != 2) {			if (sscanf(tstr, "%d", &m) != 1) {				rfbLog("bad -scale arg: %s\n", tstr);				clean_up_exit(1);			} else {				/* e.g. -scale 1 or -scale 2 */				n = 1;			}		}		if (n <= 0 || m <=0) {			rfbLog("bad -scale arg: %s\n", tstr);			clean_up_exit(1);		}		*factor = ((double) m)/ n;		if (*factor < 0.01) {			rfbLog("-scale factor too small: %f\n", *factor);			clean_up_exit(1);		}		*numer = m;		*denom = n;	}	if (*factor == 1.0) {		if (! quiet) {			rfbLog("scaling disabled for factor %f\n", *factor);		}	} else {		*scaling = 1;	}	free(tstr);}