Refactor to remove code duplication of one version of getmyline()

pull/1831/head
Daniele Forsi IU5HKX 2025-08-04 10:47:02 +02:00
rodzic b809937395
commit 790820ab22
20 zmienionych plików z 19 dodań i 342 usunięć

Wyświetl plik

@ -96,6 +96,25 @@ int openPort(char *comport) // doesn't matter for using pts devices
// Size of command buffer
#define BUFSIZE 256
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
int
getmyline5(int fd, unsigned char *buf)
{

Wyświetl plik

@ -39,24 +39,6 @@ int modea = 2;
int modeb = 2;
int ptt = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}

Wyświetl plik

@ -39,24 +39,6 @@ int modeB = 2;
int ptt = 0;
// int freqa = 14074000, freqb = 14073500;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}

Wyświetl plik

@ -45,24 +45,6 @@ int gt = 0;
int ex016 = 0;
int ex020 = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -46,24 +46,6 @@ int ex016 = 0;
int ex020 = 0;
int st = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -21,24 +21,6 @@ char modeB = '1';
int width = 0;
int ptt;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -24,24 +24,6 @@ int vd = 0;
int sm0 = 0;
int sm1 = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -32,24 +32,6 @@ int rport_gain_psk = 50;
int syncvfo = 0;
int ant = 1;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -23,24 +23,6 @@ int na = 0;
int ex039 = 0;
int keyspd = 20;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -22,24 +22,6 @@ int sh = 25;
int na = 0;
int ex039 = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -24,24 +24,6 @@ int na = 0;
int ex039 = 0;
int ex103 = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -18,24 +18,6 @@ int filternum = 7;
int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -19,24 +19,6 @@ int keyspd = 20;
double alc = 0;
int tx;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -20,24 +20,6 @@ int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int tomode = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -21,24 +21,6 @@ int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int tomode = 0;
int keyspd = 25;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -21,24 +21,6 @@ int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int tomode = 0;
int keyspd = 25;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -212,24 +212,6 @@ int hl_usleep(unsigned long usec); // Until it's replaced
#include "sim.h"
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
int main(int argc, char *argv[])
{

Wyświetl plik

@ -20,24 +20,6 @@ int filternum2 = 8;
int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"

Wyświetl plik

@ -62,24 +62,6 @@ int pc = 50;
#include "sim.h"
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}

Wyświetl plik

@ -26,24 +26,6 @@ int width_sub = 0;
int ex039 = 0;
int lk = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#include "sim.h"