X-Git-Url: http://git.jankratochvil.net/?p=mdsms.git;a=blobdiff_plain;f=mdsms.c;h=a4e6498e7f28ef8ed59e760d1375f90fcceb4bdc;hp=a7a9905d4fc280f0c27cc70dab4e8d4695df2074;hb=e1aac87e10809e1f8fa9d0a7a4ebdde684d7ae35;hpb=fb945e3471d1a74cc5a702036240d0fb42deb1a8 diff --git a/mdsms.c b/mdsms.c index a7a9905..a4e6498 100644 --- a/mdsms.c +++ b/mdsms.c @@ -3,28 +3,6 @@ static char rcsid[] ATTR_UNUSED = "$Id$"; #endif -/* - * $Log$ - * Revision 1.6 1999/07/28 10:46:37 short - * Removed strict converting/checking of symbol characters to '?'. - * - * Revision 1.5 1999/07/19 10:02:51 short - * Removed '\xXY' chars for compatibility with Digital UNIX vendor "cc". - * - * Revision 1.4 1999/07/14 01:01:11 short - * Termios made compatible with Digital UNIX 4.0, cfset[io]speed() missing. - * - * 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. - * - */ - #include "setup.h" #include @@ -834,19 +812,28 @@ char *buf=malloc(l+50); finame=body; body=NULL; } - else fin=stdin; + else { + finame=NULL; + fin=stdin; + } if (!body) { readbody=0; - 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:"")); - } - if (fin!=stdin) { - chkfclose(fin,finame); - free(finame); + if (finame) { + chkfclose(fin,finame); + free(finame); + } } for (i=0;i