SCCS-vsn: usr.bin/tn3270/sys_curses/system.c 1.5
{
struct storage_descriptor sd;
{
struct storage_descriptor sd;
- if (api_exch_incommand(EXCH_HEREIS) == -1) {
- fprintf(stderr, "Bad data from other side.\n");
- fprintf(stderr, "(Encountered at %s, %s.)\n", __FILE__, __LINE__);
- return -1;
- }
if (api_exch_intype(EXCH_TYPE_STORE_DESC, sizeof sd, (char *)&sd) == -1) {
storage_length = 0;
return -1;
if (api_exch_intype(EXCH_TYPE_STORE_DESC, sizeof sd, (char *)&sd) == -1) {
storage_length = 0;
return -1;
storage_length = 0;
return -1;
}
storage_length = 0;
return -1;
}
- if (api_exch_intype(EXCH_TYPE_BYTES, storage_length, (char *)storage) == -1) {
- storage_length = 0;
- return -1;
+ if (storage_length != 0) {
+ if (api_exch_intype(EXCH_TYPE_BYTES, storage_length, (char *)storage)
+ == -1) {
+ storage_length = 0;
+ return -1;
+ }
if (strcmp(crypt(buffer, pwent->pw_passwd), pwent->pw_passwd) == 0) {
if (api_exch_outcommand(EXCH_ASSOCIATED) == -1) {
return -1;
if (strcmp(crypt(buffer, pwent->pw_passwd), pwent->pw_passwd) == 0) {
if (api_exch_outcommand(EXCH_ASSOCIATED) == -1) {
return -1;
}
} else {
doreject("Invalid password");
sleep(10); /* Don't let us do too many of these */
}
} else {
doreject("Invalid password");
sleep(10); /* Don't let us do too many of these */
kill_connection();
return;
}
kill_connection();
return;
}
- if (api_exch_outtype(EXCH_TYPE_BYTES, storage_length, (char *)storage) == -1) {
- kill_connection();
- return;
+ if (storage_length != 0) {
+ if (api_exch_outtype(EXCH_TYPE_BYTES, storage_length, (char *)storage)
+ == -1) {
+ kill_connection();
+ return;
+ }
__FILE__, __LINE__);
quit();
}
__FILE__, __LINE__);
quit();
}
- if (storage_must_send == 0) {
- return;
- }
storage_must_send = 0;
if (api_exch_outcommand(EXCH_GIMME) == -1) {
kill_connection();
return -1;
}
storage_must_send = 0;
if (api_exch_outcommand(EXCH_GIMME) == -1) {
kill_connection();
return -1;
}
+ storage_location = address;
+ storage_length = length;
sd.location = htonl(storage_location);
sd.length = htons(storage_length);
if (api_exch_outtype(EXCH_TYPE_STORE_DESC, sizeof sd, (char *)&sd) == -1) {
kill_connection();
return -1;
}
sd.location = htonl(storage_location);
sd.length = htons(storage_length);
if (api_exch_outtype(EXCH_TYPE_STORE_DESC, sizeof sd, (char *)&sd) == -1) {
kill_connection();
return -1;
}
+ if (api_exch_incommand(EXCH_HEREIS) == -1) {
+ fprintf(stderr, "Bad data from other side.\n");
+ fprintf(stderr, "(Encountered at %s, %s.)\n", __FILE__, __LINE__);
+ return -1;
+ }
if (nextstore() == -1) {
kill_connection();
return -1;
if (nextstore() == -1) {
kill_connection();
return -1;
case CONNECTED:
if (api_exch_incommand(EXCH_REQUEST) == -1) {
kill_connection();
case CONNECTED:
if (api_exch_incommand(EXCH_REQUEST) == -1) {
kill_connection();
- } else if (api_exch_intype(EXCH_TYPE_BYTES, sizeof inputRegs,
+ } else if (api_exch_intype(EXCH_TYPE_REGS, sizeof inputRegs,
(char *)&inputRegs) == -1) {
kill_connection();
(char *)&inputRegs) == -1) {
kill_connection();
- } else if (api_exch_intype(EXCH_TYPE_BYTES, sizeof inputSregs,
+ } else if (api_exch_intype(EXCH_TYPE_SREGS, sizeof inputSregs,
(char *)&inputSregs) == -1) {
kill_connection();
} else if (nextstore() == -1) {
(char *)&inputSregs) == -1) {
kill_connection();
} else if (nextstore() == -1) {
freestorage(); /* Send any storage back */
if (api_exch_outcommand(EXCH_REPLY) == -1) {
kill_connection();
freestorage(); /* Send any storage back */
if (api_exch_outcommand(EXCH_REPLY) == -1) {
kill_connection();
- } else if (api_exch_outtype(EXCH_TYPE_BYTES, sizeof inputRegs,
+ } else if (api_exch_outtype(EXCH_TYPE_REGS, sizeof inputRegs,
(char *)&inputRegs) == -1) {
kill_connection();
(char *)&inputRegs) == -1) {
kill_connection();
- } else if (api_exch_outtype(EXCH_TYPE_BYTES, sizeof inputSregs,
+ } else if (api_exch_outtype(EXCH_TYPE_SREGS, sizeof inputSregs,
(char *)&inputSregs) == -1) {
kill_connection();
}
(char *)&inputSregs) == -1) {
kill_connection();
}
if (sock != -1) {
(void) close(sock);
sock = -1;
if (sock != -1) {
(void) close(sock);
sock = -1;
- printf("[Hit return to continue]");
- fflush(stdout);
- (void) gets(inputbuffer);
+ printf("[Hit return to continue]");
+ fflush(stdout);
+ (void) gets(inputbuffer);
setconnmode();
ConnectScreen(); /* Turn screen on (if need be) */
(void) close(serversock);
setconnmode();
ConnectScreen(); /* Turn screen on (if need be) */
(void) close(serversock);