From 8956f3f85174b97c0d64201dd60d79ad46428e74 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Thu, 28 Jun 2018 11:58:28 +0200 Subject: [PATCH] Cleanups - Consequently use "unsigned int", not "unsigned" - Indent - Sort headers --- telnet.h | 6 +++--- ttynvt.c | 44 ++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/telnet.h b/telnet.h index 24774cb..aa0aacc 100644 --- a/telnet.h +++ b/telnet.h @@ -22,7 +22,7 @@ typedef struct { unsigned int bytes_rx; /* Rx byte count */ unsigned char mode_telnet; /* Telnet mode */ unsigned char mode_rfc2217; /* RFC-2217 mode */ - unsigned char telnet_ack[256]; /* telnet option ack counter */ + unsigned char telnet_ack[256]; /* telnet option ack counter */ } tn_ctx_t; extern tn_ctx_t *telnet_ctx_init(void *cctx, srv_tx_f * ftx, srv_rx_f * frx, @@ -30,11 +30,11 @@ extern tn_ctx_t *telnet_ctx_init(void *cctx, srv_tx_f * ftx, srv_rx_f * frx, extern int telnet_open(tn_ctx_t * tcc); -extern int telnet_rx(tn_ctx_t * tcc, char *buf, size_t *plen); +extern int telnet_rx(tn_ctx_t * tcc, char *buf, size_t * plen); extern int telnet_tx(tn_ctx_t * tcc, const char *buf, int len); extern void telnet_set_opt(tn_ctx_t * tcc, int opt, int prm, - const void *val, int len); + const void *val, int len); extern void telnet_rfc2217_handle_opt(tn_ctx_t * tcc, int opt, unsigned char *pu, int nd); diff --git a/ttynvt.c b/ttynvt.c index 5a5f425..43e87b0 100644 --- a/ttynvt.c +++ b/ttynvt.c @@ -5,28 +5,27 @@ #include "config.h" #include +#include +#include #include +#include +#include +#include +#include +#include #include #include -#include -#include #include -#include -#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include +#include #include "telnet.h" @@ -128,7 +127,7 @@ static void ttynvt_update_notify(ttynvt_t * tty, struct fuse_pollhandle *ph) fuse_pollhandle_destroy(tmp_ph); } -static unsigned ttynvt_write_avail(ttynvt_t * tty) +static unsigned int ttynvt_write_avail(ttynvt_t * tty) { size_t write_avail; int used; @@ -250,7 +249,7 @@ static int ttynvt_connect(const char *host, unsigned int port) (sockfd, (const struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0) { ttynvt_log("ERROR: failed to connect to: %s:%u:%s\n", - host, port, strerror(errno)); + host, port, strerror(errno)); return -1; } return sockfd; @@ -484,7 +483,7 @@ static const char pstr[] = { ' ', 'N', 'O', 'E', 'M', 'S' }; static void ttynvt_ioctl(fuse_req_t req, int cmd, void *arg, - struct fuse_file_info *info, unsigned flags, + struct fuse_file_info *info, unsigned int flags, const void *in_buf, size_t in_bufsz, size_t out_bufsz) { ttynvt_t *tty = (ttynvt_t *) (uintptr_t) info->fh; @@ -558,7 +557,8 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg, telnet_rfc2217_ctl(tty->tn, TNS_CTL_DTR_ON); } - ttynvt_log("CFG ioctl: %u%c%u%u %cCTSRTS %cCREAD %cHUPCL %cCLOCAL\n", + ttynvt_log + ("CFG ioctl: %u%c%u%u %cCTSRTS %cCREAD %cHUPCL %cCLOCAL\n", baudrate(speed), pstr[par], csize, sb, tio.c_cflag & CRTSCTS ? '+' : '-', tio.c_cflag & CREAD ? '+' : '-', @@ -777,12 +777,12 @@ static const struct cuse_lowlevel_ops ttynvt_op = { #define TTYNET_OPT(t, p, v) { t, offsetof(struct ttynvt_param, p), v } struct ttynvt_param { - unsigned major; - unsigned minor; + unsigned int major; + unsigned int minor; char *dev_name; char *logfile; char *host; - unsigned port; + unsigned int port; }; static const struct fuse_opt ttynvt_opts[] = {