CTRACE(tfp, "HTFinger: Interrupted on connect; recovering cleanly.\n");
CTRACE((tfp, "HTFinger: Interrupted on connect; recovering cleanly.\n"));
PUBLIC int HTLoadFinger ARGS4(	CONST char *,		arg,	HTParentAnchor *,	anAnchor,	HTFormat,		format_out,	HTStream*,		stream){    char *username, *sitename, *colon;	/* Fields extracted from URL */    char *slash, *at_sign;		/* Fields extracted from URL */    char *command, *str;		/* Buffers */    int port;				/* Port number from URL */    int status;				/* tcp return */    CTRACE(tfp, "HTFinger: Looking for %s\n", (arg ? arg : "NULL"));    if (!(arg && *arg)) {	HTAlert(COULD_NOT_LOAD_DATA);	return HT_NOT_LOADED;			/* Ignore if no name */    }    if (!initialized)	initialized = initialize();    if (!initialized) {	HTAlert (gettext("Could not set up finger connection."));	return HT_NOT_LOADED;	/* FAIL */    }  {    CONST char * p1=arg;    BOOL IsGopherURL = FALSE;    /*  Set up the host and command fields.    */    if (!strncasecomp(arg, "finger://", 9)) {	p1 = arg + 9;  /* Skip "finger://" prefix */    } else if (!strncasecomp(arg, "gopher://", 9)) {	p1 = arg + 9;  /* Skip "gopher://" prefix */	IsGopherURL = TRUE;    }    sitename = (char *)p1;    if ((slash = strchr(sitename, '/')) != NULL) {	*slash++ = '\0';	HTUnEscape(slash);	if (IsGopherURL) {	    if (*slash != '0') {		HTAlert(COULD_NOT_LOAD_DATA);		return HT_NOT_LOADED;	/* FAIL */	    }	    *slash++ = '\0';	}    }    if ((at_sign = strchr(sitename, '@')) != NULL) {	if (IsGopherURL) {	    HTAlert(COULD_NOT_LOAD_DATA);	    return HT_NOT_LOADED;	/* FAIL */	}	*at_sign++ = '\0';	username = sitename;	sitename = at_sign;	HTUnEscape(username);    } else if (slash) {	username = slash;    } else {	username = "";    }    if (*sitename == '\0') {	HTAlert(gettext("Could not load data (no sitename in finger URL)"));	return HT_NOT_LOADED;		/* Ignore if no name */    }    if ((colon = strchr(sitename, ':')) != NULL) {	*colon++ = '\0';	port = atoi(colon);	if (port != 79) {	    HTAlert(gettext("Invalid port number - will only use port 79!"));	    return HT_NOT_LOADED;	/* Ignore if wrong port */	}    }    /* Load the string for making a connection/    */    str = 0;    HTSprintf0(&str, "lose://%s/", sitename);    /* Load the command for the finger server.    */    command = 0;    if (at_sign && slash) {	if (*slash == 'w' || *slash == 'W') {	    HTSprintf0(&command, "/w %s%c%c", username, CR, LF);	} else {	    HTSprintf0(&command, "%s%c%c", username, CR, LF);	}    } else if (at_sign) {	HTSprintf0(&command, "%s%c%c", username, CR, LF);    } else if (*username == '/') {	if ((slash = strchr((username+1), '/')) != NULL) {	    *slash = ' ';	}	HTSprintf0(&command, "%s%c%c", username, CR, LF);    } else if ((*username == 'w' || *username == 'W') &&	       *(username+1) == '/') {	if (*username+2 != '\0') {	    *(username+1) = ' ';	} else {	    *(username+1) = '\0';	}	HTSprintf0(&command, "/%s%c%c", username, CR, LF);    } else if ((*username == 'w' || *username == 'W') &&	       *(username+1) == '\0') {	HTSprintf0(&command, "/%s%c%c", username, CR, LF);    } else if ((slash = strchr(username, '/')) != NULL) {	*slash++ = '\0';	if (*slash == 'w' || *slash == 'W') {	    HTSprintf0(&command, "/w %s%c%c", username, CR, LF);	} else {	    HTSprintf0(&command, "%s%c%c", username, CR, LF);	}    } else {	HTSprintf0(&command, "%s%c%c", username, CR, LF);    }  } /* scope of p1 */    /* Now, let's get a stream setup up from the FingerHost:    ** CONNECTING to finger host    */    CTRACE(tfp, "HTFinger: doing HTDoConnect on '%s'\n", str);    status = HTDoConnect(str, "finger", FINGER_PORT, &s);    CTRACE(tfp, "HTFinger: Done DoConnect; status %d\n", status);    if (status == HT_INTERRUPTED) {	/* Interrupt cleanly */	CTRACE(tfp, "HTFinger: Interrupted on connect; recovering cleanly.\n");	HTProgress (CONNECTION_INTERRUPTED);	FREE(str);	FREE(command);	return HT_NOT_LOADED;    }    if (status < 0) {	NETCLOSE(s);	s = -1;	CTRACE(tfp, "HTFinger: Unable to connect to finger host.\n");	HTAlert(gettext("Could not access finger host."));	FREE(str);	FREE(command);	return HT_NOT_LOADED;	/* FAIL */    }    CTRACE(tfp, "HTFinger: Connected to finger host '%s'.\n", str);    FREE(str);    /* Send the command, and process response if successful.    */    if (response(command, sitename, anAnchor, format_out, stream) != 0) {	HTAlert(gettext("No response from finger server."));	FREE(command);	return HT_NOT_LOADED;    }    FREE(command);    return HT_LOADED;}