Commit 4b3652dd authored by Deucе's avatar Deucе 👌🏾
Browse files

Force space before pointer stars... too weird without it.

I tried a space after too, but that's weird as well and easily
confused with multiplication at first look.
parent 65698853
Pipeline #3509 passed with stage
in 5 minutes and 22 seconds
This diff is collapsed.
......@@ -109,10 +109,10 @@ struct bbslist {
char comment[1024];
};
extern char*music_names[];
extern char music_helpbuf[];
extern char *music_names[];
extern char music_helpbuf[];
struct bbslist *show_bbslist(char*current, int connected);
struct bbslist *show_bbslist(char *current, int connected);
extern char *log_levels[];
extern char *rate_names[];
......@@ -120,14 +120,14 @@ extern int rates[];
extern int sortorder[];
extern ini_style_t ini_style;
extern char *screen_modes_enum[];
void read_item(str_list_t listfile, struct bbslist*entry, char*bbsname, int id, int type);
void read_list(char*listpath, struct bbslist**list, struct bbslist*defaults, int*i, int type);
void free_list(struct bbslist**list, int listcount);
void add_bbs(char*listpath, struct bbslist*bbs);
int edit_list(struct bbslist**list, struct bbslist*item, char*listpath, int isdefault);
void read_item(str_list_t listfile, struct bbslist *entry, char *bbsname, int id, int type);
void read_list(char *listpath, struct bbslist **list, struct bbslist *defaults, int *i, int type);
void free_list(struct bbslist **list, int listcount);
void add_bbs(char *listpath, struct bbslist *bbs);
int edit_list(struct bbslist **list, struct bbslist *item, char *listpath, int isdefault);
int get_rate_num(int rate);
cterm_emulation_t get_emulation(struct bbslist*bbs);
cterm_emulation_t get_emulation(struct bbslist *bbs);
const char *get_emulation_str(cterm_emulation_t emu);
void get_term_size(struct bbslist*bbs, int*cols, int*rows);
void get_term_size(struct bbslist *bbs, int *cols, int *rows);
#endif // ifndef _BBSLIST_H_
......@@ -61,11 +61,11 @@ struct conn_buffer conn_inbuf;
struct conn_buffer conn_outbuf;
/* Buffer functions */
struct conn_buffer*
struct conn_buffer *
create_conn_buf(struct conn_buffer*buf, size_t size)
create_conn_buf(struct conn_buffer *buf, size_t size)
{
buf->buf = (unsigned char*)malloc(size);
buf->buf = (unsigned char *)malloc(size);
if (buf->buf == NULL)
return NULL;
buf->bufsize = size;
......@@ -91,7 +91,7 @@ create_conn_buf(struct conn_buffer*buf, size_t size)
}
void
destroy_conn_buf(struct conn_buffer*buf)
destroy_conn_buf(struct conn_buffer *buf)
{
if (buf->buf != NULL) {
FREE_AND_NULL(buf->buf);
......@@ -109,7 +109,7 @@ destroy_conn_buf(struct conn_buffer*buf)
* for the rest of the buffer functions
*/
size_t
conn_buf_bytes(struct conn_buffer*buf)
conn_buf_bytes(struct conn_buffer *buf)
{
if (buf->isempty)
return 0;
......@@ -120,7 +120,7 @@ conn_buf_bytes(struct conn_buffer*buf)
}
size_t
conn_buf_free(struct conn_buffer*buf)
conn_buf_free(struct conn_buffer *buf)
{
return buf->bufsize - conn_buf_bytes(buf);
}
......@@ -131,11 +131,11 @@ conn_buf_free(struct conn_buffer*buf)
* copied out of the buffer
*/
size_t
conn_buf_peek(struct conn_buffer*buf, void*voutbuf, size_t outlen)
conn_buf_peek(struct conn_buffer *buf, void *voutbuf, size_t outlen)
{
unsigned char*outbuf = (unsigned char*)voutbuf;
size_t copy_bytes;
size_t chunk;
unsigned char *outbuf = (unsigned char *)voutbuf;
size_t copy_bytes;
size_t chunk;
copy_bytes = conn_buf_bytes(buf);
if (copy_bytes > outlen)
......@@ -158,11 +158,11 @@ conn_buf_peek(struct conn_buffer*buf, void*voutbuf, size_t outlen)
* bytes removed from the buffer.
*/
size_t
conn_buf_get(struct conn_buffer*buf, void*voutbuf, size_t outlen)
conn_buf_get(struct conn_buffer *buf, void *voutbuf, size_t outlen)
{
unsigned char*outbuf = (unsigned char*)voutbuf;
size_t ret;
size_t atstart;
unsigned char *outbuf = (unsigned char *)voutbuf;
size_t ret;
size_t atstart;
atstart = conn_buf_bytes(buf);
ret = conn_buf_peek(buf, outbuf, outlen);
......@@ -182,11 +182,11 @@ conn_buf_get(struct conn_buffer*buf, void*voutbuf, size_t outlen)
* returns the number of bytes written into the buffer
*/
size_t
conn_buf_put(struct conn_buffer*buf, const void*voutbuf, size_t outlen)
conn_buf_put(struct conn_buffer *buf, const void *voutbuf, size_t outlen)
{
const unsigned char*outbuf = (unsigned char*)voutbuf;
size_t write_bytes;
size_t chunk;
const unsigned char *outbuf = (unsigned char *)voutbuf;
size_t write_bytes;
size_t chunk;
write_bytes = conn_buf_free(buf);
if (write_bytes > outlen)
......@@ -213,7 +213,7 @@ conn_buf_put(struct conn_buffer*buf, const void*voutbuf, size_t outlen)
* in the buffer.
*/
size_t
conn_buf_wait_cond(struct conn_buffer*buf, size_t bcount, unsigned long timeout, int do_free)
conn_buf_wait_cond(struct conn_buffer *buf, size_t bcount, unsigned long timeout, int do_free)
{
long double now;
long double end;
......@@ -222,7 +222,7 @@ conn_buf_wait_cond(struct conn_buffer*buf, size_t bcount, unsigned long timeout,
int retnow = 0;
sem_t *sem;
size_t (*cond)(struct conn_buffer*buf);
size_t (*cond)(struct conn_buffer *buf);
if (do_free) {
sem = &(buf->out_sem);
......@@ -283,9 +283,9 @@ conn_connected(void)
}
int
conn_recv_upto(void*vbuffer, size_t buflen, unsigned timeout)
conn_recv_upto(void *vbuffer, size_t buflen, unsigned timeout)
{
char *buffer = (char*)vbuffer;
char *buffer = (char *)vbuffer;
size_t found = 0;
size_t obuflen;
void *expanded;
......@@ -317,10 +317,10 @@ conn_recv_upto(void*vbuffer, size_t buflen, unsigned timeout)
}
int
conn_send_raw(const void*vbuffer, size_t buflen, unsigned int timeout)
conn_send_raw(const void *vbuffer, size_t buflen, unsigned int timeout)
{
const char*buffer = vbuffer;
size_t found;
const char *buffer = vbuffer;
size_t found;
pthread_mutex_lock(&(conn_outbuf.mutex));
found = conn_buf_wait_free(&conn_outbuf, buflen, timeout);
......@@ -331,18 +331,18 @@ conn_send_raw(const void*vbuffer, size_t buflen, unsigned int timeout)
}
int
conn_send(const void*vbuffer, size_t buflen, unsigned int timeout)
conn_send(const void *vbuffer, size_t buflen, unsigned int timeout)
{
const char*buffer = vbuffer;
size_t found;
size_t obuflen;
void *expanded;
const char *buffer = vbuffer;
size_t found;
size_t obuflen;
void *expanded;
if (conn_api.tx_parse_cb != NULL) {
expanded = conn_api.tx_parse_cb(buffer, buflen, &obuflen);
}
else {
expanded = (void*)buffer;
expanded = (void *)buffer;
obuflen = buflen;
}
......@@ -359,7 +359,7 @@ conn_send(const void*vbuffer, size_t buflen, unsigned int timeout)
}
int
conn_connect(struct bbslist*bbs)
conn_connect(struct bbslist *bbs)
{
char str[64];
......@@ -457,30 +457,25 @@ conn_close(void)
}
enum failure_reason {
FAILURE_WHAT_FAILURE
,
FAILURE_RESOLVE
,
FAILURE_CANT_CREATE
,
FAILURE_CONNECT_ERROR
,
FAILURE_ABORTED
,
FAILURE_WHAT_FAILURE,
FAILURE_RESOLVE,
FAILURE_CANT_CREATE,
FAILURE_CONNECT_ERROR,
FAILURE_ABORTED,
FAILURE_DISCONNECTED
};
int
conn_socket_connect(struct bbslist*bbs)
conn_socket_connect(struct bbslist *bbs)
{
SOCKET sock = INVALID_SOCKET;
int nonblock;
int failcode = FAILURE_WHAT_FAILURE;
struct addrinfo hints;
struct addrinfo*res = NULL;
struct addrinfo*cur;
char portnum[6];
char str[LIST_ADDR_MAX + 40];
SOCKET sock = INVALID_SOCKET;
int nonblock;
int failcode = FAILURE_WHAT_FAILURE;
struct addrinfo hints;
struct addrinfo *res = NULL;
struct addrinfo *cur;
char portnum[6];
char str[LIST_ADDR_MAX + 40];
if (!bbs->hidepopups)
uifc.pop("Looking up host");
......@@ -575,7 +570,7 @@ connected:
ioctlsocket(sock, FIONBIO, &nonblock);
if (!socket_recvdone(sock, 0)) {
int keepalives = true;
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepalives, sizeof(keepalives));
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&keepalives, sizeof(keepalives));
if (!bbs->hidepopups)
uifc.pop(NULL);
......
......@@ -33,15 +33,15 @@ enum {
};
struct conn_api {
int (*connect)(struct bbslist*bbs);
int (*connect)(struct bbslist *bbs);
int (*close)(void);
void (*binary_mode_on)(void);
void (*binary_mode_off)(void);
bool binary_mode;
void * (*rx_parse_cb)(const void*inbuf, size_t inlen, size_t*olen);
void * (*tx_parse_cb)(const void*inbuf, size_t inlen, size_t*olen);
void * (*rx_parse_cb)(const void *inbuf, size_t inlen, size_t *olen);
void * (*tx_parse_cb)(const void *inbuf, size_t inlen, size_t *olen);
int log_level;
int type;
......@@ -70,10 +70,10 @@ struct conn_buffer {
/*
* Functions for stuff using connections
*/
int conn_recv_upto(void*buffer, size_t buflen, unsigned int timeout);
int conn_send(const void*buffer, size_t buflen, unsigned int timeout);
int conn_send_raw(const void*buffer, size_t buflen, unsigned int timeout);
int conn_connect(struct bbslist*bbs);
int conn_recv_upto(void *buffer, size_t buflen, unsigned int timeout);
int conn_send(const void *buffer, size_t buflen, unsigned int timeout);
int conn_send_raw(const void *buffer, size_t buflen, unsigned int timeout);
int conn_connect(struct bbslist *bbs);
int conn_close(void);
bool conn_connected(void);
size_t conn_data_waiting(void);
......@@ -90,16 +90,16 @@ extern struct conn_buffer conn_inbuf;
extern struct conn_buffer conn_outbuf;
extern struct conn_api conn_api;
struct conn_buffer *create_conn_buf(struct conn_buffer*buf, size_t size);
void destroy_conn_buf(struct conn_buffer*buf);
size_t conn_buf_bytes(struct conn_buffer*buf);
size_t conn_buf_peek(struct conn_buffer*buf, void*voutbuf, size_t outlen);
size_t conn_buf_get(struct conn_buffer*buf, void*outbuf, size_t outlen);
size_t conn_buf_put(struct conn_buffer*buf, const void*outbuf, size_t outlen);
size_t conn_buf_wait_cond(struct conn_buffer*buf, size_t bcount, unsigned long timeout, int do_free);
struct conn_buffer *create_conn_buf(struct conn_buffer *buf, size_t size);
void destroy_conn_buf(struct conn_buffer *buf);
size_t conn_buf_bytes(struct conn_buffer *buf);
size_t conn_buf_peek(struct conn_buffer *buf, void *voutbuf, size_t outlen);
size_t conn_buf_get(struct conn_buffer *buf, void *outbuf, size_t outlen);
size_t conn_buf_put(struct conn_buffer *buf, const void *outbuf, size_t outlen);
size_t conn_buf_wait_cond(struct conn_buffer *buf, size_t bcount, unsigned long timeout, int do_free);
#define conn_buf_wait_bytes(buf, count, timeout) conn_buf_wait_cond(buf, count, timeout, 0)
#define conn_buf_wait_free(buf, count, timeout) conn_buf_wait_cond(buf, count, timeout, 1)
int conn_socket_connect(struct bbslist*bbs);
int conn_socket_connect(struct bbslist *bbs);
#endif // ifndef _CONN_H_
......@@ -147,7 +147,7 @@ extern int default_font;
#ifdef NEEDS_CFMAKERAW
void
cfmakeraw(struct termios*t)
cfmakeraw(struct termios *t)
{
t->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
t->c_oflag &= ~OPOST;
......@@ -214,12 +214,12 @@ daemon(int nochdir, int noclose)
#endif /* ifdef NEEDS_DAEMON */
static int
openpty(int*amaster, int*aslave, char*name, struct termios*termp, struct winsize*winp)
openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp)
{
char line[] = "/dev/ptyXX";
const char *cp1, *cp2;
int master, slave, ttygid;
struct group*gr;
char line[] = "/dev/ptyXX";
const char *cp1, *cp2;
int master, slave, ttygid;
struct group *gr;
if ((gr = getgrnam("tty")) != NULL)
ttygid = gr->gr_gid;
......@@ -252,7 +252,7 @@ openpty(int*amaster, int*aslave, char*name, struct termios*termp, struct winsize
, TCSAFLUSH, termp);
if (winp)
(void)ioctl(slave, TIOCSWINSZ
, (char*)winp);
, (char *)winp);
return 0;
}
(void)close(master);
......@@ -264,7 +264,7 @@ openpty(int*amaster, int*aslave, char*name, struct termios*termp, struct winsize
}
static int
forkpty(int*amaster, char*name, struct termios*termp, struct winsize*winp)
forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
{
int master, slave, pid;
......@@ -301,7 +301,7 @@ static int status;
#endif
void
pty_input_thread(void*args)
pty_input_thread(void *args)
{
fd_set rds;
int rd;
......@@ -352,7 +352,7 @@ pty_input_thread(void*args)
#endif
void
pty_output_thread(void*args)
pty_output_thread(void *args)
{
fd_set wds;
int wr;
......@@ -408,7 +408,7 @@ pty_output_thread(void*args)
}
int
pty_connect(struct bbslist*bbs)
pty_connect(struct bbslist *bbs)
{
struct winsize ws;
struct termios ts;
......@@ -475,11 +475,11 @@ pty_connect(struct bbslist*bbs)
xp_asprintf_free(termcap);
setenv("MM_CHARSET", ciolib_cp[cp].name, 1);
if (bbs->addr[0]) {
execl("/bin/sh", "/bin/sh", "-c", bbs->addr, (char*)0);
execl("/bin/sh", "/bin/sh", "-c", bbs->addr, (char *)0);
}
else {
if (getenv("SHELL"))
execl(getenv("SHELL"), getenv("SHELL"), (char*)0);
execl(getenv("SHELL"), getenv("SHELL"), (char *)0);
}
exit(1);
}
......@@ -490,13 +490,13 @@ pty_connect(struct bbslist*bbs)
destroy_conn_buf(&conn_inbuf);
return -1;
}
if (!(conn_api.rd_buf = (unsigned char*)malloc(BUFFER_SIZE))) {
if (!(conn_api.rd_buf = (unsigned char *)malloc(BUFFER_SIZE))) {
destroy_conn_buf(&conn_inbuf);
destroy_conn_buf(&conn_outbuf);
return -1;
}
conn_api.rd_buf_size = BUFFER_SIZE;
if (!(conn_api.wr_buf = (unsigned char*)malloc(BUFFER_SIZE))) {
if (!(conn_api.wr_buf = (unsigned char *)malloc(BUFFER_SIZE))) {
free(conn_api.rd_buf);
destroy_conn_buf(&conn_inbuf);
destroy_conn_buf(&conn_outbuf);
......
......@@ -2,7 +2,7 @@
#ifndef _CONN_PTY_H_
#define _CONN_PTY_H_
int pty_connect(struct bbslist*bbs);
int pty_connect(struct bbslist *bbs);
int pty_close(void);
#endif
......@@ -26,15 +26,15 @@ extern int telnet_log_level;
/*****************************************************************************/
static size_t
st_telnet_expand(const uchar*inbuf, size_t inlen, uchar*outbuf, size_t outlen, bool expand_cr, uchar**result)
st_telnet_expand(const uchar *inbuf, size_t inlen, uchar *outbuf, size_t outlen, bool expand_cr, uchar **result)
{
static bool last_was_lf = false;
BYTE *first_iac = (BYTE*)memchr(inbuf, TELNET_IAC, inlen);
BYTE *first_iac = (BYTE *)memchr(inbuf, TELNET_IAC, inlen);
BYTE *first_cr = NULL;
if (inlen == 0) {
if (result != NULL)
*result = (uchar*)inbuf;
*result = (uchar *)inbuf;
return 0;
}
if (last_was_lf && (inbuf[0] == '\n')) {
......@@ -43,13 +43,13 @@ st_telnet_expand(const uchar*inbuf, size_t inlen, uchar*outbuf, size_t outlen, b
}
last_was_lf = false;
if (expand_cr)
first_cr = (BYTE*)memchr(inbuf, '\r', inlen);
first_cr = (BYTE *)memchr(inbuf, '\r', inlen);
else
last_was_lf = false;
if ((first_iac == NULL) && (first_cr == NULL)) { /* Nothing to expand */
if (result != NULL)
*result = (uchar*)inbuf;
*result = (uchar *)inbuf;
return inlen;
}
......@@ -80,27 +80,27 @@ st_telnet_expand(const uchar*inbuf, size_t inlen, uchar*outbuf, size_t outlen, b
return o;
}
void*
telnet_rx_parse_cb(const void*buf, size_t inlen, size_t*olen)
void *
telnet_rx_parse_cb(const void *buf, size_t inlen, size_t *olen)
{
// telnet_interpret() can add up to one byte to inbuf ('\r')
void*ret = malloc(inlen + 1);
void *ret = malloc(inlen + 1);
if (ret == NULL)
return ret;
if (telnet_interpret((BYTE*)buf, inlen, ret, olen) != ret)
if (telnet_interpret((BYTE *)buf, inlen, ret, olen) != ret)
memcpy(ret, buf, *olen);
return ret;
}
void*
telnet_tx_parse_cb(const void*buf, size_t len, size_t*olen)
void *
telnet_tx_parse_cb(const void *buf, size_t len, size_t *olen)
{
void*ret = malloc(len * 2);
void*parsed;
void *ret = malloc(len * 2);
void *parsed;
*olen = st_telnet_expand(buf, len, ret, len * 2
, telnet_local_option[TELNET_BINARY_TX] != TELNET_DO, (BYTE**)&parsed);
, telnet_local_option[TELNET_BINARY_TX] != TELNET_DO, (BYTE **)&parsed);
if (parsed != ret)
memcpy(ret, parsed, *olen);
......@@ -109,7 +109,7 @@ telnet_tx_parse_cb(const void*buf, size_t len, size_t*olen)
}
int
telnet_connect(struct bbslist*bbs)
telnet_connect(struct bbslist *bbs)
{
if (!bbs->hidepopups)
init_uifc(true, true);
......@@ -126,14 +126,14 @@ telnet_connect(struct bbslist*bbs)
destroy_conn_buf(&conn_inbuf);
return -1;
}
conn_api.rd_buf = (unsigned char*)malloc(BUFFER_SIZE);
conn_api.rd_buf = (unsigned char *)malloc(BUFFER_SIZE);
if (!conn_api.rd_buf) {
destroy_conn_buf(&conn_inbuf);
destroy_conn_buf(&conn_outbuf);
return -1;
}
conn_api.rd_buf_size = BUFFER_SIZE;
conn_api.wr_buf = (unsigned char*)malloc(BUFFER_SIZE);
conn_api.wr_buf = (unsigned char *)malloc(BUFFER_SIZE);
if (!conn_api.wr_buf) {
FREE_AND_NULL(conn_api.rd_buf);
destroy_conn_buf(&conn_inbuf);
......
......@@ -8,9 +8,9 @@
extern SOCKET telnet_sock;
void telnet_binary_mode_on(void);
void telnet_binary_mode_off(void);
int telnet_connect(struct bbslist*bbs);
void *telnet_rx_parse_cb(const void*buf, size_t inlen, size_t*olen);
void *telnet_tx_parse_cb(const void*buf, size_t len, size_t*olen);
int telnet_connect(struct bbslist *bbs);
void *telnet_rx_parse_cb(const void *buf, size_t inlen, size_t *olen);
void *telnet_tx_parse_cb(const void *buf, size_t len, size_t *olen);
#define telnet_close rlogin_close
......
......@@ -14,7 +14,7 @@
#include "uifcinit.h"
void
free_font_files(struct font_files*ff)
free_font_files(struct font_files *ff)
{
int i;
......@@ -30,7 +30,7 @@ free_font_files(struct font_files*ff)
}
void
save_font_files(struct font_files*fonts)
save_font_files(struct font_files *fonts)
{
FILE *inifile;
char inipath[MAX_PATH + 1];
......@@ -84,17 +84,17 @@ save_font_files(struct font_files*fonts)
strListFree(&ini_file);
}
struct font_files*
struct font_files *
read_font_files(int*count)
read_font_files(int *count)
{
FILE *inifile;
char inipath[MAX_PATH + 1];
char fontpath[MAX_PATH + 1];
char *fontid;
str_list_t fonts;
struct font_files*ret = NULL;
struct font_files*tmp;
FILE *inifile;
char inipath[MAX_PATH + 1];
char fontpath[MAX_PATH + 1];
char *fontid;
str_list_t fonts;
struct font_files *ret = NULL;
struct font_files *tmp;
*count = 0;
get_syncterm_filename(inipath, sizeof(inipath), SYNCTERM_PATH_INI, false);
......@@ -107,7 +107,7 @@ read_font_files(int*count)
continue;
}
(*count)++;
tmp = (struct font_files*)realloc(ret, sizeof(struct font_files) * (*count + 1));
tmp = (struct font_files *)realloc(ret, sizeof(struct font_files) * (*count + 1));
if (tmp == NULL) {
count--;
free(fontid);
......@@ -132,12 +132,12 @@ read_font_files(int*count)
void
load_font_files(void)
{
int count = 0;
int i;
int nextfont = CONIO_FIRST_FREE_FONT;
struct font_files*ff;
FILE *fontfile;
char *fontdata;
int count = 0;
int i;
int nextfont = CONIO_FIRST_FREE_FONT;
struct font_files *ff;
FILE *fontfile;
char *fontdata;
ff = read_font_files(&count);
for (i = 0; i < count; i++) {
......@@ -155,7 +155,7 @@ load_font_files(void)
continue;
if (ff[i].path8x8 && ff[i].path8x8[0]) {
if ((fontfile = fopen(ff[i].path8x8, "rb")) != NULL) {
if ((fontdata = (char*)malloc(2048)) != NULL) {
if ((fontdata = (char *)malloc(2048)) != NULL) {
if (fread(fontdata, 1, 2048, fontfile) == 2048)