summaryrefslogtreecommitdiff
path: root/pfinet
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-11-29 15:59:35 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-11-29 15:59:35 +0000
commit1b15ef2a426b18aa9f07307f07e5d89c8385220d (patch)
tree97a17e0b9e6369bf9793e06399b949edeb01baa6 /pfinet
parent66c38dfb1b5cbadb1a1c8813be5d8449fa21eb3c (diff)
Formerly main.c.~14~
Diffstat (limited to 'pfinet')
-rw-r--r--pfinet/main.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/pfinet/main.c b/pfinet/main.c
index a9889110..f925f144 100644
--- a/pfinet/main.c
+++ b/pfinet/main.c
@@ -20,6 +20,8 @@
#include "pfinet.h"
#include <unistd.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
int trivfs_fstype = FSTYPE_MISC;
int trivfs_fsid;
@@ -51,9 +53,12 @@ main (int argc,
{
mach_port_t bootstrap;
error_t err;
- volatile int hold = 1;
- while (hold);
+ if (argc != 3)
+ {
+ fprintf (stderr, "Usage: %s host-addr ether-device-name\n", argv[0]);
+ exit (1);
+ }
/* Talk to parent and link us in. */
task_get_bootstrap_port (mach_task_self (), &bootstrap);
@@ -84,30 +89,25 @@ main (int argc,
init_devices ();
init_time ();
- setup_ethernet_device ();
+ setup_ethernet_device (argv[2]);
inet_proto_init (0);
/* XXX Simulate what should be user-level initialization */
/* Simulate SIOCSIFADDR call. */
{
- char addr[4];
-
- /* 128.52.46.37 is turing.gnu.ai.mit.edu. */
- addr[0] = 128;
- addr[1] = 52;
- addr[2] = 46;
- addr[3] = 37;
- ether_dev.pa_addr = *(u_long *)addr;
-
- /* Mask is 255.255.255.0. */
- addr[0] = addr[1] = addr[2] = 255;
- addr[3] = 0;
- ether_dev.pa_mask = *(u_long *)addr;
-
- ether_dev.family = AF_INET;
- ether_dev.pa_brdaddr = ether_dev.pa_addr | ~ether_dev.pa_mask;
- }
+ char addr[4];
+
+ ether_dev.pa_addr = inet_addr (argv[1]);
+
+ /* Mask is 255.255.255.0. */
+ addr[0] = addr[1] = addr[2] = 255;
+ addr[3] = 0;
+ ether_dev.pa_mask = *(u_long *)addr;
+
+ ether_dev.family = AF_INET;
+ ether_dev.pa_brdaddr = ether_dev.pa_addr | ~ether_dev.pa_mask;
+ }
/* Simulate SIOCADDRT call */
{