printf("\n");
gp->calc_crc = calc_crc(buf, *bytes, gp->calc_crc); gp->dwn_cnt -= *bytes;  if (gp->dwn_cnt == 0) { if (mode != RAWMODE) { delwin(swin); winclose(wintab); } else printf("\n");  strcpy(s, "AutoBin download finished "); if (gp->new_header) if (gp->calc_crc == gp->file_crc) strcat(s, "CRC check ok"); else { strcat(s, "CRC check failed!"); } else { sprintf(s + strlen(s), "CRC=%u", gp->calc_crc); } statline(mode, s); close(gp->dwn_file); utime(gp->file_name, &gp->ut); if (extrach != 0) { memmove(buf, buf + *bytes, extrach); *bytes = extrach; } else *bytes = 0; } else { sprintf(s, "%u", (unsigned int) gp->dwn_cnt); dupdstatw(swin, s, FALSE); *bytes = 0; }
int ab_down(int mode, WINDOW * swin, wint * wintab, char buf[], int *bytes, t_gp * gp){    int extrach = 0;    char s[80];    if (strncmp(buf, "#ABORT#\r", 8) == 0 && *bytes == 8) {	gp->dwn_cnt = 0;	close(gp->dwn_file);	statline(mode, "Remote aborts AutoBin transfer!");	*bytes = 0;	if (mode != RAWMODE) {	    delwin(swin);	    winclose(wintab);	} else {	    printf("\n");	}	return 0;    }    if (gp->dwn_cnt < *bytes) {	extrach = *bytes - gp->dwn_cnt;	*bytes = gp->dwn_cnt;    }    if (write(gp->dwn_file, buf, *bytes) != *bytes) {	close(gp->dwn_file);	gp->dwn_cnt = 0;	statline(mode, "Error while writing download file. Download aborted.");	if (mode != RAWMODE) {	    delwin(swin);	    winclose(wintab);	} else {	    printf("\n");	}    } else {	gp->calc_crc = calc_crc(buf, *bytes, gp->calc_crc);	gp->dwn_cnt -= *bytes;	if (gp->dwn_cnt == 0) {	    if (mode != RAWMODE) {		delwin(swin);		winclose(wintab);	    } else		printf("\n");	    strcpy(s, "AutoBin download finished ");	    if (gp->new_header)		if (gp->calc_crc == gp->file_crc)		    strcat(s, "CRC check ok");		else {		    strcat(s, "CRC check failed!");	    } else {		sprintf(s + strlen(s), "CRC=%u", gp->calc_crc);	    }	    statline(mode, s);	    close(gp->dwn_file);	    utime(gp->file_name, &gp->ut);	    if (extrach != 0) {		memmove(buf, buf + *bytes, extrach);		*bytes = extrach;	    } else		*bytes = 0;	} else {	    sprintf(s, "%u", (unsigned int) gp->dwn_cnt);	    dupdstatw(swin, s, FALSE);	    *bytes = 0;	}    }    return 0;}