Hi, I haven't written programs in C for many years and most of the ones at the end of the era of C did not have Makefiles. Back when I started in the late '70s/early '80s if we had makefiles they were extremely simple.
So, with some trepidation I set about adding ping6 and traceroute6 commands to bgplg. Not the simplest re-introduction to C and the OpenBSD build process for hackers, but easily the simplest from a code point of view. No C really! I don't have a clue as to how one can add a directory to a branch of the tree and add a file to it so I'm just listing the two cases where I did that. I'll give the paths and the file contents as text herein. First the diffs for the amended files: 1/ Index: src/usr.bin/bgplg/Makefile =================================================================== RCS file: /cvs/src/usr.bin/bgplg/Makefile,v retrieving revision 1.1 diff -u -p src/usr.bin/bgplg/Makefile --- src/usr.bin/bgplg/Makefile 11 Dec 2006 23:10:10 -0000 1.1 +++ src/usr.bin/bgplg/Makefile 2 Apr 2010 06:28:12 -0000 @@ -2,7 +2,7 @@ .include <bsd.own.mk> -SUBDIR= bgplg bgplgsh bgpctl ping traceroute +SUBDIR= bgplg bgplgsh bgpctl ping traceroute ping6 traceroute6 INCFILES= bgplg.head \ bgplg.foot \ 2/ Index: src/usr.bin/bgplg/bgplg.c =================================================================== RCS file: /cvs/src/usr.bin/bgplg/bgplg.c,v retrieving revision 1.8 diff -u -p src/usr.bin/bgplg/bgplg.c --- src/usr.bin/bgplg/bgplg.c 9 Jan 2010 02:37:32 -0000 1.8 +++ src/usr.bin/bgplg/bgplg.c 2 Apr 2010 06:30:51 -0000 @@ -39,6 +39,8 @@ #define BGPCTL "/bin/bgpctl", "-s", BGPDSOCK #define PING "/bin/ping" #define TRACEROUTE "/bin/traceroute" +#define PING6 "/bin/ping6" +#define TRACEROUTE6 "/bin/traceroute6" #define CONTENT_TYPE "text/html" static struct cmd cmds[] = CMDS; 3/ Index: src/usr.bin/bgplg/bgplg.h =================================================================== RCS file: /cvs/src/usr.bin/bgplg/bgplg.h,v retrieving revision 1.5 diff -u -p src/usr.bin/bgplg/bgplg.h --- src/usr.bin/bgplg/bgplg.h 20 May 2009 09:45:59 -0000 1.5 +++ src/usr.bin/bgplg/bgplg.h 2 Apr 2010 06:31:40 -0000 @@ -64,6 +64,10 @@ struct cmd { { TRACEROUTE, "-Sl", NULL } }, \ { "ping", 1, 1, "<address>", \ { PING, "-c4", "-w2", NULL } }, \ + { "traceroute6", 1, 1, "<address>", \ + { TRACEROUTE6, "-l", NULL } }, \ + { "ping6", 1, 1, "<address>", \ + { PING6, "-c4", "-i2", NULL } }, \ { "help", 0, 0, NULL, { NULL }, lg_help }, \ { NULL } \ } 4/ Index: src/usr.bin/bgplg/bgplgsh.c =================================================================== RCS file: /cvs/src/usr.bin/bgplg/bgplgsh.c,v retrieving revision 1.2 diff -u -p src/usr.bin/bgplg/bgplgsh.c --- src/usr.bin/bgplg/bgplgsh.c 12 Dec 2006 11:43:50 -0000 1.2 +++ src/usr.bin/bgplg/bgplgsh.c 2 Apr 2010 06:33:44 -0000 @@ -38,6 +38,8 @@ #define BGPCTL "/usr/sbin/bgpctl", "-s", BGPDSOCK #define PING "/sbin/ping" #define TRACEROUTE "/usr/sbin/traceroute" +#define PING6 "/sbin/ping6" +#define TRACEROUTE6 "/usr/sbin/traceroute6" static volatile int quit; Now for the added dirs and contents: mkdir /usr/src/usr.bin/bgplg/ping6 add Makefile to it containing: # $OpenBSD: Makefile,v 0.0 2010/04/02 20:00:09 rodw Exp $ PROGDIR= ${.CURDIR}/../../../sbin/ping6 LDSTATIC= -static CFLAGS+= -I${PROGDIR} NOMAN= yes .include "${PROGDIR}/Makefile" BINDIR= /var/www/bin BINMODE= 000 .PATH: ${PROGDIR} mkdir /usr/src/usr.bin/bgplg/traceroute6 add Makefile to it containing: # $OpenBSD: Makefile,v 0.0 2010/04/02 20:00:09 rodw Exp $ PROGDIR= ${.CURDIR}/../../../usr.sbin/traceroute6 LDSTATIC= -static CFLAGS+= -I${PROGDIR} NOMAN= yes .include "${PROGDIR}/Makefile" BINDIR= /var/www/bin BINMODE= 000 .PATH: ${PROGDIR} There, I think I have given all the details. Not exactly high tech but a good learning exercise for me and I'm sure there will be some added clues as a result of this posting. I haven't done any of the manpage mods yet and I haven't finished testing because I need to get it running on a remote box so that I have real IPv6 access. The static v6 commands do run so that is encouraging. Comments and constructive criticism welcome. Thanks, Rod I need to get some sleep now. I've been standing on the shoulders of giants most of the day. *** NOTE *** Please DO NOT CC me. I <am> subscribed to the list. Mail to the sender address that does not originate at the list server is tarpitted. The reply-to: address is provided for those who feel compelled to reply off list. Thankyou. Rod/ /earth: write failed, file system is full cp: /earth/creatures: No space left on device