comment unneeded port in serialsock

This commit is contained in:
Edward Emelianov 2022-01-23 14:30:06 +03:00
parent 9192ee09a3
commit 8999f83c22
5 changed files with 10 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# run `make DEF=...` to add extra defines # run `make DEF=...` to add extra defines
PROGRAM := serialsock PROGRAM := serialsock
LDFLAGS := -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--discard-all LDFLAGS := -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--discard-all
LDFLAGS += -lusefull_macros LDFLAGS += -lusefull_macros -lm -L/usr/local/lib/
SRCS := $(wildcard *.c) SRCS := $(wildcard *.c)
DEFINES := $(DEF) -D_GNU_SOURCE -D_XOPEN_SOURCE=1111 DEFINES := $(DEF) -D_GNU_SOURCE -D_XOPEN_SOURCE=1111
OBJDIR := mk OBJDIR := mk
@ -21,7 +21,7 @@ $(OBJS): $(OBJDIR)
$(PROGRAM) : $(OBJS) $(PROGRAM) : $(OBJS)
@echo -e "\t\tLD $(PROGRAM)" @echo -e "\t\tLD $(PROGRAM)"
$(CC) $(LDFLAGS) $(OBJS) -o $(PROGRAM) $(CC) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
$(OBJDIR): $(OBJDIR):
mkdir $(OBJDIR) mkdir $(OBJDIR)
@ -32,7 +32,7 @@ endif
$(OBJDIR)/%.o: %.c $(OBJDIR)/%.o: %.c
@echo -e "\t\tCC $<" @echo -e "\t\tCC $<"
$(CC) -MD -c $(LDFLAGS) $(CFLAGS) $(DEFINES) -o $@ $< $(CC) $< -MD -c $(CFLAGS) $(DEFINES) -o $@
clean: clean:
@echo -e "\t\tCLEAN" @echo -e "\t\tCLEAN"

View File

@ -1 +1,2 @@
Socket server for my USB-CAN Socket server for any serial device

View File

@ -35,7 +35,7 @@ static int help;
static glob_pars G = { static glob_pars G = {
.pidfile = DEFAULT_PIDFILE, .pidfile = DEFAULT_PIDFILE,
.speed = 9600, .speed = 9600,
.port = DEFAULT_PORT, // .port = DEFAULT_PORT,
.path = DEFAULT_SOCKPATH, .path = DEFAULT_SOCKPATH,
.logfile = NULL // don't save logs .logfile = NULL // don't save logs
}; };
@ -53,7 +53,7 @@ static myoption cmdlnopts[] = {
{"pidfile", NEED_ARG, NULL, 'p', arg_string, APTR(&G.pidfile), _("pidfile (default: " DEFAULT_PIDFILE ")")}, {"pidfile", NEED_ARG, NULL, 'p', arg_string, APTR(&G.pidfile), _("pidfile (default: " DEFAULT_PIDFILE ")")},
{"client", NO_ARGS, NULL, 'c', arg_int, APTR(&G.client), _("run as client")}, {"client", NO_ARGS, NULL, 'c', arg_int, APTR(&G.client), _("run as client")},
{"sockpath",NEED_ARG, NULL, 'f', arg_string, APTR(&G.path), _("socket path (start from \\0 for no files)")}, {"sockpath",NEED_ARG, NULL, 'f', arg_string, APTR(&G.path), _("socket path (start from \\0 for no files)")},
{"port", NEED_ARG, NULL, 'P', arg_string, APTR(&G.port), _("port to connect (default: " DEFAULT_PORT ")")}, // {"port", NEED_ARG, NULL, 'P', arg_string, APTR(&G.port), _("port to connect (default: " DEFAULT_PORT ")")},
{"verbose", NO_ARGS, NULL, 'v', arg_none, APTR(&G.verbose), _("increase log verbose level (default: LOG_WARN) and messages (default: none)")}, {"verbose", NO_ARGS, NULL, 'v', arg_none, APTR(&G.verbose), _("increase log verbose level (default: LOG_WARN) and messages (default: none)")},
end_option end_option
}; };

View File

@ -27,8 +27,8 @@ typedef struct{
char *devpath; // path to serial device char *devpath; // path to serial device
char *pidfile; // name of PID file char *pidfile; // name of PID file
char *logfile; // logging to this file char *logfile; // logging to this file
char *port; // network port
char *path; // path to socket file char *path; // path to socket file
// int port;
int speed; // connection speed int speed; // connection speed
int verbose; // verbose level: for messages & logging int verbose; // verbose level: for messages & logging
int client; // ==1 if application runs in client mode int client; // ==1 if application runs in client mode

View File

@ -76,12 +76,12 @@ int main(int argc, char **argv){
LOGERR("You should point serial device path"); LOGERR("You should point serial device path");
ERRX("You should point serial device path"); ERRX("You should point serial device path");
} }
int port = atoi(GP->port); /* int port = atoi(GP->port);
if(port < 1024 || port > 65535){ if(port < 1024 || port > 65535){
LOGERR("Wrong port value: %d", port); LOGERR("Wrong port value: %d", port);
WARNX("Wrong port value: %d", port); WARNX("Wrong port value: %d", port);
return 1; return 1;
} }*/
if(server) check4running(self, GP->pidfile); if(server) check4running(self, GP->pidfile);
// signal reactions: // signal reactions:
signal(SIGTERM, signals); // kill (-15) - quit signal(SIGTERM, signals); // kill (-15) - quit