char *p, *q, *remap = pointer_remap;
char *p, *q, *remap = strdup(pointer_remap);
void initialize_pointer_map(char *pointer_remap) {	unsigned char map[MAX_BUTTONS];	int i, k;	/*	 * This routine counts the number of pointer buttons on the X	 * server (to avoid problems, even crashes, if a client has more	 * buttons).  And also initializes any pointer button remapping	 * from -buttonmap option.	 */		X_LOCK;	num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS);	X_UNLOCK;	if (num_buttons < 0) {		num_buttons = 0;	}	/* FIXME: should use info in map[] */	for (i=1; i<= MAX_BUTTONS; i++) {		for (k=0; k < MAX_BUTTON_EVENTS; k++) {			pointer_map[i][k].end = 1;		}		pointer_map[i][0].keysym  = NoSymbol;		pointer_map[i][0].keycode = NoSymbol;		pointer_map[i][0].button = i;		pointer_map[i][0].end    = 0;		pointer_map[i][0].down   = 0;		pointer_map[i][0].up     = 0;	}	if (pointer_remap && *pointer_remap != '\0') {		/* -buttonmap, format is like: 12-21=2 */		char *p, *q, *remap = pointer_remap;			int n;		if ((p = strchr(remap, '=')) != NULL) {			/* undocumented max button number */			n = atoi(p+1);				*p = '\0';			if (n < num_buttons || num_buttons == 0) {				num_buttons = n;			} else {				rfbLog("warning: increasing number of mouse "				    "buttons from %d to %d\n", num_buttons, n);				num_buttons = n;			}		}		if ((q = strchr(remap, '-')) != NULL) {			/*			 * The '-' separates the 'from' and 'to' lists,			 * then it is kind of like tr(1).  			 */			char str[2];			int from;			rfbLog("remapping pointer buttons using string:\n");			rfbLog("   \"%s\"\n", remap);			p = remap;			q++;			i = 0;			str[1] = '\0';			while (*p != '-') {				str[0] = *p;				from = atoi(str);				buttonparse(from, &q);				p++;			}		}	}}