⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 play.c

📁 接收Fax的程序
💻 C
字号:
/*** (c) 1992 Uwe C. Schroeder, Anwendungssysteme , Augsburg, Germany**** ** Permission to use, copy, and modify this software and its** documentation for non comercial  purpose is hereby granted ** without fee, provided that** the above copyright notice appear in all copies and that both that** copyright notice and this permission notice appear in supporting** documentation, and that the name of Uwe C. Schroeder not be used in** advertising or publicity pertaining to distribution of the software without** specific, written prior permission.  Uwe Schroeder makes no representations** about the suitability of this software for any purpose.  It is provided** "as is" without express or implied warranty.** This software may not be sold or distributed with commercial products** ( this includes distribution "for users convenience" ) without prior** written permission by the author.**** UWE SCHROEDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,** INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO** EVENT SHALL UWE SCHROEDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,** DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR** PERFORMANCE OF THIS SOFTWARE.****** This is a alpha release, which means, that there are still several** known bugs.**** Please report bugs to:****                     usys@phoenix.abg.sub.org***/#include <stdio.h>#include <fcntl.h>#include <unistd.h>#include <termio.h>#include "vfax.h"extern int local;extern int fd;play(fnam)     char *fnam;{  int kbd, x, y;  FILE *in;  char msg[512];  char cmd[20];  char buf;  char lookup;  char k;  unsigned long flen;  if((in = fopen(fnam,"r")) == 0)    {      Debug(2,"play: open of %s failed\r\n",fnam);      sprintf(msg,"%s/opfail.v",MSGDIR);      if((in = fopen(msg,"r")) == 0)	{	  Debug(2,"play: open of %s failed\r\n",msg);	  return;	}    }  writecmd("AT+VTX");  if(getret("CONNECT"))    {      k=100;      while(!feof(in))	{	  if(k<=0) { /* check XON XOFF */	  again:	    if(read(fd,&lookup,1)<0){ k=100; continue;}	    switch(lookup){	    case DLE: 	      /* there must be another char after DLE,		 so block the read */	      ttyread(&lookup,1);	      switch(lookup){	      case XOF:		goto again;	      case XON:		k=100;		continue;	      default:		Debug(1,"Got DLE %c\n",lookup);		break;	      }	      break;	    case XOF:	      goto again;	    case XON:	      k=100;	      continue;	    default:	      k=100;	      continue;	    }	  }	  k--;	  buf=fgetc(in);	  write ( fd, & buf, 1 ) ;	}    }  writech(DLE);  writech(ETX);  getret("VCON");  fclose(in);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -