summaryrefslogtreecommitdiff
path: root/net/cnet/files
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1998-02-08 20:02:51 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1998-02-08 20:02:51 +0000
commitb8ec8425708cc90376f3cfc16c6e0f0b3cc6e2f2 (patch)
treed06cbfb32ce7135e1b5271429d33dce1b5e39d6c /net/cnet/files
parentUpgrade to version 3.9.0. (diff)
New port: cnet - a graphical network simulator.
Notes
Notes: svn path=/head/; revision=9627
Diffstat (limited to 'net/cnet/files')
-rw-r--r--net/cnet/files/Makefile.freebsd54
-rw-r--r--net/cnet/files/compile.c77
2 files changed, 131 insertions, 0 deletions
diff --git a/net/cnet/files/Makefile.freebsd b/net/cnet/files/Makefile.freebsd
new file mode 100644
index 000000000000..3e8721ffbd2f
--- /dev/null
+++ b/net/cnet/files/Makefile.freebsd
@@ -0,0 +1,54 @@
+#
+# The following #defines are for Sun's SunOS, >= SunOS4.1.2
+# CC may be either cc or gcc
+#
+
+
+
+# Uncomment the following line if you wish Tcl/Tk windowing (see config.h)
+#
+#XINCLUDES =
+#XLIBS = -ltcl -ltk -lXpm -lX11 -lm
+#
+# Uncomment the following line if you wish XView windowing (see config.h)
+#
+OPENWINHOME = ${X11BASE}
+XINCLUDES = -I$(OPENWINHOME)/include
+XLIBS = -L$(OPENWINHOME)/lib -lxview -lolgx -lXpm -lX11
+#
+# Uncomment the following lines if you wish Motif windowing (see config.h)
+#
+#XINCLUDES = -I$(X11BASE)/include
+#XLIBS = -L$(X11BASE)/lib -lXm -lXt -lXpm -lX11
+
+
+#CC = cc
+CC = gcc -Wall -ansi
+
+INCLUDES =
+CFLAGS = -O $(INCLUDES) $(XINCLUDES)
+
+#LD = cc
+LD = gcc
+LIBDIRS = -L/usr/local/lib
+LIBS = -lm -lgnuregex
+STRIP = strip
+
+BINDIR = /usr/local/bin
+MANDIR = /usr/local/man/man1
+MANEXT = 1
+INCDIR = /usr/local/include
+
+
+# ---------------------- No user-serviceable code below -----------------
+
+include Makefile.common
+
+kultarr: $(NAME)
+ chmod 711 $(NAME)
+ rcp -p $(NAME) kultarr:/usr/kultarr/bin/$(NAME)
+ rcp -p $(NAME) kultarr:/usr/local/bin/$(NAME)
+ chmod 644 cnet.h DOC/cnet.man
+ rcp -p cnet.h kultarr:/usr/local/include/cnet.h
+ rcp -p DOC/cnet.man kultarr:/usr/local/man/manl/cnet.l
+
diff --git a/net/cnet/files/compile.c b/net/cnet/files/compile.c
new file mode 100644
index 000000000000..8f3c4c2656e1
--- /dev/null
+++ b/net/cnet/files/compile.c
@@ -0,0 +1,77 @@
+#include <dlfcn.h>
+#include <nlist.h>
+
+static int add_compile_args(ac, av, kflag) int ac; char *av[]; int kflag;
+{
+ av[ac++] = "-fPIC";
+ av[ac++] = "-I/usr/local/include"; /* XXX GROSS - should use prefix */
+ return(ac);
+}
+
+
+static int add_link_args(ac, av, kflag) int ac; char *av[]; int kflag;
+{
+ av[ac++] = findenv("CNETLD", CNETLD);
+ av[ac++] = "cc";
+ av[ac++] = "-Bshareable";
+ return(ac);
+}
+
+
+static void data_segments(n, handle, so_filenm)
+ int n; void *handle; char *so_filenm;
+{
+ extern int nlist _PARAMS((const char *, struct nlist *));
+
+ typedef struct _c {
+ char *so_filenm;
+ unsigned long length_data;
+ char *incore_data;
+ char *original_data;
+ struct _c *next;
+ } CACHE;
+
+ static CACHE *chd = (CACHE *)NULL;
+ CACHE *cp = chd;
+
+ NODE *np = &NP[n];
+ struct nlist nls[3];
+
+ while(cp != (CACHE *)NULL) {
+ if(strcmp(cp->so_filenm, so_filenm) == 0)
+ goto found;
+ cp = cp->next;
+ }
+
+ nls[0].n_name = "__DYNAMIC";
+ nls[1].n_name = "_end";
+ nls[2].n_name = (char *)NULL;
+
+ if(nlist(so_filenm, nls) != 0) {
+ (void)fprintf(stderr,"%s: cannot load symbols from %s\n",
+ progname,so_filenm);
+ ++nerrors;
+ return;
+ }
+
+ cp = (CACHE *)malloc(sizeof(CACHE));
+ cp->so_filenm = strdup(so_filenm);
+ cp->length_data = (nls[1].n_value - nls[0].n_value);
+ cp->incore_data = (char *)((long)dlsym(handle,"end") - cp->length_data);
+ cp->original_data = (char *)malloc(cp->length_data);
+ (void)memcpy(cp->original_data, cp->incore_data, cp->length_data);
+ cp->next = chd;
+ chd = cp;
+
+ if(vflag)
+ (void)fprintf(stderr,"%s dataseg=0x%08lx len(dataseg)=%ld\n",
+ so_filenm, (long)cp->incore_data, cp->length_data);
+found:
+
+ np->length_data[0] = cp->length_data;
+ np->incore_data[0] = cp->incore_data;
+ np->original_data[0] = cp->original_data;
+
+ np->private_data[0] = (char *)malloc(cp->length_data);
+ (void)memcpy(np->private_data[0], cp->original_data, cp->length_data);
+}