kopia lustrzana https://github.com/Hamlib/Hamlib
Refactor to remove code duplication of one version of getmyline()
rodzic
b809937395
commit
790820ab22
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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[])
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue