ipfilter: Adjust example returns to conform to style(9)
Adjust ipfilter's example return statements to conform to style(9). MFC after: 1 month
This commit is contained in:
@@ -92,7 +92,7 @@ copystr(char *dst, char *src)
|
|||||||
else
|
else
|
||||||
esc = 1;
|
esc = 1;
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
return dst;
|
return(dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -372,7 +372,7 @@ runconfig(void)
|
|||||||
i = select(mfd + 1, &rfd, &wfd, NULL, &tv);
|
i = select(mfd + 1, &rfd, &wfd, NULL, &tv);
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
perror("select");
|
perror("select");
|
||||||
return -1;
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
now1 = time(NULL);
|
now1 = time(NULL);
|
||||||
@@ -396,7 +396,7 @@ runconfig(void)
|
|||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -424,7 +424,7 @@ gethostport(char *str, int lnum, u_32_t *ipp, u_short *portp)
|
|||||||
if (!(hp = gethostbyname(host))) {
|
if (!(hp = gethostbyname(host))) {
|
||||||
fprintf(stderr, "%d: can't resolve hostname: %s\n",
|
fprintf(stderr, "%d: can't resolve hostname: %s\n",
|
||||||
lnum, host);
|
lnum, host);
|
||||||
return 0;
|
return(0);
|
||||||
}
|
}
|
||||||
*ipp = *(u_32_t *)hp->h_addr;
|
*ipp = *(u_32_t *)hp->h_addr;
|
||||||
}
|
}
|
||||||
@@ -439,12 +439,12 @@ gethostport(char *str, int lnum, u_32_t *ipp, u_short *portp)
|
|||||||
else {
|
else {
|
||||||
fprintf(stderr, "%d: unknown service %s\n",
|
fprintf(stderr, "%d: unknown service %s\n",
|
||||||
lnum, port);
|
lnum, port);
|
||||||
return 0;
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
*portp = 0;
|
*portp = 0;
|
||||||
return 1;
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -458,24 +458,24 @@ mapfile(char *file, size_t *sizep)
|
|||||||
fd = open(file, O_RDONLY);
|
fd = open(file, O_RDONLY);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
perror("open(mapfile)");
|
perror("open(mapfile)");
|
||||||
return NULL;
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat(fd, &sb) == -1) {
|
if (fstat(fd, &sb) == -1) {
|
||||||
perror("fstat(mapfile)");
|
perror("fstat(mapfile)");
|
||||||
close(fd);
|
close(fd);
|
||||||
return NULL;
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
|
addr = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
|
||||||
if (addr == (caddr_t)-1) {
|
if (addr == (caddr_t)-1) {
|
||||||
perror("mmap(mapfile)");
|
perror("mmap(mapfile)");
|
||||||
close(fd);
|
close(fd);
|
||||||
return NULL;
|
return(NULL);
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
*sizep = sb.st_size;
|
*sizep = sb.st_size;
|
||||||
return (char *)addr;
|
return(char *)addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ readconfig(char *filename)
|
|||||||
fp = fopen(filename, "r");
|
fp = fopen(filename, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
perror("open(configfile)");
|
perror("open(configfile)");
|
||||||
return -1;
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero((char *)&template, sizeof(template));
|
bzero((char *)&template, sizeof(template));
|
||||||
@@ -507,7 +507,7 @@ readconfig(char *filename)
|
|||||||
if (!s) {
|
if (!s) {
|
||||||
fprintf(stderr, "%d: line too long\n", num);
|
fprintf(stderr, "%d: line too long\n", num);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
@@ -743,7 +743,7 @@ readconfig(char *filename)
|
|||||||
if (errtxt)
|
if (errtxt)
|
||||||
fprintf(stderr, "%d: syntax error at \"%s\"\n", num, errtxt);
|
fprintf(stderr, "%d: syntax error at \"%s\"\n", num, errtxt);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return err;
|
return(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ ipfrule_modevent(module_t mod, int type, void *unused)
|
|||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return error;
|
return(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static moduledata_t ipfrulemod = {
|
static moduledata_t ipfrulemod = {
|
||||||
|
|||||||
@@ -60,37 +60,37 @@ int relay(ifd, ofd, rfd)
|
|||||||
{
|
{
|
||||||
case -1 :
|
case -1 :
|
||||||
case 0 :
|
case 0 :
|
||||||
return -1;
|
return(-1);
|
||||||
default :
|
default :
|
||||||
if (FD_ISSET(ifd, &rfds)) {
|
if (FD_ISSET(ifd, &rfds)) {
|
||||||
rw = read(ifd, irh, ibuff + RELAY_BUFSZ - irh);
|
rw = read(ifd, irh, ibuff + RELAY_BUFSZ - irh);
|
||||||
if (rw == -1)
|
if (rw == -1)
|
||||||
return -1;
|
return(-1);
|
||||||
if (rw == 0)
|
if (rw == 0)
|
||||||
return 0;
|
return(0);
|
||||||
irh += rw;
|
irh += rw;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
if (n && FD_ISSET(ofd, &wfds)) {
|
if (n && FD_ISSET(ofd, &wfds)) {
|
||||||
rw = write(ofd, iwt, iwh - iwt);
|
rw = write(ofd, iwt, iwh - iwt);
|
||||||
if (rw == -1)
|
if (rw == -1)
|
||||||
return -1;
|
return(-1);
|
||||||
iwt += rw;
|
iwt += rw;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
if (n && FD_ISSET(rfd, &rfds)) {
|
if (n && FD_ISSET(rfd, &rfds)) {
|
||||||
rw = read(rfd, iwh, obuff + RELAY_BUFSZ - iwh);
|
rw = read(rfd, iwh, obuff + RELAY_BUFSZ - iwh);
|
||||||
if (rw == -1)
|
if (rw == -1)
|
||||||
return -1;
|
return(-1);
|
||||||
if (rw == 0)
|
if (rw == 0)
|
||||||
return 0;
|
return(0);
|
||||||
iwh += rw;
|
iwh += rw;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
if (n && FD_ISSET(rfd, &wfds)) {
|
if (n && FD_ISSET(rfd, &wfds)) {
|
||||||
rw = write(rfd, irt, irh - irt);
|
rw = write(rfd, irt, irh - irt);
|
||||||
if (rw == -1)
|
if (rw == -1)
|
||||||
return -1;
|
return(-1);
|
||||||
irt += rw;
|
irt += rw;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user