Deleted Added
full compact
netcmds.c (23012) netcmds.c (31522)
1/*-
2 * Copyright (c) 1980, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35/*
36static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
37*/
38static const char rcsid[] =
1/*-
2 * Copyright (c) 1980, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35/*
36static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
37*/
38static const char rcsid[] =
39 "$Id$";
39 "$Id: netcmds.c,v 1.6 1997/02/22 19:57:16 peter Exp $";
40#endif /* not lint */
41
42/*
43 * Common network command support routines.
44 */
45#include <sys/param.h>
46#include <sys/queue.h>
47#include <sys/socket.h>

--- 30 unchanged lines hidden (view full) ---

78static int selecthost __P((struct in_addr *, int));
79static void showhosts __P((void));
80
81int
82netcmd(cmd, args)
83 char *cmd, *args;
84{
85
40#endif /* not lint */
41
42/*
43 * Common network command support routines.
44 */
45#include <sys/param.h>
46#include <sys/queue.h>
47#include <sys/socket.h>

--- 30 unchanged lines hidden (view full) ---

78static int selecthost __P((struct in_addr *, int));
79static void showhosts __P((void));
80
81int
82netcmd(cmd, args)
83 char *cmd, *args;
84{
85
86 if (prefix(cmd, "tcp") || prefix(cmd, "udp")) {
87 selectproto(cmd);
86 if (prefix(cmd, "proto")) {
87 if (*args == '\0') {
88 move(CMDLINE, 0);
89 clrtoeol();
90 addstr("which proto?");
91 } else if (!selectproto(args)) {
92 error("%s: Unknown protocol.", args);
93 }
88 return (1);
89 }
90 if (prefix(cmd, "ignore") || prefix(cmd, "display")) {
91 changeitems(args, prefix(cmd, "display"));
92 return (1);
93 }
94 if (prefix(cmd, "reset")) {
95 selectproto(0);

--- 65 unchanged lines hidden (view full) ---

161 selecthost(&in, onoff);
162 }
163}
164
165static int
166selectproto(proto)
167 char *proto;
168{
94 return (1);
95 }
96 if (prefix(cmd, "ignore") || prefix(cmd, "display")) {
97 changeitems(args, prefix(cmd, "display"));
98 return (1);
99 }
100 if (prefix(cmd, "reset")) {
101 selectproto(0);

--- 65 unchanged lines hidden (view full) ---

167 selecthost(&in, onoff);
168 }
169}
170
171static int
172selectproto(proto)
173 char *proto;
174{
169 int new = protos;
170
171 if (proto == 0 || streq(proto, "all"))
175
176 if (proto == 0 || streq(proto, "all"))
172 new = TCP|UDP;
177 protos = TCP | UDP;
173 else if (streq(proto, "tcp"))
178 else if (streq(proto, "tcp"))
174 new = TCP;
179 protos = TCP;
175 else if (streq(proto, "udp"))
180 else if (streq(proto, "udp"))
176 new = UDP;
177 return (new != protos, protos = new);
181 protos = UDP;
182 else
183 return (0);
184
185 return (protos);
178}
179
180static void
181showprotos()
182{
183
184 if ((protos&TCP) == 0)
185 addch('!');

--- 127 unchanged lines hidden ---
186}
187
188static void
189showprotos()
190{
191
192 if ((protos&TCP) == 0)
193 addch('!');

--- 127 unchanged lines hidden ---