remove trailing whitespace
This commit is contained in:
@@ -78,7 +78,7 @@ roken_vmconcat (char **s, size_t max_len, va_list args)
|
||||
len = 1;
|
||||
while ((a = va_arg(args, const char*))) {
|
||||
size_t n = strlen (a);
|
||||
|
||||
|
||||
if(max_len && len + n > max_len){
|
||||
free(p);
|
||||
return 0;
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -149,7 +149,7 @@ int teardown_test(void)
|
||||
!strcmp(dirname + len + 1 - sizeof(TESTDIR)/sizeof(char), TESTDIR)) {
|
||||
|
||||
/* fallthrough */
|
||||
|
||||
|
||||
} else {
|
||||
/* did we create the directory? */
|
||||
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include<config.h>
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
|
@@ -1,33 +1,33 @@
|
||||
.\" Copyright (c) 2001, 2003 Kungliga Tekniska Högskolan
|
||||
.\" (Royal Institute of Technology, Stockholm, Sweden).
|
||||
.\" All rights reserved.
|
||||
.\" (Royal Institute of Technology, Stockholm, Sweden).
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\"
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\"
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 3. Neither the name of the Institute nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\" 3. Neither the name of the Institute nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd August 14, 2003
|
||||
@@ -61,13 +61,13 @@ The roken library (libroken, -lroken)
|
||||
.Ft ssize_t
|
||||
.Fn ewrite "int fd" "const void *buf" "size_t nbytes"
|
||||
.Sh DESCRIPTION
|
||||
These functions do the same as the ones without the
|
||||
These functions do the same as the ones without the
|
||||
.Dq e
|
||||
prefix, but if there is an error they will print a message with
|
||||
prefix, but if there is an error they will print a message with
|
||||
.Xr errx 3 ,
|
||||
and exit. For
|
||||
.Nm eread
|
||||
and
|
||||
and
|
||||
.Nm ewrite
|
||||
this is also true for partial data.
|
||||
.Pp
|
||||
|
@@ -153,7 +153,7 @@ rangematch(const char *pattern, int test, int flags)
|
||||
*/
|
||||
if (negate = (*pattern == '!' || *pattern == '^'))
|
||||
++pattern;
|
||||
|
||||
|
||||
for (ok = 0; (c = *pattern++) != ']';) {
|
||||
if (c == '\\' && !(flags & FNM_NOESCAPE))
|
||||
c = *pattern++;
|
||||
|
@@ -91,7 +91,7 @@ get_window_size(int fd, int *lines, int *columns)
|
||||
#elif defined(HAVE__SCRSIZE)
|
||||
{
|
||||
int dst[2];
|
||||
|
||||
|
||||
_scrsize(dst);
|
||||
if (lines)
|
||||
*lines = dst[1];
|
||||
|
@@ -65,7 +65,7 @@ roken_getaddrinfo_hostspec2(const char *hostspec,
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
||||
hints.ai_socktype = socktype;
|
||||
|
||||
|
||||
for(hstp = hst; hstp->prefix; hstp++) {
|
||||
if(strncmp(hostspec, hstp->prefix, strlen(hstp->prefix)) == 0) {
|
||||
hints.ai_socktype = hstp->socktype;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
.\" Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
|
||||
.\" (Royal Institute of Technology, Stockholm, Sweden).
|
||||
.\" All rights reserved.
|
||||
.\" (Royal Institute of Technology, Stockholm, Sweden).
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\"
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\"
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 3. Neither the name of the Institute nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\" 3. Neither the name of the Institute nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.Dd September 24, 1999
|
||||
.Dt GETARG 3
|
||||
|
@@ -43,7 +43,7 @@
|
||||
#elif defined(HAVE_DB_H)
|
||||
#include <db.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
@@ -238,7 +238,7 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
||||
int myfd = 0, eof, foundit;
|
||||
char *record;
|
||||
int tc_not_resolved;
|
||||
|
||||
|
||||
/*
|
||||
* Return with ``loop detected'' error if we've recursed more than
|
||||
* MAX_RECURSION times.
|
||||
@@ -356,7 +356,7 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
||||
for (;;) {
|
||||
if (bp >= b_end) {
|
||||
int n;
|
||||
|
||||
|
||||
n = read(fd, buf, sizeof(buf));
|
||||
if (n <= 0) {
|
||||
if (myfd)
|
||||
@@ -373,7 +373,7 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
||||
b_end = buf+n;
|
||||
bp = buf;
|
||||
}
|
||||
|
||||
|
||||
c = *bp++;
|
||||
if (c == '\n') {
|
||||
if (slash) {
|
||||
@@ -442,13 +442,13 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
||||
*/
|
||||
if (eof)
|
||||
break;
|
||||
|
||||
|
||||
/*
|
||||
* Toss blank lines and comments.
|
||||
*/
|
||||
if (*record == '\0' || *record == '#')
|
||||
continue;
|
||||
|
||||
|
||||
/*
|
||||
* See if this is the record we want ...
|
||||
*/
|
||||
@@ -524,11 +524,11 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
||||
tc_not_resolved = 1;
|
||||
/* couldn't resolve tc */
|
||||
if (iret == -1) {
|
||||
*(s - 1) = ':';
|
||||
*(s - 1) = ':';
|
||||
scan = s - 1;
|
||||
tc_not_resolved = 1;
|
||||
continue;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/* not interested in name field of tc'ed record */
|
||||
@@ -591,7 +591,7 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
||||
*/
|
||||
scan = s-1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* Close file (if we opened it), give back any extra memory, and
|
||||
@@ -606,12 +606,12 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
||||
errno = ENOMEM;
|
||||
return (-2);
|
||||
}
|
||||
|
||||
|
||||
*cap = record;
|
||||
if (tc_not_resolved)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_DB
|
||||
static int
|
||||
@@ -640,7 +640,7 @@ cdbget(DB *capdbp, char **bp, const char *name)
|
||||
key.data = (char *)data.data + 1;
|
||||
key.size = data.size - 1;
|
||||
}
|
||||
|
||||
|
||||
*bp = (char *)data.data + 1;
|
||||
return (((char *)(data.data))[0] == TCERR ? 1 : 0);
|
||||
}
|
||||
@@ -775,7 +775,7 @@ cgetnext(char **bp, char **db_array)
|
||||
slash = 1;
|
||||
else
|
||||
slash = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -1116,10 +1116,10 @@ nfcmp(char *nf, char *rec)
|
||||
{
|
||||
char *cp, tmp;
|
||||
int ret;
|
||||
|
||||
|
||||
for (cp = rec; *cp != ':'; cp++)
|
||||
;
|
||||
|
||||
|
||||
tmp = *(cp + 1);
|
||||
*(cp + 1) = '\0';
|
||||
ret = strcmp(nf, rec);
|
||||
|
@@ -70,7 +70,7 @@ print_addr(const char *s, struct sockaddr *sa)
|
||||
for(i = 0; i < sa->sa_len - ((long)sa->sa_data - (long)&sa->sa_family); i++)
|
||||
printf("%02x", ((unsigned char*)sa->sa_data)[i]);
|
||||
#else
|
||||
for(i = 0; i < sizeof(sa->sa_data); i++)
|
||||
for(i = 0; i < sizeof(sa->sa_data); i++)
|
||||
printf("%02x", ((unsigned char*)sa->sa_data)[i]);
|
||||
#endif
|
||||
printf("\n");
|
||||
@@ -80,16 +80,16 @@ static void
|
||||
print_ifaddrs(struct ifaddrs *x)
|
||||
{
|
||||
struct ifaddrs *p;
|
||||
|
||||
|
||||
for(p = x; p; p = p->ifa_next) {
|
||||
if (verbose_counter) {
|
||||
printf("%s\n", p->ifa_name);
|
||||
printf(" flags=%x\n", p->ifa_flags);
|
||||
if(p->ifa_addr)
|
||||
print_addr("addr", p->ifa_addr);
|
||||
if(p->ifa_dstaddr)
|
||||
if(p->ifa_dstaddr)
|
||||
print_addr("dstaddr", p->ifa_dstaddr);
|
||||
if(p->ifa_netmask)
|
||||
if(p->ifa_netmask)
|
||||
print_addr("netmask", p->ifa_netmask);
|
||||
printf(" %p\n", p->ifa_data);
|
||||
}
|
||||
|
@@ -632,7 +632,7 @@ rk_getifaddrs(struct ifaddrs **ifap)
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!build){
|
||||
if (max_ifindex < nlm_index)
|
||||
max_ifindex = nlm_index;
|
||||
@@ -993,7 +993,7 @@ getifaddrs2(struct ifaddrs **ifap,
|
||||
(*end)->ifa_data = NULL;
|
||||
|
||||
end = &(*end)->ifa_next;
|
||||
|
||||
|
||||
}
|
||||
*ifap = start;
|
||||
close(fd);
|
||||
@@ -1139,7 +1139,7 @@ getlifaddrs2(struct ifaddrs **ifap,
|
||||
(*end)->ifa_data = NULL;
|
||||
|
||||
end = &(*end)->ifa_next;
|
||||
|
||||
|
||||
}
|
||||
*ifap = start;
|
||||
close(fd);
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include<config.h>
|
||||
@@ -83,7 +83,7 @@ rk_getifaddrs(struct ifaddrs **ifpp)
|
||||
|
||||
free (il);
|
||||
il = NULL;
|
||||
|
||||
|
||||
if (WSAGetLastError() == WSAEFAULT && cbret > il_len) {
|
||||
il_len = cbret;
|
||||
} else {
|
||||
@@ -134,7 +134,7 @@ rk_getifaddrs(struct ifaddrs **ifpp)
|
||||
|
||||
if (il)
|
||||
free (il);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -142,15 +142,15 @@ void ROKEN_LIB_FUNCTION
|
||||
rk_freeifaddrs(struct ifaddrs *ifp)
|
||||
{
|
||||
struct ifaddrs *p, *q;
|
||||
|
||||
|
||||
for(p = ifp; p; ) {
|
||||
if (p->ifa_name)
|
||||
free(p->ifa_name);
|
||||
if(p->ifa_addr)
|
||||
free(p->ifa_addr);
|
||||
if(p->ifa_dstaddr)
|
||||
if(p->ifa_dstaddr)
|
||||
free(p->ifa_dstaddr);
|
||||
if(p->ifa_netmask)
|
||||
if(p->ifa_netmask)
|
||||
free(p->ifa_netmask);
|
||||
if(p->ifa_data)
|
||||
free(p->ifa_data);
|
||||
|
@@ -384,14 +384,14 @@ globtilde(const Char *pattern, Char *patbuf, glob_t *pglob)
|
||||
/* Copy the home directory */
|
||||
for (b = patbuf; *h; *b++ = *h++)
|
||||
continue;
|
||||
|
||||
|
||||
/* Append the rest of the pattern */
|
||||
while ((*b++ = *p++) != CHAR_EOS)
|
||||
continue;
|
||||
|
||||
return patbuf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The main glob() routine: compiles the pattern (optionally processing
|
||||
@@ -532,7 +532,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pattern, glob_t *pglob,
|
||||
*pathend = CHAR_EOS;
|
||||
if (g_lstat(pathbuf, &sb, pglob))
|
||||
return(0);
|
||||
|
||||
|
||||
if (((pglob->gl_flags & GLOB_MARK) &&
|
||||
pathend[-1] != CHAR_SEP) && (S_ISDIR(sb.st_mode)
|
||||
|| (S_ISLNK(sb.st_mode) &&
|
||||
@@ -585,7 +585,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
|
||||
|
||||
*pathend = CHAR_EOS;
|
||||
errno = 0;
|
||||
|
||||
|
||||
if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
|
||||
/* TODO: don't call for ENOENT or ENOTDIR? */
|
||||
if (pglob->gl_errfunc) {
|
||||
|
@@ -86,7 +86,7 @@ hex_decode(const char *str, void *data, size_t len)
|
||||
size_t l;
|
||||
unsigned char *p = data;
|
||||
size_t i;
|
||||
|
||||
|
||||
l = strlen(str);
|
||||
|
||||
/* check for overflow, same as (l+1)/2 but overflow safe */
|
||||
|
@@ -66,7 +66,7 @@ main(int argc, char **argv)
|
||||
if (sz != tests[i].size)
|
||||
errx(1, "sz (%lu) != tests[%d].size (%lu)",
|
||||
(unsigned long)sz, i, (unsigned long)tests[i].size);
|
||||
|
||||
|
||||
for (buf_sz = 0; buf_sz < tests[i].size + 2; buf_sz++) {
|
||||
|
||||
buf = rk_test_mem_alloc(RK_TM_OVERRUN, "overrun",
|
||||
|
@@ -1,33 +1,33 @@
|
||||
.\" Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
.\" (Royal Institute of Technology, Stockholm, Sweden).
|
||||
.\" All rights reserved.
|
||||
.\" (Royal Institute of Technology, Stockholm, Sweden).
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\"
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\"
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 3. Neither the name of the Institute nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\" 3. Neither the name of the Institute nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd October 31, 2004
|
||||
@@ -52,13 +52,13 @@ The roken library (libroken, -lroken)
|
||||
.Ft size_t
|
||||
.Fn unparse_time_approx "int seconds" "char *buf" "size_t len"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
The
|
||||
.Fn parse_time
|
||||
function converts a the period of time specified in
|
||||
into a number of seconds.
|
||||
The
|
||||
The
|
||||
.Fa timespec
|
||||
can be any number of
|
||||
can be any number of
|
||||
.Aq number unit
|
||||
pairs separated by comma and whitespace. The number can be
|
||||
negative. Number without explicit units are taken as being
|
||||
@@ -68,12 +68,12 @@ The
|
||||
.Fn unparse_time
|
||||
and
|
||||
.Fn unparse_time_approx
|
||||
does the opposite of
|
||||
does the opposite of
|
||||
.Fn parse_time ,
|
||||
that is they take a number of seconds and express that as human
|
||||
readable string.
|
||||
readable string.
|
||||
.Fa unparse_time
|
||||
produces an exact time, while
|
||||
produces an exact time, while
|
||||
.Fa unparse_time_approx
|
||||
restricts the result to only include one units.
|
||||
.Pp
|
||||
@@ -99,13 +99,13 @@ Units names can be arbitrarily abbreviated (as long as they are
|
||||
unique).
|
||||
.Sh RETURN VALUES
|
||||
.Fn parse_time
|
||||
returns the number of seconds that represents the expression in
|
||||
returns the number of seconds that represents the expression in
|
||||
.Fa timespec
|
||||
or -1 on error.
|
||||
.Fn unparse_time
|
||||
and
|
||||
.Fn unparse_time_approx
|
||||
return the number of characters written to
|
||||
and
|
||||
.Fn unparse_time_approx
|
||||
return the number of characters written to
|
||||
.Fa buf .
|
||||
if the return value is greater than or equal to the
|
||||
.Fa len
|
||||
@@ -140,7 +140,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
.Ed
|
||||
.Bd -literal
|
||||
$ ./a.out "1 minute 30 seconds" "90 s" "1 y -1 s"
|
||||
$ ./a.out "1 minute 30 seconds" "90 s" "1 y -1 s"
|
||||
1 year = 365 days
|
||||
1 month = 30 days
|
||||
1 week = 7 days
|
||||
|
@@ -125,7 +125,7 @@ loop: SWAPINIT(a, es);
|
||||
swap_cnt = 0;
|
||||
if (n < 7) {
|
||||
for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
|
||||
for (pl = pm;
|
||||
for (pl = pm;
|
||||
pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
|
||||
pl -= es)
|
||||
swap(pl, pl - es);
|
||||
@@ -173,7 +173,7 @@ loop: SWAPINIT(a, es);
|
||||
}
|
||||
if (swap_cnt == 0) { /* Switch to insertion sort */
|
||||
for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
|
||||
for (pl = pm;
|
||||
for (pl = pm;
|
||||
pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
|
||||
pl -= es)
|
||||
swap(pl, pl - es);
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2010, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
|
@@ -528,7 +528,7 @@ dns_lookup_int(const char *domain, int rr_class, int rr_type)
|
||||
struct sockaddr_storage from;
|
||||
uint32_t fromsize = sizeof(from);
|
||||
dns_handle_t handle;
|
||||
|
||||
|
||||
handle = dns_open(NULL);
|
||||
if (handle == NULL)
|
||||
return NULL;
|
||||
|
@@ -107,9 +107,9 @@ open_pty(void)
|
||||
{
|
||||
char *clone[] = {
|
||||
"/dev/ptc",
|
||||
"/dev/ptmx",
|
||||
"/dev/ptmx",
|
||||
"/dev/ptm",
|
||||
"/dev/ptym/clone",
|
||||
"/dev/ptym/clone",
|
||||
NULL
|
||||
};
|
||||
char **q;
|
||||
@@ -372,7 +372,7 @@ main(int argc, char **argv)
|
||||
sa.sa_handler = caught_signal;
|
||||
sa.sa_flags = 0;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
|
||||
|
||||
sigaction(SIGALRM, &sa, NULL);
|
||||
}
|
||||
|
||||
|
@@ -191,12 +191,12 @@ roken_gethostby(const char *hostname)
|
||||
static char addrs[4 * MAX_ADDRS];
|
||||
static char *addr_list[MAX_ADDRS + 1];
|
||||
int num_addrs = 0;
|
||||
|
||||
|
||||
he.h_name = p;
|
||||
he.h_aliases = NULL;
|
||||
he.h_addrtype = AF_INET;
|
||||
he.h_length = 4;
|
||||
|
||||
|
||||
while((p = strtok_r(NULL, " \t\r\n", &foo)) && num_addrs < MAX_ADDRS) {
|
||||
struct in_addr ip;
|
||||
inet_aton(p, &ip);
|
||||
|
@@ -68,23 +68,23 @@ sendmsg(rk_socket_t s, const struct msghdr *msg, int flags)
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* - Neither the name of Secure Endpoints Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -97,7 +97,7 @@ sendmsg(rk_socket_t s, const struct msghdr *msg, int flags)
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
@@ -66,7 +66,7 @@
|
||||
* @retval 128- The signal that killed the subprocess +128.
|
||||
*/
|
||||
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
|
||||
wait_for_process_timed(pid_t pid, time_t (*func)(void *),
|
||||
wait_for_process_timed(pid_t pid, time_t (*func)(void *),
|
||||
void *ptr, time_t timeout)
|
||||
{
|
||||
HANDLE hProcess;
|
||||
@@ -205,7 +205,7 @@ collect_commandline(const char * fn, va_list * ap)
|
||||
}
|
||||
|
||||
ROKEN_LIB_FUNCTION pid_t ROKEN_LIB_CALL
|
||||
pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd,
|
||||
pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd,
|
||||
const char *file, ...)
|
||||
{
|
||||
HANDLE hOut_r = NULL;
|
||||
@@ -335,7 +335,7 @@ pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd,
|
||||
|
||||
|
||||
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
|
||||
simple_execvp_timed(const char *file, char *const args[],
|
||||
simple_execvp_timed(const char *file, char *const args[],
|
||||
time_t (*func)(void *), void *ptr, time_t timeout)
|
||||
{
|
||||
intptr_t hp;
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
|
@@ -190,7 +190,7 @@ append_number(struct snprintf_state *state,
|
||||
no such wording for %x. This would mean that %#.o would
|
||||
output "0", but %#.x "". This does not make sense, and is
|
||||
also not what other printf implementations are doing. */
|
||||
|
||||
|
||||
if(prec <= nlen && nstr[nstart] != '0' && nstr[nstart] != '\0')
|
||||
prec = nlen + 1;
|
||||
}
|
||||
@@ -208,13 +208,13 @@ append_number(struct snprintf_state *state,
|
||||
width -= prec;
|
||||
else
|
||||
width -= nlen;
|
||||
|
||||
|
||||
if(use_alternative(flags, num, base))
|
||||
width -= 2;
|
||||
|
||||
|
||||
if(signchar != '\0')
|
||||
width--;
|
||||
|
||||
|
||||
/* pad to width */
|
||||
len += pad(state, width, ' ');
|
||||
}
|
||||
@@ -236,12 +236,12 @@ append_number(struct snprintf_state *state,
|
||||
} else
|
||||
/* pad to prec with zeros */
|
||||
len += pad(state, prec - nlen, '0');
|
||||
|
||||
|
||||
while(nstr[nstart] != '\0') {
|
||||
(*state->append_char)(state, nstr[nstart++]);
|
||||
++len;
|
||||
}
|
||||
|
||||
|
||||
if(flags & minus_flag)
|
||||
len += pad(state, width - len, ' ');
|
||||
|
||||
|
@@ -233,7 +233,7 @@ socket_set_portrange (rk_socket_t sock, int restr, int af)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Enable debug on `sock'.
|
||||
*/
|
||||
|
@@ -296,7 +296,7 @@ static int convert_un_in(const struct sockaddr_un *un, struct sockaddr *in, sock
|
||||
case SOCKET_TYPE_CHAR_TCP:
|
||||
case SOCKET_TYPE_CHAR_UDP: {
|
||||
struct sockaddr_in *in2 = (struct sockaddr_in *)in;
|
||||
|
||||
|
||||
if ((*len) < sizeof(*in2)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -314,7 +314,7 @@ static int convert_un_in(const struct sockaddr_un *un, struct sockaddr *in, sock
|
||||
case SOCKET_TYPE_CHAR_TCP_V6:
|
||||
case SOCKET_TYPE_CHAR_UDP_V6: {
|
||||
struct sockaddr_in6 *in2 = (struct sockaddr_in6 *)in;
|
||||
|
||||
|
||||
if ((*len) < sizeof(*in2)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -408,7 +408,7 @@ static int convert_in_un_remote(struct socket_info *si, const struct sockaddr *i
|
||||
|
||||
prt = ntohs(in->sin6_port);
|
||||
iface = SW_IPV6_ADDRESS;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -515,7 +515,7 @@ static int convert_in_un_alloc(struct socket_info *si, const struct sockaddr *in
|
||||
|
||||
prt = ntohs(in->sin6_port);
|
||||
iface = SW_IPV6_ADDRESS;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -583,7 +583,7 @@ static int sockaddr_convert_to_un(struct socket_info *si, const struct sockaddr
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
errno = EAFNOSUPPORT;
|
||||
return -1;
|
||||
}
|
||||
@@ -648,7 +648,7 @@ enum swrap_packet_type {
|
||||
|
||||
struct swrap_file_hdr {
|
||||
unsigned long magic;
|
||||
unsigned short version_major;
|
||||
unsigned short version_major;
|
||||
unsigned short version_minor;
|
||||
long timezone;
|
||||
unsigned long sigfigs;
|
||||
@@ -911,7 +911,7 @@ static int swrap_get_pcap_fd(const char *fname)
|
||||
if (fd != -1) {
|
||||
struct swrap_file_hdr file_hdr;
|
||||
file_hdr.magic = 0xA1B2C3D4;
|
||||
file_hdr.version_major = 0x0002;
|
||||
file_hdr.version_major = 0x0002;
|
||||
file_hdr.version_minor = 0x0004;
|
||||
file_hdr.timezone = 0x00000000;
|
||||
file_hdr.sigfigs = 0x00000000;
|
||||
@@ -1456,7 +1456,7 @@ static int swrap_auto_bind(struct socket_info *si)
|
||||
"%s/"SOCKET_FORMAT, socket_wrapper_dir(),
|
||||
type, socket_wrapper_default_iface(), port);
|
||||
if (stat(un_addr.sun_path, &st) == 0) continue;
|
||||
|
||||
|
||||
ret = real_bind(si->fd, (struct sockaddr *)&un_addr, sizeof(un_addr));
|
||||
if (ret == -1) return ret;
|
||||
|
||||
@@ -1683,32 +1683,32 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, con
|
||||
ret = swrap_auto_bind(si);
|
||||
if (ret == -1) return -1;
|
||||
}
|
||||
|
||||
|
||||
ret = sockaddr_convert_to_un(si, to, tolen, &un_addr, 0, &bcast);
|
||||
if (ret == -1) return -1;
|
||||
|
||||
|
||||
if (bcast) {
|
||||
struct stat st;
|
||||
unsigned int iface;
|
||||
unsigned int prt = ntohs(((const struct sockaddr_in *)to)->sin_port);
|
||||
char type;
|
||||
|
||||
|
||||
type = SOCKET_TYPE_CHAR_UDP;
|
||||
|
||||
|
||||
for(iface=0; iface <= MAX_WRAPPED_INTERFACES; iface++) {
|
||||
snprintf(un_addr.sun_path, sizeof(un_addr.sun_path), "%s/"SOCKET_FORMAT,
|
||||
socket_wrapper_dir(), type, iface, prt);
|
||||
if (stat(un_addr.sun_path, &st) != 0) continue;
|
||||
|
||||
|
||||
/* ignore the any errors in broadcast sends */
|
||||
real_sendto(s, buf, len, flags, (struct sockaddr *)&un_addr, sizeof(un_addr));
|
||||
}
|
||||
|
||||
|
||||
swrap_dump_packet(si, to, SWRAP_SENDTO, buf, len);
|
||||
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
ret = real_sendto(s, buf, len, flags, (struct sockaddr *)&un_addr, sizeof(un_addr));
|
||||
break;
|
||||
default:
|
||||
@@ -1716,7 +1716,7 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, con
|
||||
errno = EHOSTUNREACH;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* to give better errors */
|
||||
if (ret == -1 && errno == ENOENT) {
|
||||
errno = EHOSTUNREACH;
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include<config.h>
|
||||
|
@@ -286,7 +286,7 @@ strftime (char *buf, size_t maxsize, const char *format,
|
||||
"%02d:%02d",
|
||||
tm->tm_hour,
|
||||
tm->tm_min);
|
||||
|
||||
|
||||
case 's' :
|
||||
ret = snprintf (buf, maxsize - n,
|
||||
"%d", (int)mktime(rk_UNCONST(tm)));
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
@@ -26,7 +26,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
@@ -109,11 +109,11 @@ test_simple_echo_client(void)
|
||||
int rv;
|
||||
char buf[81];
|
||||
int i;
|
||||
|
||||
|
||||
fprintf(stderr, "[%s] Getting connected socket...", getprogname());
|
||||
rv = get_connected_socket(&s);
|
||||
if (rv) {
|
||||
fprintf(stderr, "\n[%s] get_connected_socket() failed (%s)\n",
|
||||
fprintf(stderr, "\n[%s] get_connected_socket() failed (%s)\n",
|
||||
getprogname(), strerror(rk_SOCK_ERRNO));
|
||||
return 1;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ test_simple_echo_client(void)
|
||||
for (i=0; i < sizeof(test_strings)/sizeof(test_strings[0]); i++) {
|
||||
rv = send(s, test_strings[i], strlen(test_strings[i]), 0);
|
||||
if (rk_IS_SOCKET_ERROR(rv)) {
|
||||
fprintf(stderr, "[%s] send() failure (%s)\n",
|
||||
fprintf(stderr, "[%s] send() failure (%s)\n",
|
||||
getprogname(), strerror(rk_SOCK_ERRNO));
|
||||
rk_closesocket(s);
|
||||
return 1;
|
||||
@@ -188,10 +188,10 @@ test_simple_echo_socket(void)
|
||||
srv = send(s, buf, rv, 0);
|
||||
if (srv != rv) {
|
||||
if (rk_IS_SOCKET_ERROR(srv))
|
||||
fprintf(stderr, "[%s] send() error [%s]\n",
|
||||
fprintf(stderr, "[%s] send() error [%s]\n",
|
||||
getprogname(), strerror(rk_SOCK_ERRNO));
|
||||
else
|
||||
fprintf(stderr, "[%s] send() size mismatch %d != %d",
|
||||
fprintf(stderr, "[%s] send() size mismatch %d != %d",
|
||||
getprogname(), srv, rv);
|
||||
}
|
||||
|
||||
|
@@ -73,53 +73,53 @@ main(int argc, char **argv)
|
||||
{ "=", 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
for(t = tests; t->string; t++) {
|
||||
/* Better not be there */
|
||||
p = (struct node *)rk_tfind((void *)t, (void **)&rootnode,
|
||||
node_compare);
|
||||
|
||||
|
||||
if (p) {
|
||||
warnx("erroneous list: found %d\n", p->order);
|
||||
numerr++;
|
||||
}
|
||||
|
||||
|
||||
/* Put node into the tree. */
|
||||
p = (struct node *) rk_tsearch((void *)t, (void **)&rootnode,
|
||||
node_compare);
|
||||
|
||||
|
||||
if (!p) {
|
||||
warnx("erroneous list: missing %d\n", t->order);
|
||||
numerr++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rk_twalk(rootnode, list_node);
|
||||
|
||||
|
||||
for(t = tests; t->string; t++) {
|
||||
/* Better be there */
|
||||
p = (struct node *) rk_tfind((void *)t, (void **)&rootnode,
|
||||
node_compare);
|
||||
|
||||
|
||||
if (!p) {
|
||||
warnx("erroneous list: missing %d\n", t->order);
|
||||
numerr++;
|
||||
}
|
||||
|
||||
|
||||
/* pull out node */
|
||||
(void) rk_tdelete((void *)t, (void **)&rootnode,
|
||||
node_compare);
|
||||
|
||||
|
||||
/* Better not be there */
|
||||
p = (struct node *) rk_tfind((void *)t, (void **)&rootnode,
|
||||
node_compare);
|
||||
|
||||
|
||||
if (p) {
|
||||
warnx("erroneous list: found %d\n", p->order);
|
||||
numerr++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return numerr;
|
||||
}
|
||||
|
@@ -183,7 +183,7 @@ rk_unvis(char *cp, int c, int *astate, int flag)
|
||||
}
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_SYNBAD);
|
||||
|
||||
|
||||
case S_META:
|
||||
if (c == '-')
|
||||
*astate = S_META1;
|
||||
@@ -194,12 +194,12 @@ rk_unvis(char *cp, int c, int *astate, int flag)
|
||||
return (UNVIS_SYNBAD);
|
||||
}
|
||||
return (0);
|
||||
|
||||
|
||||
case S_META1:
|
||||
*astate = S_GROUND;
|
||||
*cp |= c;
|
||||
return (UNVIS_VALID);
|
||||
|
||||
|
||||
case S_CTRL:
|
||||
if (c == '?')
|
||||
*cp |= 0177;
|
||||
@@ -214,7 +214,7 @@ rk_unvis(char *cp, int c, int *astate, int flag)
|
||||
* yes - and maybe a third
|
||||
*/
|
||||
*cp = (*cp << 3) + (c - '0');
|
||||
*astate = S_OCTAL3;
|
||||
*astate = S_OCTAL3;
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
@@ -233,8 +233,8 @@ rk_unvis(char *cp, int c, int *astate, int flag)
|
||||
* we were done, push back passed char
|
||||
*/
|
||||
return (UNVIS_VALIDPUSH);
|
||||
|
||||
default:
|
||||
|
||||
default:
|
||||
/*
|
||||
* decoder in unknown state - (probably uninitialized)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user