diff options
| author | Christoph Berg <christoph.berg@credativ.de> | 2022-08-23 10:23:16 +0200 |
|---|---|---|
| committer | Christoph Berg <christoph.berg@credativ.de> | 2022-08-23 10:23:16 +0200 |
| commit | 2d1068e60bce7ae1fff11623454900e8cee956b1 (patch) | |
| tree | acebe276e30466ef0ab91bc3da5e379bec0d7dc5 /lib/ft2/ptt.c | |
| parent | 43bebfbad6e7ba026bd3d55720c7d9e12a7ef8ef (diff) | |
New upstream version 2.6.0~rc3+repackupstream/2.6.0_rc3+repack
Diffstat (limited to 'lib/ft2/ptt.c')
| -rwxr-xr-x | lib/ft2/ptt.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/lib/ft2/ptt.c b/lib/ft2/ptt.c index fdda4ff9..05451d46 100755 --- a/lib/ft2/ptt.c +++ b/lib/ft2/ptt.c @@ -1,58 +1,58 @@ -#include <windows.h> -#include <stdio.h> - -int ptt_(int *nport, int *ntx, int *ndtr, int *iptt) -{ - static HANDLE hFile; - static int open=0, nhold=0; - char s[10]; - int i3,i4,i5,i6,i9,i00; - - if(*nport==0) { - *iptt=*ntx; - return(0); - } - - nhold=0; - if(*nport>100) nhold=1; - - if(*ntx && (!open)) { - sprintf(s,"\\\\.\\COM%d",*nport%100); - hFile=CreateFile( - TEXT(s), - GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL - ); - if(hFile==INVALID_HANDLE_VALUE) { - printf("PTT: Cannot open COM port %d.\n",*nport%100); - return(-1); - } - open=1; - } - - if(*ntx && open) { - if(*ndtr) - EscapeCommFunction(hFile,5); //set DTR - else - EscapeCommFunction(hFile,3); //set RTS - *iptt=1; - } - - else { - if(*ndtr) - EscapeCommFunction(hFile,6); //clear DTR - else - EscapeCommFunction(hFile,4); //clear RTS - EscapeCommFunction(hFile,9); //clear BREAK - if(nhold==0) { - i00=CloseHandle(hFile); - open=0; - } - *iptt=0; - } - return(0); -} +#include <windows.h>
+#include <stdio.h>
+
+int ptt_(int *nport, int *ntx, int *ndtr, int *iptt)
+{
+ static HANDLE hFile;
+ static int open=0, nhold=0;
+ char s[10];
+ int i3,i4,i5,i6,i9,i00;
+
+ if(*nport==0) {
+ *iptt=*ntx;
+ return(0);
+ }
+
+ nhold=0;
+ if(*nport>100) nhold=1;
+
+ if(*ntx && (!open)) {
+ sprintf(s,"\\\\.\\COM%d",*nport%100);
+ hFile=CreateFile(
+ TEXT(s),
+ GENERIC_WRITE,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL
+ );
+ if(hFile==INVALID_HANDLE_VALUE) {
+ printf("PTT: Cannot open COM port %d.\n",*nport%100);
+ return(-1);
+ }
+ open=1;
+ }
+
+ if(*ntx && open) {
+ if(*ndtr)
+ EscapeCommFunction(hFile,5); //set DTR
+ else
+ EscapeCommFunction(hFile,3); //set RTS
+ *iptt=1;
+ }
+
+ else {
+ if(*ndtr)
+ EscapeCommFunction(hFile,6); //clear DTR
+ else
+ EscapeCommFunction(hFile,4); //clear RTS
+ EscapeCommFunction(hFile,9); //clear BREAK
+ if(nhold==0) {
+ i00=CloseHandle(hFile);
+ open=0;
+ }
+ *iptt=0;
+ }
+ return(0);
+}
|
