mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-29 08:44:52 +02:00
whitespace fixes
This commit is contained in:
parent
500f90b39d
commit
c81c2bea6e
@ -35,9 +35,9 @@
|
|||||||
* original. Also, there is now a builtin-test, just compile with:
|
* original. Also, there is now a builtin-test, just compile with:
|
||||||
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
||||||
* and run snprintf for results.
|
* and run snprintf for results.
|
||||||
*
|
*
|
||||||
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
|
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
|
||||||
* The PGP code was using unsigned hexadecimal formats.
|
* The PGP code was using unsigned hexadecimal formats.
|
||||||
* Unfortunately, unsigned formats simply didn't work.
|
* Unfortunately, unsigned formats simply didn't work.
|
||||||
*
|
*
|
||||||
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
|
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
|
||||||
@ -55,20 +55,20 @@
|
|||||||
*
|
*
|
||||||
* date: 2002/12/19 19:56:31; author: herb; state: Exp; lines: +2 -0
|
* date: 2002/12/19 19:56:31; author: herb; state: Exp; lines: +2 -0
|
||||||
* actually print args for %g and %e
|
* actually print args for %g and %e
|
||||||
*
|
*
|
||||||
* date: 2002/06/03 13:37:52; author: jmcd; state: Exp; lines: +8 -0
|
* date: 2002/06/03 13:37:52; author: jmcd; state: Exp; lines: +8 -0
|
||||||
* Since includes.h isn't included here, VA_COPY has to be defined here. I don't
|
* Since includes.h isn't included here, VA_COPY has to be defined here. I don't
|
||||||
* see any include file that is guaranteed to be here, so I'm defining it
|
* see any include file that is guaranteed to be here, so I'm defining it
|
||||||
* locally. Fixes AIX and Solaris builds.
|
* locally. Fixes AIX and Solaris builds.
|
||||||
*
|
*
|
||||||
* date: 2002/06/03 03:07:24; author: tridge; state: Exp; lines: +5 -13
|
* date: 2002/06/03 03:07:24; author: tridge; state: Exp; lines: +5 -13
|
||||||
* put the ifdef for HAVE_VA_COPY in one place rather than in lots of
|
* put the ifdef for HAVE_VA_COPY in one place rather than in lots of
|
||||||
* functions
|
* functions
|
||||||
*
|
*
|
||||||
* date: 2002/05/17 14:51:22; author: jmcd; state: Exp; lines: +21 -4
|
* date: 2002/05/17 14:51:22; author: jmcd; state: Exp; lines: +21 -4
|
||||||
* Fix usage of va_list passed as an arg. Use __va_copy before using it
|
* Fix usage of va_list passed as an arg. Use __va_copy before using it
|
||||||
* when it exists.
|
* when it exists.
|
||||||
*
|
*
|
||||||
* date: 2002/04/16 22:38:04; author: idra; state: Exp; lines: +20 -14
|
* date: 2002/04/16 22:38:04; author: idra; state: Exp; lines: +20 -14
|
||||||
* Fix incorrect zpadlen handling in fmtfp.
|
* Fix incorrect zpadlen handling in fmtfp.
|
||||||
* Thanks to Ollie Oldham <ollie.oldham@metro-optix.com> for spotting it.
|
* Thanks to Ollie Oldham <ollie.oldham@metro-optix.com> for spotting it.
|
||||||
@ -167,7 +167,7 @@
|
|||||||
(pos)++; \
|
(pos)++; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static int dopr(char *buffer, size_t maxlen, const char *format,
|
static int dopr(char *buffer, size_t maxlen, const char *format,
|
||||||
va_list args_in);
|
va_list args_in);
|
||||||
static int fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
static int fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
char *value, int flags, int min, int max);
|
char *value, int flags, int min, int max);
|
||||||
@ -192,19 +192,19 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
|||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
VA_COPY(args, args_in);
|
VA_COPY(args, args_in);
|
||||||
|
|
||||||
state = DP_S_DEFAULT;
|
state = DP_S_DEFAULT;
|
||||||
currlen = flags = cflags = min = 0;
|
currlen = flags = cflags = min = 0;
|
||||||
max = -1;
|
max = -1;
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
|
|
||||||
while (state != DP_S_DONE) {
|
while (state != DP_S_DONE) {
|
||||||
if (ch == '\0')
|
if (ch == '\0')
|
||||||
state = DP_S_DONE;
|
state = DP_S_DONE;
|
||||||
|
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case DP_S_DEFAULT:
|
case DP_S_DEFAULT:
|
||||||
if (ch == '%')
|
if (ch == '%')
|
||||||
state = DP_S_FLAGS;
|
state = DP_S_FLAGS;
|
||||||
else
|
else
|
||||||
DOPR_OUTCH(buffer, currlen, maxlen, ch);
|
DOPR_OUTCH(buffer, currlen, maxlen, ch);
|
||||||
@ -253,7 +253,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
|||||||
if (ch == '.') {
|
if (ch == '.') {
|
||||||
state = DP_S_MAX;
|
state = DP_S_MAX;
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
} else {
|
} else {
|
||||||
state = DP_S_MOD;
|
state = DP_S_MOD;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -306,7 +306,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
|||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'i':
|
case 'i':
|
||||||
if (cflags == DP_C_SHORT)
|
if (cflags == DP_C_SHORT)
|
||||||
value = va_arg (args, int);
|
value = va_arg (args, int);
|
||||||
else if (cflags == DP_C_LONG)
|
else if (cflags == DP_C_LONG)
|
||||||
value = va_arg (args, long int);
|
value = va_arg (args, long int);
|
||||||
@ -489,12 +489,12 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxlen != 0) {
|
if (maxlen != 0) {
|
||||||
if (currlen < maxlen - 1)
|
if (currlen < maxlen - 1)
|
||||||
buffer[currlen] = '\0';
|
buffer[currlen] = '\0';
|
||||||
else if (maxlen > 0)
|
else if (maxlen > 0)
|
||||||
buffer[maxlen - 1] = '\0';
|
buffer[maxlen - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return currlen < INT_MAX ? (int)currlen : -1;
|
return currlen < INT_MAX ? (int)currlen : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,11 +514,11 @@ fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
|
|
||||||
for (strln = 0; strln < max && value[strln]; ++strln); /* strlen */
|
for (strln = 0; strln < max && value[strln]; ++strln); /* strlen */
|
||||||
padlen = min - strln;
|
padlen = min - strln;
|
||||||
if (padlen < 0)
|
if (padlen < 0)
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
if (flags & DP_F_MINUS)
|
if (flags & DP_F_MINUS)
|
||||||
padlen = -padlen; /* Left Justify */
|
padlen = -padlen; /* Left Justify */
|
||||||
|
|
||||||
while ((padlen > 0) && (cnt < max)) {
|
while ((padlen > 0) && (cnt < max)) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, ' ');
|
DOPR_OUTCH(buffer, *currlen, maxlen, ' ');
|
||||||
--padlen;
|
--padlen;
|
||||||
@ -550,12 +550,12 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
int spadlen = 0; /* amount to space pad */
|
int spadlen = 0; /* amount to space pad */
|
||||||
int zpadlen = 0; /* amount to zero pad */
|
int zpadlen = 0; /* amount to zero pad */
|
||||||
int caps = 0;
|
int caps = 0;
|
||||||
|
|
||||||
if (max < 0)
|
if (max < 0)
|
||||||
max = 0;
|
max = 0;
|
||||||
|
|
||||||
uvalue = value;
|
uvalue = value;
|
||||||
|
|
||||||
if(!(flags & DP_F_UNSIGNED)) {
|
if(!(flags & DP_F_UNSIGNED)) {
|
||||||
if( value < 0 ) {
|
if( value < 0 ) {
|
||||||
signvalue = '-';
|
signvalue = '-';
|
||||||
@ -567,7 +567,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
signvalue = ' ';
|
signvalue = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
|
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -587,7 +587,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
zpadlen = MAX(zpadlen, spadlen);
|
zpadlen = MAX(zpadlen, spadlen);
|
||||||
spadlen = 0;
|
spadlen = 0;
|
||||||
}
|
}
|
||||||
if (flags & DP_F_MINUS)
|
if (flags & DP_F_MINUS)
|
||||||
spadlen = -spadlen; /* Left Justifty */
|
spadlen = -spadlen; /* Left Justifty */
|
||||||
|
|
||||||
#ifdef DEBUG_SNPRINTF
|
#ifdef DEBUG_SNPRINTF
|
||||||
@ -602,7 +602,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sign */
|
/* Sign */
|
||||||
if (signvalue)
|
if (signvalue)
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
||||||
|
|
||||||
/* Zeros */
|
/* Zeros */
|
||||||
@ -618,7 +618,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
--place;
|
--place;
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, convert[place]);
|
DOPR_OUTCH(buffer, *currlen, maxlen, convert[place]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Left Justified spaces */
|
/* Left Justified spaces */
|
||||||
while (spadlen < 0) {
|
while (spadlen < 0) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, ' ');
|
DOPR_OUTCH(buffer, *currlen, maxlen, ' ');
|
||||||
@ -633,19 +633,19 @@ static LDOUBLE abs_val(LDOUBLE value)
|
|||||||
|
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
result = -value;
|
result = -value;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LDOUBLE POW10(int val)
|
static LDOUBLE POW10(int val)
|
||||||
{
|
{
|
||||||
LDOUBLE result = 1;
|
LDOUBLE result = 1;
|
||||||
|
|
||||||
while (val) {
|
while (val) {
|
||||||
result *= 10;
|
result *= 10;
|
||||||
val--;
|
val--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,7 +656,7 @@ static LLONG ROUND(LDOUBLE value)
|
|||||||
intpart = (LLONG)value;
|
intpart = (LLONG)value;
|
||||||
value = value - intpart;
|
value = value - intpart;
|
||||||
if (value >= 0.5) intpart++;
|
if (value >= 0.5) intpart++;
|
||||||
|
|
||||||
return intpart;
|
return intpart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ static double my_modf(double x0, double *iptr)
|
|||||||
ret = my_modf(x0-l*f, &i2);
|
ret = my_modf(x0-l*f, &i2);
|
||||||
(*iptr) = l*f + i2;
|
(*iptr) = l*f + i2;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*iptr) = l;
|
(*iptr) = l;
|
||||||
return x - (*iptr);
|
return x - (*iptr);
|
||||||
@ -710,14 +710,14 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
int iplace = 0;
|
int iplace = 0;
|
||||||
int fplace = 0;
|
int fplace = 0;
|
||||||
int padlen = 0; /* amount to pad */
|
int padlen = 0; /* amount to pad */
|
||||||
int zpadlen = 0;
|
int zpadlen = 0;
|
||||||
int caps = 0;
|
int caps = 0;
|
||||||
int idx;
|
int idx;
|
||||||
double intpart;
|
double intpart;
|
||||||
double fracpart;
|
double fracpart;
|
||||||
double temp;
|
double temp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AIX manpage says the default is 0, but Solaris says the default
|
* AIX manpage says the default is 0, but Solaris says the default
|
||||||
* is 6, and sprintf on AIX defaults to 6
|
* is 6, and sprintf on AIX defaults to 6
|
||||||
*/
|
*/
|
||||||
@ -745,8 +745,8 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */
|
if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sorry, we only support 16 digits past the decimal because of our
|
* Sorry, we only support 16 digits past the decimal because of our
|
||||||
* conversion method
|
* conversion method
|
||||||
*/
|
*/
|
||||||
if (max > 16)
|
if (max > 16)
|
||||||
@ -760,7 +760,7 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
my_modf(temp, &intpart);
|
my_modf(temp, &intpart);
|
||||||
|
|
||||||
fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
|
fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
|
||||||
|
|
||||||
if (fracpart >= POW10(max)) {
|
if (fracpart >= POW10(max)) {
|
||||||
intpart++;
|
intpart++;
|
||||||
fracpart -= POW10(max);
|
fracpart -= POW10(max);
|
||||||
@ -794,16 +794,16 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
if (fplace == 311) fplace--;
|
if (fplace == 311) fplace--;
|
||||||
}
|
}
|
||||||
fconvert[fplace] = 0;
|
fconvert[fplace] = 0;
|
||||||
|
|
||||||
/* -1 for decimal point, another -1 if we are printing a sign */
|
/* -1 for decimal point, another -1 if we are printing a sign */
|
||||||
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
||||||
zpadlen = max - fplace;
|
zpadlen = max - fplace;
|
||||||
if (zpadlen < 0) zpadlen = 0;
|
if (zpadlen < 0) zpadlen = 0;
|
||||||
if (padlen < 0)
|
if (padlen < 0)
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
if (flags & DP_F_MINUS)
|
if (flags & DP_F_MINUS)
|
||||||
padlen = -padlen; /* Left Justifty */
|
padlen = -padlen; /* Left Justifty */
|
||||||
|
|
||||||
if ((flags & DP_F_ZERO) && (padlen > 0)) {
|
if ((flags & DP_F_ZERO) && (padlen > 0)) {
|
||||||
if (signvalue) {
|
if (signvalue) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
||||||
@ -819,9 +819,9 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
DOPR_OUTCH(buffer, *currlen, maxlen, ' ');
|
DOPR_OUTCH(buffer, *currlen, maxlen, ' ');
|
||||||
--padlen;
|
--padlen;
|
||||||
}
|
}
|
||||||
if (signvalue)
|
if (signvalue)
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
||||||
|
|
||||||
while (iplace > 0) {
|
while (iplace > 0) {
|
||||||
--iplace;
|
--iplace;
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, iconvert[iplace]);
|
DOPR_OUTCH(buffer, *currlen, maxlen, iconvert[iplace]);
|
||||||
@ -837,7 +837,7 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
|||||||
*/
|
*/
|
||||||
if (max > 0) {
|
if (max > 0) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, '.');
|
DOPR_OUTCH(buffer, *currlen, maxlen, '.');
|
||||||
|
|
||||||
while (zpadlen > 0) {
|
while (zpadlen > 0) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, '0');
|
DOPR_OUTCH(buffer, *currlen, maxlen, '0');
|
||||||
--zpadlen;
|
--zpadlen;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user