diff options
| author | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:44 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:44 +0200 |
| commit | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (patch) | |
| tree | 6d9c83527c56458a8360ba080bf5f4ca73d526dc /map65/libm65/ptt.c | |
| parent | 4b089ae3f7e9e2d5662f718f663b26a4e8ee63ca (diff) | |
New upstream version 3.0.2+dfsgupstream/3.0.2+dfsg
Diffstat (limited to 'map65/libm65/ptt.c')
| -rw-r--r-- | map65/libm65/ptt.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/map65/libm65/ptt.c b/map65/libm65/ptt.c index 0f99d1be..3170ab78 100644 --- a/map65/libm65/ptt.c +++ b/map65/libm65/ptt.c @@ -5,7 +5,7 @@ int ptt_(int *nport, int *ntx, int *iptt) { static HANDLE hFile; static int open=0; - char s[10]; + char s[64]; int i3=0,i4=0,i5=0,i6=0,i9=0,i00=0; if(*nport==0) { @@ -14,13 +14,19 @@ int ptt_(int *nport, int *ntx, int *iptt) } if(*ntx && (!open)) { - sprintf(s,"COM%d",*nport); - hFile=CreateFile(TEXT(s),GENERIC_WRITE,0,NULL,OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL,NULL); + if (*nport < 10) + snprintf(s, sizeof(s), "COM%d", *nport); + else + snprintf(s, sizeof(s), "\\\\.\\COM%d", *nport); + + hFile = CreateFileA(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; } |
