char express_msgs = 0; /* express messages waiting! */
char last_paged[32]="";
+jmp_buf jmp_reconnect; /* for server reconnects */
+char re_username[32];
+char re_password[32];
+
+void sigpipehandler(int nothing) {
+ printf("Longjumpfing with %d\n", nothing);
+ longjmp(jmp_reconnect, nothing);
+ }
+
/*
* here is our 'clean up gracefully and exit' routine
*/
serv_puts(buf);
serv_gets(buf);
printf("%s\n",&buf[4]);
+ strcpy(re_password, pass1);
return(0);
}
else {
int main(int argc, char **argv)
{
int a,b,mcmd;
-int termn8 = 0;
char aaa[100],bbb[100],ccc[100],eee[100]; /* general purpose variables */
char argbuf[32]; /* command line buf */
+int termn8 = 0;
sttybbs(SB_SAVE); /* Store the old terminal parameters */
formout("hello"); /* print the opening greeting */
printf("\n");
- /* if we're not the login shell, try auto-login */
-if (getppid()!=1) {
- serv_puts("AUTO");
- serv_gets(aaa);
- if (aaa[0]=='2') {
- load_user_info(&aaa[4]);
- goto PWOK;
- }
- }
-
GSTA: termn8=0; newnow=0;
do {
if (strlen(rc_username) > 0) {
}
/* sign on to the server */
+ strcpy(re_username, fullname);
snprintf(aaa,sizeof aaa,"USER %s",fullname);
serv_puts(aaa);
serv_gets(aaa);
serv_puts(aaa);
serv_gets(aaa);
if (aaa[0]=='2') {
+ strcpy(re_password, eee);
load_user_info(&aaa[4]);
goto PWOK;
}
else readmsgs(1,1,0);
do { /* MAIN LOOP OF PROGRAM */
+
+ /* Reconnect to the server if the connection was broken */
+ if (setjmp(jmp_reconnect)) {
+ attach_to_server(argc,argv);
+ serv_gets(aaa);
+ if (aaa[0]!='2') { printf("%s\n", &aaa[4]); exit(0); }
+ sprintf(aaa, "USER %s", re_username);
+ serv_puts(aaa);
+ serv_gets(aaa);
+ if (aaa[0]!='3') { printf("%s\n", &aaa[4]); exit(0); }
+ sprintf(aaa, "PASS %s", re_password);
+ serv_puts(aaa);
+ serv_gets(aaa);
+ if (aaa[0]!='2') { printf("%s\n", &aaa[4]); exit(0); }
+ load_user_info(&aaa[4]);
+ }
+ signal(SIGPIPE, sigpipehandler);
+
signal(SIGINT,SIG_IGN);
signal(SIGQUIT,SIG_IGN);
mcmd=getcmd(argbuf);
while(len<bytes) {
rlen = read(serv_sock,&buf[len],bytes-len);
if (rlen<1) {
- printf("\rNetwork error - connection terminated.\n");
- printf("%s\n", strerror(errno));
+ /* printf("\rNetwork error - connection terminated.\n");
+ printf("%s\n", strerror(errno)); */
logoff(3);
}
len = len + rlen;
retval = write(serv_sock, &buf[bytes_written],
nbytes - bytes_written);
if (retval < 1) {
+ /*
printf("\rNetwork error - connection terminated.\n");
- printf("%s\n", strerror(errno));
+ printf("%s\n", strerror(errno)); */
logoff(3);
}
bytes_written = bytes_written + retval;