From 95c958d6b3287285a8e8a64c96ae405fd092b156 Mon Sep 17 00:00:00 2001 From: Bryan Stansell Date: Thu, 21 Mar 2019 01:12:12 -0700 Subject: [PATCH] format using gindent with personal options --- autologin/main.c | 21 +++++++++++---------- conserver/cutil.c | 14 ++++++++------ conserver/cutil.h | 16 ++++++++-------- conserver/fallback.c | 2 +- conserver/group.c | 12 ++++++------ conserver/main.c | 42 ++++++++++++++++++++++++------------------ conserver/master.c | 8 ++++---- console/console.c | 4 ++-- package/run-gindent | 16 ++++++++++++++++ 9 files changed, 80 insertions(+), 55 deletions(-) create mode 100755 package/run-gindent diff --git a/autologin/main.c b/autologin/main.c index dab3fef..b9b8cf8 100644 --- a/autologin/main.c +++ b/autologin/main.c @@ -87,16 +87,17 @@ char " -V", (char *)0 }, *u_help[] = { -"c cmd command to run", - "e env=value environment variable to set", - "g group initial group", - "h print this help message", - "l login login name", - "t tty attach to this terminal", - "u do no make utmp entry", - "V show version information", (char *)0}, *pcCommand = - (char *)0, *pcGroup = (char *)0, *pcLogin = (char *)0, *pcTty = - (char *)0; + + "c cmd command to run", + "e env=value environment variable to set", + "g group initial group", + "h print this help message", + "l login login name", + "t tty attach to this terminal", + "u do no make utmp entry", + "V show version information", (char *)0 +}, *pcCommand = (char *)0, *pcGroup = (char *)0, *pcLogin = + (char *)0, *pcTty = (char *)0; int fMakeUtmp = 1, iErrs = 0; diff --git a/conserver/cutil.c b/conserver/cutil.c index dcfe333..226fb81 100644 --- a/conserver/cutil.c +++ b/conserver/cutil.c @@ -578,10 +578,12 @@ GetMaxFiles(void) # else # ifndef OPEN_MAX # define OPEN_MAX 64 -# endif /* !OPEN_MAX */ +# endif + /* !OPEN_MAX */ mf = OPEN_MAX; -# endif /* HAVE_GETDTABLESIZE */ -# endif /* HAVE_GETRLIMIT */ +# endif + /* HAVE_GETDTABLESIZE */ +# endif/* HAVE_GETRLIMIT */ #endif /* HAVE_SYSCONF */ #ifdef FD_SETSIZE if (FD_SETSIZE <= mf) { @@ -1990,7 +1992,7 @@ ProbeInterfaces(in_addr_t bindAddr) } close(sock); free(ifc.ifc_req); -# else /* use the hostname like the old code did (but use all addresses!) */ +# else/* use the hostname like the old code did (but use all addresses!) */ int count; struct hostent *he; @@ -2713,8 +2715,8 @@ ParseFile(char *filename, FILE *fp, int level) case VALUE: switch (token) { case WORD: - (*sections[secIndex].items[keyIndex]. - reg) (word->string); + (*sections[secIndex]. + items[keyIndex].reg) (word->string); state = SEMI; break; case SEMICOLON: diff --git a/conserver/cutil.h b/conserver/cutil.h index 63aef65..d21abc5 100644 --- a/conserver/cutil.h +++ b/conserver/cutil.h @@ -15,7 +15,7 @@ # define CIPHER_SEC0 # else # define CIPHER_SEC0 ":@SECLEVEL=0" -# endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ +# endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */ #endif #if HAVE_GSSAPI # include @@ -100,15 +100,15 @@ typedef struct consFile { typedef struct item { char *id; - void (*reg) (char *); + void (*reg)(char *); } ITEM; typedef struct section { char *id; - void (*begin) (char *); - void (*end) (void); - void (*abort) (void); - void (*destroy) (void); + void (*begin)(char *); + void (*end)(void); + void (*abort)(void); + void (*destroy)(void); ITEM *items; } SECTION; @@ -121,14 +121,14 @@ typedef enum substToken { typedef struct subst { /* function to retrieve a token type based on a character */ - SUBSTTOKEN (*token) (char); + SUBSTTOKEN (*token)(char); /* data for callback function */ void *data; /* function to retrieve a value (as a char* or int or both) for * a substitution */ - int (*value) (char, char **, int *); + int (*value)(char, char **, int *); } SUBST; extern int isMultiProc, fDebug, fVerbose, fErrorPrinted; diff --git a/conserver/fallback.c b/conserver/fallback.c index f2b462b..e5ac629 100644 --- a/conserver/fallback.c +++ b/conserver/fallback.c @@ -226,7 +226,7 @@ GetPseudoTTY(STRING *slave, int *slaveFD) *slaveFD = sfd; return fd; -# endif /* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */ +# endif/* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */ #endif /* HAVE_OPENPTY */ } diff --git a/conserver/group.c b/conserver/group.c index 8307c02..948cec8 100644 --- a/conserver/group.c +++ b/conserver/group.c @@ -4154,9 +4154,8 @@ FlushConsole(CONSENT *pCEServing) unsigned char next = (unsigned char)pCEServing->wbuf->string[offset + 1]; if ((next >= '0' && next <= '9') || - (next >= 'a' && next <= 'z') || (next == BREAK && - pCEServing->type != - HOST)) { + (next >= 'a' && next <= 'z') + || (next == BREAK && pCEServing->type != HOST)) { CONDDEBUG((1, "Kiddie(): heavy IAC for [%s]", pCEServing->server)); offset += 2; @@ -4866,8 +4865,8 @@ Kiddie(GRPENT *pGE, int sfd) CONDDEBUG((1, "Kiddie(): flushing fd %d", FileFDNum(pCLServing->fd))); if (FileWrite - (pCLServing->fd, FLAGFALSE, (char *)0, - 0) < 0) { + (pCLServing->fd, FLAGFALSE, (char *)0, 0) + < 0) { DisconnectClient(pGE, pCLServing, (char *)0, FLAGTRUE); break; @@ -5197,7 +5196,8 @@ Spawn(GRPENT *pGE, int msfd) } # if HAVE_SETSOCKOPT if (setsockopt - (sfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true, sizeof(true)) < 0) { + (sfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true, sizeof(true)) + < 0) { Error("Spawn(): setsockopt(%u,SO_REUSEADDR): %s", sfd, strerror(errno)); Bye(EX_OSERR); diff --git a/conserver/main.c b/conserver/main.c index 282e7be..3cbc4e7 100644 --- a/conserver/main.c +++ b/conserver/main.c @@ -84,36 +84,37 @@ unsigned long dmallocMarkMain = 0; #endif #if HAVE_OPENSSL -#if OPENSSL_VERSION_NUMBER < 0x10100000L -int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) +# if OPENSSL_VERSION_NUMBER < 0x10100000L +int +DH_set0_pqg(DH *dh, BIGNUM * p, BIGNUM * q, BIGNUM * g) { /* If the fields p and g in d are NULL, the corresponding input * parameters MUST be non-NULL. q may remain NULL. */ if ((dh->p == NULL && p == NULL) - || (dh->g == NULL && g == NULL)) - return 0; + || (dh->g == NULL && g == NULL)) + return 0; if (p != NULL) { - BN_free(dh->p); - dh->p = p; + BN_free(dh->p); + dh->p = p; } if (q != NULL) { - BN_free(dh->q); - dh->q = q; + BN_free(dh->q); + dh->q = q; } if (g != NULL) { - BN_free(dh->g); - dh->g = g; + BN_free(dh->g); + dh->g = g; } if (q != NULL) { - dh->length = BN_num_bits(q); + dh->length = BN_num_bits(q); } return 1; } -#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ +# endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */ SSL_CTX *ctx = (SSL_CTX *)0; DH *dh512 = (DH *)0; @@ -122,7 +123,9 @@ DH *dh2048 = (DH *)0; DH *dh4096 = (DH *)0; DH * -DHFromArray(unsigned char *dh_p, size_t dh_p_size, unsigned char *dh_g, size_t dh_g_size) { +DHFromArray(unsigned char *dh_p, size_t dh_p_size, unsigned char *dh_g, + size_t dh_g_size) +{ DH *dh; BIGNUM *p, *g; @@ -194,7 +197,8 @@ GetDH1024(void) 0x02, }; - return DHFromArray(dh1024_p, sizeof(dh1024_p), dh1024_g, sizeof(dh1024_g)); + return DHFromArray(dh1024_p, sizeof(dh1024_p), dh1024_g, + sizeof(dh1024_g)); } DH * @@ -232,7 +236,8 @@ GetDH2048(void) 0x02, }; - return DHFromArray(dh2048_p, sizeof(dh2048_p), dh2048_g, sizeof(dh2048_g)); + return DHFromArray(dh2048_p, sizeof(dh2048_p), dh2048_g, + sizeof(dh2048_g)); } DH * @@ -296,7 +301,8 @@ GetDH4096(void) 0x02, }; - return DHFromArray(dh4096_p, sizeof(dh4096_p), dh4096_g, sizeof(dh4096_g)); + return DHFromArray(dh4096_p, sizeof(dh4096_p), dh4096_g, + sizeof(dh4096_g)); } DH * @@ -330,13 +336,13 @@ SetupSSL(void) if (ctx == (SSL_CTX *)0) { char *ciphers; int verifymode; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +# if OPENSSL_VERSION_NUMBER < 0x10100000L SSL_load_error_strings(); if (!SSL_library_init()) { Error("SetupSSL(): SSL_library_init() failed"); Bye(EX_SOFTWARE); } -#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ +# endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */ if ((ctx = SSL_CTX_new(TLS_method())) == (SSL_CTX *)0) { Error("SetupSSL(): SSL_CTX_new() failed"); Bye(EX_SOFTWARE); diff --git a/conserver/master.c b/conserver/master.c index 1fc8826..cebd5ba 100644 --- a/conserver/master.c +++ b/conserver/master.c @@ -565,8 +565,8 @@ DoNormalRead(CONSCLIENT *pCLServing) pRC = pRC->pRCuniq) { s = ":@%s"; s += iSep; - FilePrint(pCLServing->fd, FLAGTRUE, - s, pRC->rhost); + FilePrint(pCLServing->fd, FLAGTRUE, s, + pRC->rhost); iSep = 0; } } @@ -945,8 +945,8 @@ Master(void) CONDDEBUG((1, "Master(): flushing fd %d", FileFDNum(pCLServing->fd))); if (FileWrite - (pCLServing->fd, FLAGFALSE, (char *)0, - 0) < 0) { + (pCLServing->fd, FLAGFALSE, (char *)0, 0) + < 0) { DropMasterClient(pCLServing, FLAGTRUE); break; } diff --git a/console/console.c b/console/console.c index bae728c..224f1a8 100644 --- a/console/console.c +++ b/console/console.c @@ -74,13 +74,13 @@ SetupSSL(void) { if (ctx == (SSL_CTX *)0) { char *ciphers; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +# if OPENSSL_VERSION_NUMBER < 0x10100000L SSL_load_error_strings(); if (!SSL_library_init()) { Error("SSL library initialization failed"); Bye(EX_UNAVAILABLE); } -#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ +# endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */ if ((ctx = SSL_CTX_new(TLS_method())) == (SSL_CTX *)0) { Error("Creating SSL context failed"); Bye(EX_UNAVAILABLE); diff --git a/package/run-gindent b/package/run-gindent new file mode 100755 index 0000000..3afd358 --- /dev/null +++ b/package/run-gindent @@ -0,0 +1,16 @@ +#!/bin/bash + +gindent -npro -i4 -ip4 -cli4 -br -brs -cdw -ce -npcs -ncs -nhnl -l75 -lc75 -nbbo -ppi1 ` + echo -T SOCKADDR_STYPE + echo -T INADDR_STYPE + echo -T time_t + echo -T X509_STORE_CTX + echo -T FILE + echo -T SSL + echo -T fd_set + echo -T pam_handle_t + echo -T SSL_CTX + echo -T DH + sed -ne '/typedef/,/}/p' */*.[ch] | grep '^[ ]*}' | sed -e 's/[ ]*}/-T/' -e 's/;//' | sort -u + ` */*.[ch] +rm */*.[ch]~