mirror of
https://github.com/nmap/nmap.git
synced 2025-12-16 12:49:02 +00:00
Fixed indentation & style.
indent -nut -i2 -kr -br -brs -brf -l0 -bad -npcs -nprs -ncs nbase_str.c + manual adjustements.
This commit is contained in:
@@ -106,17 +106,25 @@ const char *p;
|
||||
char *needle, *q, *foundto;
|
||||
|
||||
/* Should crash if !pneedle -- this is OK */
|
||||
if (!*pneedle) return (char *) haystack;
|
||||
if (!haystack) return NULL;
|
||||
if (!*pneedle)
|
||||
return (char *)haystack;
|
||||
if (!haystack)
|
||||
return NULL;
|
||||
|
||||
needlelen = (unsigned int)strlen(pneedle);
|
||||
if (needlelen >= sizeof(buf)) {
|
||||
if (needlelen >= sizeof(buf))
|
||||
needle = (char *)safe_malloc(needlelen + 1);
|
||||
} else needle = buf;
|
||||
p = pneedle; q = needle;
|
||||
else
|
||||
needle = buf;
|
||||
|
||||
p = pneedle;
|
||||
q = needle;
|
||||
|
||||
while ((*q++ = tolower((int)(unsigned char)*p++)))
|
||||
;
|
||||
p = haystack - 1; foundto = needle;
|
||||
|
||||
p = haystack - 1;
|
||||
foundto = needle;
|
||||
while (*++p) {
|
||||
if (tolower((int)(unsigned char)*p) == *foundto) {
|
||||
if (!*++foundto) {
|
||||
@@ -125,7 +133,8 @@ needlelen = (unsigned int) strlen(pneedle);
|
||||
free(needle);
|
||||
return (char *)(p - needlelen + 1);
|
||||
}
|
||||
} else foundto = needle;
|
||||
} else
|
||||
foundto = needle;
|
||||
}
|
||||
if (needlelen >= sizeof(buf))
|
||||
free(needle);
|
||||
@@ -141,8 +150,7 @@ int Strncpy(char *dest, const char *src, size_t n) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Vsnprintf(char *s, size_t n, const char *fmt, va_list ap)
|
||||
{
|
||||
int Vsnprintf(char *s, size_t n, const char *fmt, va_list ap) {
|
||||
int ret;
|
||||
|
||||
ret = vsnprintf(s, n, fmt, ap);
|
||||
@@ -153,8 +161,7 @@ int Vsnprintf(char *s, size_t n, const char *fmt, va_list ap)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Snprintf(char *s, size_t n, const char *fmt, ...)
|
||||
{
|
||||
int Snprintf(char *s, size_t n, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
@@ -213,6 +220,7 @@ int alloc_vsprintf(char **strp, const char *fmt, va_list va) {
|
||||
printable (as defined by isprint()) */
|
||||
int stringisprintable(const char *str, int strlength) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
if (!isprint((int)(unsigned char)str[i]))
|
||||
return 0;
|
||||
@@ -223,6 +231,7 @@ int stringisprintable(const char *str, int strlength) {
|
||||
/* Convert non-printable characters to replchar in the string */
|
||||
void replacenonprintable(char *str, int strlength, char replchar) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
if (!isprint((int)(unsigned char)str[i]))
|
||||
str[i] = replchar;
|
||||
|
||||
Reference in New Issue
Block a user