-/*
- * $Log$
- * Revision 1.3 1999/06/03 11:46:41 short
- * Logging (--log) implemented.
- *
- * Revision 1.2 1999/06/03 10:38:52 short
- * Implemented remaining communication timeouts and maximum retry count.
- *
- * Revision 1.1.1.1 1999/05/26 13:06:26 short
- * First alpha release.
- *
- */
-
static char *devicename; /* path stripped */
static char lockreal[512],locked;
static char *devicename; /* path stripped */
static char lockreal[512],locked;
error("Can't convert character '%c' (0x%02X) at offs %d (0-based), substituted '?'",
c,(unsigned char)c,offs);
return('?');
error("Can't convert character '%c' (0x%02X) at offs %d (0-based), substituted '?'",
c,(unsigned char)c,offs);
return('?');
- if (verbose>=1)
- error("\nPlease enter the SMS text body, end with EOF (ctrl-D):");
+ if (!finame) {
+ if (verbose>=1)
+ error("\nPlease enter the SMS text body, end with EOF (ctrl-D):");
+ }
+ else {
+ if (!(fin=fopen(finame,"rt")))
+ error("!Can't open data file \"%s\" for r/o: %m",finame);
+ }
chk(body=malloc(BODYLOAD));
bodylen=fread(body,1,BODYLOAD,fin);
if (bodylen==-1)
error("!Error reading stream \"%s\": %m",(finame?finame:"<stdin>"));
chk(body=malloc(BODYLOAD));
bodylen=fread(body,1,BODYLOAD,fin);
if (bodylen==-1)
error("!Error reading stream \"%s\": %m",(finame?finame:"<stdin>"));
+ cfsetispeed(&tios,B19200);
+ if (cfsetospeed(&tios,B19200)|cfsetispeed(&tios,B19200))
+ error("Error setting termios baudrate on device: %m");
if (tcflush(devfd,TCIOFLUSH))
error("Error flushing termios (TCIOFLUSH) on device: %m");
if (tcsetattr(devfd,TCSANOW,&tios))
if (tcflush(devfd,TCIOFLUSH))
error("Error flushing termios (TCIOFLUSH) on device: %m");
if (tcsetattr(devfd,TCSANOW,&tios))
devcmd(NULL,NULL,"\r\nAT");
smscset();
devcmd(NULL,NULL,"\r\nAT+CMGF=0");
devcmd("\n> ",NULL,"\r\nAT+CMGS=%d",(strlen(pdusmsc)+strlen(pdudata))/2);
devcmd(NULL,NULL,"\r\nAT");
smscset();
devcmd(NULL,NULL,"\r\nAT+CMGF=0");
devcmd("\n> ",NULL,"\r\nAT+CMGS=%d",(strlen(pdusmsc)+strlen(pdudata))/2);
- if (!(s=devcmd(NULL,"\n+CMGS:","!%s%s\x1A",pdusmsc,pdudata))) retrying();
+ if (!(s=devcmd(NULL,"\n+CMGS:","!%s%s\032",pdusmsc,pdudata))) retrying();