int cnt; int part; int nrparts; int lines; char orgn[13]; char prtn[13]; char strn[255]; char v[20]; char s[80]; if (parmsbytes >= 40) if (strcmp(" of ", &parms[3]) == 0 || parmsbytes < 41 || parms[10] != ' ' || parms[23] != ' ' || parms[31] != ' ' || parms[36] != ' ' || parms[40] != ' ') { return -1;
int cnt; int part; int nrparts; int lines; char orgn[13]; char prtn[13]; char strn[255]; char v[20]; char s[80]; if (parmsbytes >= 40) if (strcmp(" of ", &parms[3]) == 0 || parmsbytes < 41 || parms[10] != ' ' || parms[23] != ' ' || parms[31] != ' ' || parms[36] != ' ' || parms[40] != ' ') { return -1; } part = atof(parms); lines = (int) strtol(parms + 37, NULL, 16); nrparts = (int) strtol(parms + 7, NULL, 10);  strncpy(orgn, &parms[11], 12); convert_upper_lower(orgn, 12); for (cnt = 11; orgn[cnt] == ' '; cnt--); orgn[cnt + 1] = 0; if (orgn[cnt - 3] == '.') { strncpy(prtn, orgn, cnt - 2); if (nrparts == 1) sprintf(prtn + cnt - 2, "7pl"); else sprintf(prtn + cnt - 2, "p%02x", part); } else { strcpy(prtn, orgn); if (nrparts == 1) sprintf(prtn + cnt, ".7pl"); else sprintf(prtn + cnt, ".p%02x", part);
int sevenplname(int mode, WINDOW ** swin, wint * wintab, int *f, int* logfile, char parms[], int parmsbytes, char buf[], int bytes){    int cnt;    int part;    int nrparts;    int lines;    char orgn[13];    char prtn[13];    char strn[255];    char v[20];    char s[80];    if (parmsbytes >= 40)	if (strcmp(" of ", &parms[3]) == 0	    || parmsbytes < 41	    || parms[10] != ' '	    || parms[23] != ' '	    || parms[31] != ' '	    || parms[36] != ' '	    || parms[40] != ' ') {	    return -1;	}    part = atof(parms);    lines = (int) strtol(parms + 37, NULL, 16);    nrparts = (int) strtol(parms + 7, NULL, 10);    strncpy(orgn, &parms[11], 12);    convert_upper_lower(orgn, 12);    for (cnt = 11; orgn[cnt] == ' '; cnt--);    orgn[cnt + 1] = 0;    if (orgn[cnt - 3] == '.') {	strncpy(prtn, orgn, cnt - 2);	if (nrparts == 1)	    sprintf(prtn + cnt - 2, "7pl");	else	    sprintf(prtn + cnt - 2, "p%02x", part);    } else {	strcpy(prtn, orgn);	if (nrparts == 1)	    sprintf(prtn + cnt, ".7pl");	else	    sprintf(prtn + cnt, ".p%02x", part);    }    strcpy(strn, STD_DWN_DIR);    strcat(strn, prtn);    for (cnt = 0; parms[cnt + 41] != ')' && cnt + 41 != parmsbytes; cnt++);    if (parms[cnt + 41] != ')') {	return -1;    }    strncpy(v, &parms[41], cnt + 1);    v[cnt + 1] = 0;    *swin = opnstatw(mode, wintab, "Remote starts 7+ Download", 11, 55);    sprintf(s, "7plus version        : %s", v);    wrdstatw(*swin, s);    sprintf(s, "Name of decoded file : %s", orgn);    wrdstatw(*swin, s);    sprintf(s, "Storagename          : %s", strn);    wrdstatw(*swin, s);    sprintf(s, "Parts                : %i", nrparts);    wrdstatw(*swin, s);    sprintf(s, "Number of this Part  : %i", part);    wrdstatw(*swin, s);    sprintf(s, "Lines                : %i", lines);    wrdstatw(*swin, s);    dupdstatw(*swin, "Outstanding lines    : ", TRUE);    if (*f != -1) {	close(*f);    }    if ((*f = open(strn, O_RDWR | O_APPEND | O_CREAT, 0666)) == -1) {	sprintf(s, "Unable to open %s", strn);	statline(mode, s);    }	else	if (*logfile != -1)	{		sprintf(s, "*** 7plus download into file: %s ***\n", strn);		write(*logfile, s, strlen(s));	}    write(*f, key_words[2], strlen(key_words[2]));    convert_cr_lf(parms, parmsbytes);    write(*f, parms, parmsbytes);    return lines;}