format using gindent with personal options

This commit is contained in:
Bryan Stansell 2019-03-21 01:12:12 -07:00
parent 742da69935
commit 95c958d6b3
9 changed files with 80 additions and 55 deletions

View File

@ -87,16 +87,17 @@ char
" -V", " -V",
(char *)0 (char *)0
}, *u_help[] = { }, *u_help[] = {
"c cmd command to run",
"c cmd command to run",
"e env=value environment variable to set", "e env=value environment variable to set",
"g group initial group", "g group initial group",
"h print this help message", "h print this help message",
"l login login name", "l login login name",
"t tty attach to this terminal", "t tty attach to this terminal",
"u do no make utmp entry", "u do no make utmp entry",
"V show version information", (char *)0}, *pcCommand = "V show version information", (char *)0
(char *)0, *pcGroup = (char *)0, *pcLogin = (char *)0, *pcTty = }, *pcCommand = (char *)0, *pcGroup = (char *)0, *pcLogin =
(char *)0; (char *)0, *pcTty = (char *)0;
int int
fMakeUtmp = 1, iErrs = 0; fMakeUtmp = 1, iErrs = 0;

View File

@ -578,10 +578,12 @@ GetMaxFiles(void)
# else # else
# ifndef OPEN_MAX # ifndef OPEN_MAX
# define OPEN_MAX 64 # define OPEN_MAX 64
# endif /* !OPEN_MAX */ # endif
/* !OPEN_MAX */
mf = OPEN_MAX; mf = OPEN_MAX;
# endif /* HAVE_GETDTABLESIZE */ # endif
# endif /* HAVE_GETRLIMIT */ /* HAVE_GETDTABLESIZE */
# endif/* HAVE_GETRLIMIT */
#endif /* HAVE_SYSCONF */ #endif /* HAVE_SYSCONF */
#ifdef FD_SETSIZE #ifdef FD_SETSIZE
if (FD_SETSIZE <= mf) { if (FD_SETSIZE <= mf) {
@ -1990,7 +1992,7 @@ ProbeInterfaces(in_addr_t bindAddr)
} }
close(sock); close(sock);
free(ifc.ifc_req); 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; int count;
struct hostent *he; struct hostent *he;
@ -2713,8 +2715,8 @@ ParseFile(char *filename, FILE *fp, int level)
case VALUE: case VALUE:
switch (token) { switch (token) {
case WORD: case WORD:
(*sections[secIndex].items[keyIndex]. (*sections[secIndex].
reg) (word->string); items[keyIndex].reg) (word->string);
state = SEMI; state = SEMI;
break; break;
case SEMICOLON: case SEMICOLON:

View File

@ -15,7 +15,7 @@
# define CIPHER_SEC0 # define CIPHER_SEC0
# else # else
# define CIPHER_SEC0 ":@SECLEVEL=0" # define CIPHER_SEC0 ":@SECLEVEL=0"
# endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ # endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */
#endif #endif
#if HAVE_GSSAPI #if HAVE_GSSAPI
# include <gssapi/gssapi.h> # include <gssapi/gssapi.h>
@ -100,15 +100,15 @@ typedef struct consFile {
typedef struct item { typedef struct item {
char *id; char *id;
void (*reg) (char *); void (*reg)(char *);
} ITEM; } ITEM;
typedef struct section { typedef struct section {
char *id; char *id;
void (*begin) (char *); void (*begin)(char *);
void (*end) (void); void (*end)(void);
void (*abort) (void); void (*abort)(void);
void (*destroy) (void); void (*destroy)(void);
ITEM *items; ITEM *items;
} SECTION; } SECTION;
@ -121,14 +121,14 @@ typedef enum substToken {
typedef struct subst { typedef struct subst {
/* function to retrieve a token type based on a character /* function to retrieve a token type based on a character
*/ */
SUBSTTOKEN (*token) (char); SUBSTTOKEN (*token)(char);
/* data for callback function /* data for callback function
*/ */
void *data; void *data;
/* function to retrieve a value (as a char* or int or both) for /* function to retrieve a value (as a char* or int or both) for
* a substitution * a substitution
*/ */
int (*value) (char, char **, int *); int (*value)(char, char **, int *);
} SUBST; } SUBST;
extern int isMultiProc, fDebug, fVerbose, fErrorPrinted; extern int isMultiProc, fDebug, fVerbose, fErrorPrinted;

View File

@ -226,7 +226,7 @@ GetPseudoTTY(STRING *slave, int *slaveFD)
*slaveFD = sfd; *slaveFD = sfd;
return fd; return fd;
# endif /* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */ # endif/* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */
#endif /* HAVE_OPENPTY */ #endif /* HAVE_OPENPTY */
} }

View File

@ -4154,9 +4154,8 @@ FlushConsole(CONSENT *pCEServing)
unsigned char next = unsigned char next =
(unsigned char)pCEServing->wbuf->string[offset + 1]; (unsigned char)pCEServing->wbuf->string[offset + 1];
if ((next >= '0' && next <= '9') || if ((next >= '0' && next <= '9') ||
(next >= 'a' && next <= 'z') || (next == BREAK && (next >= 'a' && next <= 'z')
pCEServing->type != || (next == BREAK && pCEServing->type != HOST)) {
HOST)) {
CONDDEBUG((1, "Kiddie(): heavy IAC for [%s]", CONDDEBUG((1, "Kiddie(): heavy IAC for [%s]",
pCEServing->server)); pCEServing->server));
offset += 2; offset += 2;
@ -4866,8 +4865,8 @@ Kiddie(GRPENT *pGE, int sfd)
CONDDEBUG((1, "Kiddie(): flushing fd %d", CONDDEBUG((1, "Kiddie(): flushing fd %d",
FileFDNum(pCLServing->fd))); FileFDNum(pCLServing->fd)));
if (FileWrite if (FileWrite
(pCLServing->fd, FLAGFALSE, (char *)0, (pCLServing->fd, FLAGFALSE, (char *)0, 0)
0) < 0) { < 0) {
DisconnectClient(pGE, pCLServing, (char *)0, DisconnectClient(pGE, pCLServing, (char *)0,
FLAGTRUE); FLAGTRUE);
break; break;
@ -5197,7 +5196,8 @@ Spawn(GRPENT *pGE, int msfd)
} }
# if HAVE_SETSOCKOPT # if HAVE_SETSOCKOPT
if (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, Error("Spawn(): setsockopt(%u,SO_REUSEADDR): %s", sfd,
strerror(errno)); strerror(errno));
Bye(EX_OSERR); Bye(EX_OSERR);

View File

@ -84,8 +84,9 @@ unsigned long dmallocMarkMain = 0;
#endif #endif
#if HAVE_OPENSSL #if HAVE_OPENSSL
#if OPENSSL_VERSION_NUMBER < 0x10100000L # if OPENSSL_VERSION_NUMBER < 0x10100000L
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) 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 /* If the fields p and g in d are NULL, the corresponding input
* parameters MUST be non-NULL. q may remain NULL. * parameters MUST be non-NULL. q may remain NULL.
@ -113,7 +114,7 @@ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
return 1; return 1;
} }
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ # endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */
SSL_CTX *ctx = (SSL_CTX *)0; SSL_CTX *ctx = (SSL_CTX *)0;
DH *dh512 = (DH *)0; DH *dh512 = (DH *)0;
@ -122,7 +123,9 @@ DH *dh2048 = (DH *)0;
DH *dh4096 = (DH *)0; DH *dh4096 = (DH *)0;
DH * 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; DH *dh;
BIGNUM *p, *g; BIGNUM *p, *g;
@ -194,7 +197,8 @@ GetDH1024(void)
0x02, 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 * DH *
@ -232,7 +236,8 @@ GetDH2048(void)
0x02, 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 * DH *
@ -296,7 +301,8 @@ GetDH4096(void)
0x02, 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 * DH *
@ -330,13 +336,13 @@ SetupSSL(void)
if (ctx == (SSL_CTX *)0) { if (ctx == (SSL_CTX *)0) {
char *ciphers; char *ciphers;
int verifymode; int verifymode;
#if OPENSSL_VERSION_NUMBER < 0x10100000L # if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_load_error_strings(); SSL_load_error_strings();
if (!SSL_library_init()) { if (!SSL_library_init()) {
Error("SetupSSL(): SSL_library_init() failed"); Error("SetupSSL(): SSL_library_init() failed");
Bye(EX_SOFTWARE); Bye(EX_SOFTWARE);
} }
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ # endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */
if ((ctx = SSL_CTX_new(TLS_method())) == (SSL_CTX *)0) { if ((ctx = SSL_CTX_new(TLS_method())) == (SSL_CTX *)0) {
Error("SetupSSL(): SSL_CTX_new() failed"); Error("SetupSSL(): SSL_CTX_new() failed");
Bye(EX_SOFTWARE); Bye(EX_SOFTWARE);

View File

@ -565,8 +565,8 @@ DoNormalRead(CONSCLIENT *pCLServing)
pRC = pRC->pRCuniq) { pRC = pRC->pRCuniq) {
s = ":@%s"; s = ":@%s";
s += iSep; s += iSep;
FilePrint(pCLServing->fd, FLAGTRUE, FilePrint(pCLServing->fd, FLAGTRUE, s,
s, pRC->rhost); pRC->rhost);
iSep = 0; iSep = 0;
} }
} }
@ -945,8 +945,8 @@ Master(void)
CONDDEBUG((1, "Master(): flushing fd %d", CONDDEBUG((1, "Master(): flushing fd %d",
FileFDNum(pCLServing->fd))); FileFDNum(pCLServing->fd)));
if (FileWrite if (FileWrite
(pCLServing->fd, FLAGFALSE, (char *)0, (pCLServing->fd, FLAGFALSE, (char *)0, 0)
0) < 0) { < 0) {
DropMasterClient(pCLServing, FLAGTRUE); DropMasterClient(pCLServing, FLAGTRUE);
break; break;
} }

View File

@ -74,13 +74,13 @@ SetupSSL(void)
{ {
if (ctx == (SSL_CTX *)0) { if (ctx == (SSL_CTX *)0) {
char *ciphers; char *ciphers;
#if OPENSSL_VERSION_NUMBER < 0x10100000L # if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_load_error_strings(); SSL_load_error_strings();
if (!SSL_library_init()) { if (!SSL_library_init()) {
Error("SSL library initialization failed"); Error("SSL library initialization failed");
Bye(EX_UNAVAILABLE); Bye(EX_UNAVAILABLE);
} }
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ # endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */
if ((ctx = SSL_CTX_new(TLS_method())) == (SSL_CTX *)0) { if ((ctx = SSL_CTX_new(TLS_method())) == (SSL_CTX *)0) {
Error("Creating SSL context failed"); Error("Creating SSL context failed");
Bye(EX_UNAVAILABLE); Bye(EX_UNAVAILABLE);

16
package/run-gindent Executable file
View File

@ -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]~