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",
(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;

View File

@ -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:

View File

@ -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 <gssapi/gssapi.h>
@ -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;

View File

@ -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 */
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

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