From b8473b5b6a30a316fb9b7047a1153addee9a9a6f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:43:49 -0800 Subject: [PATCH] Improve how to redefine macros in 2001/kev Now one can do make clobber PORT=37337 SPEED=50 everything The l_ macro can also be redefined with the 'L' variable but this is not recommended especially if you don't know what you're doing so it's barely mentioned in the README.md file. --- 2001/kev/Makefile | 8 +++++++- 2001/kev/README.md | 11 ++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/2001/kev/Makefile b/2001/kev/Makefile index 4449ffbc6..ff6d6e312 100644 --- a/2001/kev/Makefile +++ b/2001/kev/Makefile @@ -57,9 +57,15 @@ CSTD= -std=gnu99 # ARCH= +# variables for the macros for easier redefining +# +PORT= 5455 +SPEED= 100 +L= "socket(il.sin_family=AF_INET,SOCK_STREAM,0)" + # Defines that are needed to compile # -CDEFINE= -DPORT=5455 -DSPEED=100 -Dl_="socket(il.sin_family=AF_INET,SOCK_STREAM,0)" +CDEFINE= -DPORT=${PORT} -DSPEED=${SPEED} -Dl_=${L} # Include files that are needed to compile # diff --git a/2001/kev/README.md b/2001/kev/README.md index 98580b79f..de2ab8b34 100644 --- a/2001/kev/README.md +++ b/2001/kev/README.md @@ -42,23 +42,24 @@ If you need to change the speed you can reconfigure it like (say for over a network and not the same host): ```sh -make clobber CDEFINE="-DSPEED=50" all # original default value which is very fast +make clobber SPEED=50 all # original default value which is very fast ``` If you wish to change the port you can do so like: ```sh -make clobber CDEFINE="-DPORT=3773" all +make clobber PORT=3773 all ``` Of course if you want a port < 1024 you'll need to be root so don't do that. And if you know what you're doing you can redefine the call to the `socket(2)` -syscall with the `l_` macro. Of course you can do more than one at the same -time. For instance to change the speed and port: +syscall with the `l_` macro, changing the `L` variable like one would `PORT`. Of +course you can do more than one at the same time. For instance to change the +speed and port: ```sh -make clobber CDEFINE="-DSPEED=512 -DPORT=3773" all +make clobber SPEED=512 PORT=3773 all ``` If you have `xterm` try on one system: