diff options
| author | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:55 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:55 +0200 |
| commit | de18fc13175a5bf0e2b48a042d2fc06e87c88d24 (patch) | |
| tree | f517074cd603d30eb7ba7e2122d38051e4c1439c /map65/libm65/ptt.c | |
| parent | b76e8361909e47f0937d4a64a5a4cb5939f51eb7 (diff) | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
Update upstream source from tag 'upstream/3.0.2+dfsg'
Update to upstream version '3.0.2+dfsg'
with Debian dir 90381fe7be9f5ea84d9b16c9cccf200a3fbe138b
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; } |
