summaryrefslogtreecommitdiff
path: root/usr.sbin/ypserv/stdethers/stdethers.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-19 02:38:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-19 02:38:41 +0000
commite2e599c8ed62c4886dfcebc74b0d3bf7436b418e (patch)
tree9a49861d623e3d5520a4114bbb545f3beb994dcf /usr.sbin/ypserv/stdethers/stdethers.c
parent1cccfea064ca712bce2bfdebd5da7f086362a656 (diff)
4344 lines of KNF diff
Diffstat (limited to 'usr.sbin/ypserv/stdethers/stdethers.c')
-rw-r--r--usr.sbin/ypserv/stdethers/stdethers.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/usr.sbin/ypserv/stdethers/stdethers.c b/usr.sbin/ypserv/stdethers/stdethers.c
index e4c92bad2f8..37c4706ce34 100644
--- a/usr.sbin/ypserv/stdethers/stdethers.c
+++ b/usr.sbin/ypserv/stdethers/stdethers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdethers.c,v 1.4 2001/11/19 09:01:29 deraadt Exp $ */
+/* $OpenBSD: stdethers.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $ */
/*
* Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se>
@@ -32,7 +32,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: stdethers.c,v 1.4 2001/11/19 09:01:29 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: stdethers.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $";
#endif
#include <sys/types.h>
@@ -60,8 +60,7 @@ extern char *ether_ntoa(struct ether_addr *);
*/
char *
-working_ntoa(e)
- u_char *e;
+working_ntoa(u_char *e)
{
static char a[] = "xx:xx:xx:xx:xx:xx";
@@ -71,10 +70,8 @@ working_ntoa(e)
}
#endif
-static int read_line(fp, buf, size)
-FILE *fp;
-char *buf;
-int size;
+static int
+read_line(FILE *fp, char *buf, int size)
{
int done = 0;
@@ -85,6 +82,7 @@ int size;
if (len > 1 && buf[len-2] == '\\' &&
buf[len-1] == '\n') {
int ch;
+
buf += len - 2;
size -= len - 2;
*buf = '\n';
@@ -105,9 +103,7 @@ int size;
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
FILE *data_file;
char data_line[1024];
@@ -117,15 +113,15 @@ main(argc, argv)
char *p, *k, *v;
struct ether_addr eth_addr;
char hostname[256];
-
+
if (argc > 2)
usage++;
-
+
if (usage) {
fprintf(stderr, "usage: %s [file]\n", ProgramName);
exit(1);
}
-
+
if (argc == 2) {
data_file = fopen(argv[1], "r");
if (data_file == NULL) {
@@ -135,19 +131,19 @@ main(argc, argv)
}
} else
data_file = stdin;
-
+
while (read_line(data_file, data_line, sizeof(data_line))) {
line_no++;
len = strlen(data_line);
-
+
if (len > 0) {
if (data_line[0] == '#')
continue;
}
-
+
/*
* Check if we have the whole line
- */
+ */
if (data_line[len-1] != '\n') {
if (argc == 2) {
fprintf(stderr,
@@ -160,19 +156,19 @@ main(argc, argv)
}
} else
data_line[len-1] = '\0';
-
+
p = (char *) &data_line;
-
+
k = p; /* save start of key */
while (!isspace(*p)) /* find first "space" */
p++;
while (isspace(*p)) /* move over "space" */
p++;
-
+
v = p; /* save start of value */
- while(*p != '\0') /* find end of string */
+ while (*p != '\0') /* find end of string */
p++;
-
+
if (ether_line(data_line, &eth_addr, hostname) == 0) {
fprintf(stdout, "%s\t%s\n", NTOA(&eth_addr),
hostname);