コード例 #1
0
void
do_command(char c)
{
	switch (c) {
	case '.':
	case '\004': /* ^D */
		event_loopexit(NULL);
		break;
	case '\032': /* ^Z */
		restore_termios();
		kill(getpid(), SIGTSTP);
		set_termios();
		break;
	case 'C':
		connect_command();
		break;
	case 'D':
		ioctl(line_fd, TIOCCDTR, NULL);
		sleep(1);
		ioctl(line_fd, TIOCSDTR, NULL);
		break;
	case 'R':
		start_record();
		break;
	case 'S':
		set_speed();
		break;
	case 'X':
		send_xmodem();
		break;
	case '$':
		pipe_command();
		break;
	case '>':
		send_file();
		break;
	case '#':
		ioctl(line_fd, TIOCSBRK, NULL);
		sleep(1);
		ioctl(line_fd, TIOCCBRK, NULL);
		break;
	case '~':
		bufferevent_write(line_ev, "~", 1);
		break;
	case '?':
		printf("\r\n"
		    "~#      send break\r\n"
		    "~$      pipe local command to remote host\r\n"
		    "~>      send file to remote host\r\n"
		    "~C      connect program to remote host\r\n"
		    "~D      de-assert DTR line briefly\r\n"
		    "~R      start recording to file\r\n"
		    "~S      set speed\r\n"
		    "~X      send file with XMODEM\r\n"
		    "~?      get this summary\r\n"
		);
		break;
	}
}
コード例 #2
0
ファイル: TRANSFER.C プロジェクト: daemqn/Atari_ST_Sources
datei_senden(void)
{
int hd;

    if (fsel("*.*",tbuf,"Datei senden") == 1){
        strcpy((char *)transfer[UEBERSCH].ob_spec,"Datei senden");
/*        v_gtext(handle,640-13*8,13,"S");*/
        open_dial(1);
        if ((hd=Fopen(tbuf,0)) > 0) {
            show_msg(send_xmodem(hd));
            Fclose(hd);
        }
        open_dial(0);
    }
}
コード例 #3
0
ファイル: TRANSFER.C プロジェクト: daemqn/Atari_ST_Sources
do_batch(void)
{
int hd,sec,hd2;
char line[80],*l;
long timer;

    if (fsel("*.TTB",tbuf,"Batch starten") == 1){
        if ((hd=Fopen(tbuf,0)) > 0) {
            while (readline(hd,line)){
                l=line;
                while (*l++ > 32);
                *(l-1)=0;
                strupr(line);
                if (!strcmp(line,"DIAL")) {
                    if (call_modem(-1,l)) break;
                    else continue;
                }
                if (!strcmp(line,"WAIT")) {
                    sec=atoi(l);
                    timer=get_timer();
                    while ((get_timer()-timer) < (sec*200))
                        evnt_timer(0,0);
                    continue;
                }
                if (!strcmp(line,"RWAIT")) {
                    if (rwait(l) == 0) continue;
                    else break;
                }
                if (!strcmp(line,"SEND")) {
                    while(*l) send(*l++);
                    send(13);
                    continue;
                }
                if (!strcmp(line,"END")) {
                    break;
                }
                if (!strcmp(line,"BAUDRATE")) {
                    continue;
                }
                if (!strcmp(line,"UPLOAD")) {
                    if (*l == 'X') {
                        para.blklen=128;
                        para.chk=CHKSUM;
                    }
                    if (*l == 'Y') {
                        para.blklen=1024;
                        para.chk=CRC;
                    }
                    while (*l++ > 32);
                    *(l-1)=0;
                    open_dial(1);
                    if ((hd2=Fopen(l,0)) > 0) {
                        send_xmodem(hd2);
                        Fclose(hd2);
                    }
                    open_dial(0);
                }   
                if (!strcmp(line,"DOWNLOAD")) {
                    if (*l == 'X') {
                        para.blklen=128;
                        para.chk=CHKSUM;
                    }
                    if (*l == 'Y') {
                        para.blklen=1024;
                        para.chk=CRC;
                    }
                    while (*l++ > 32);
                    *(l-1)=0;
                    open_dial(1);
                    if ((hd2=Fcreate(l,0)) > 0) {
                        receive_xmodem(hd2);
                        Fclose(hd2);
                    }
                    open_dial(0);
                }   
            }
            Fclose(hd);
        }
    }
}