diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
| commit | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (patch) | |
| tree | fbfdfe6bcb0a8a114be2480dac53d88c977e4869 /lib/ptt.c | |
| parent | 4320ce238aae1fe87fc9f379cdd816e9317885fa (diff) | |
New upstream version 2.7.0~rc8+repackupstream/2.7.0_rc8+repack
Diffstat (limited to 'lib/ptt.c')
| -rwxr-xr-x | lib/ptt.c | 100 |
1 files changed, 50 insertions, 50 deletions
@@ -1,50 +1,50 @@ -#include <windows.h>
-#include <stdio.h>
-
-int ptt_(int *nport, int *ntx, int *iptt)
-{
- static HANDLE hFile;
- static int open=0;
- char s[10];
- int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1;
-
- if(*nport==0) {
- *iptt=*ntx;
- return(0);
- }
-
- if(*ntx && (!open)) {
- sprintf(s,"\\\\.\\COM%d",*nport);
- 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);
- return 1;
- }
- open=1;
- }
-
- if(*ntx && open) {
- i3=EscapeCommFunction(hFile,3);
- i5=EscapeCommFunction(hFile,5);
- *iptt=1;
- }
-
- else {
- i4=EscapeCommFunction(hFile,4);
- i6=EscapeCommFunction(hFile,6);
- i9=EscapeCommFunction(hFile,9);
- i00=CloseHandle(hFile);
- *iptt=0;
- open=0;
- }
- /*
- if(i3==0) return 3;
- if(i4==0) return 4;
- if(i5==0) return 5;
- if(i6==0) return 6;
- if(i9==0) return 9;
- if(i00==0) return 10;
- */
- return 0;
-}
+#include <windows.h> +#include <stdio.h> + +int ptt_(int *nport, int *ntx, int *iptt) +{ + static HANDLE hFile; + static int open=0; + char s[10]; + int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1; + + if(*nport==0) { + *iptt=*ntx; + return(0); + } + + if(*ntx && (!open)) { + sprintf(s,"\\\\.\\COM%d",*nport); + 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); + return 1; + } + open=1; + } + + if(*ntx && open) { + i3=EscapeCommFunction(hFile,3); + i5=EscapeCommFunction(hFile,5); + *iptt=1; + } + + else { + i4=EscapeCommFunction(hFile,4); + i6=EscapeCommFunction(hFile,6); + i9=EscapeCommFunction(hFile,9); + i00=CloseHandle(hFile); + *iptt=0; + open=0; + } + /* + if(i3==0) return 3; + if(i4==0) return 4; + if(i5==0) return 5; + if(i6==0) return 6; + if(i9==0) return 9; + if(i00==0) return 10; + */ + return 0; +} |
