tom_modem: fix ld error

This commit is contained in:
fujr 2024-10-22 23:34:39 +08:00
parent 9057ede3b6
commit a51bf815aa
4 changed files with 17 additions and 11 deletions

View File

@ -11,8 +11,12 @@
#include <sys/select.h>
#include <errno.h>
FILE *fdi; // file descriptor for input
FILE *fdo; // file descriptor for output
int tty_fd; // file descriptor for tty device
PROFILE_T s_profile; // global profile
char *self_name; // program name
void _timeout(int signo)
{
err_msg("Exit with Signal %d", signo);

View File

@ -14,13 +14,12 @@
#define DEFAULT_TIMEOUT 3
//
FILE *fdi; // file descriptor for input
FILE *fdo; // file descriptor for output
int tty_fd; // file descriptor for tty device
PROFILE_T s_profile; // global profile
char *self_name; // program name
extern FILE *fdi; // file descriptor for input
extern FILE *fdo; // file descriptor for output
extern int tty_fd; // file descriptor for tty device
extern PROFILE_T s_profile; // global profile
extern char *self_name; // program name
extern struct termios oldtio; // old tty setting
extern int at(PROFILE_T *profile);

View File

@ -1,5 +1,6 @@
#include "utils.h"
#include "pdu_lib/pdu.h"
struct termios oldtio;
int match_option(char *option_name)
{
@ -164,7 +165,8 @@ int open_tty_device(PROFILE_T *profile)
}
tcflush(tty_fd, TCIOFLUSH);
atexit(clean_up);
close(tty_fd);
if (tty_fd >= 0)
close(tty_fd);
tty_fd = open(profile->tty_dev, O_RDWR | O_NOCTTY);
fdi = fdopen(tty_fd, "r");
fdo = fdopen(tty_fd, "w");
@ -305,7 +307,8 @@ static void clean_up()
}
dbg_msg("Clean up success");
tcflush(tty_fd, TCIOFLUSH);
close(tty_fd);
// if (tty_fd >= 0)
// close(tty_fd);
}
static void escape_json(char *input, char *output)

View File

@ -9,7 +9,7 @@ extern PROFILE_T s_profile;
extern FILE *fdi; // file descriptor for input
extern FILE *fdo; // file descriptor for output
extern int tty_fd; // file descriptor for tty device
struct termios oldtio; // old tty setting
extern struct termios oldtio; // old tty setting