ftp_getdataport() should return a char with sprintf, not an int. The port member of ftp_t could then be the same as the port member of skod_t, negating the need for two different tcp_connect functions.