commit 521fc081802282bac261c3639e9c77fe131f1d42 from: Sören Tempel via: Dan Cross date: Wed Jul 27 14:15:51 2022 UTC lib9: pass $PLAN9_TARGET via CPP for get9root fallback value Allows this function to always return the proper path in situations where the $PLAN9 environment variable is not set, i.e. a rc login shell. commit - f7b572818c7617065ef0877870caee060db90a30 commit + 521fc081802282bac261c3639e9c77fe131f1d42 blob - 07e2872c512d288ea454c0ceb2bedb040e33ddd3 blob + 3e7b10501f4142d7f2ee3f3dac41f1d1601d2300 --- src/lib9/get9root.c +++ src/lib9/get9root.c @@ -11,7 +11,6 @@ get9root(void) if((s = getenv("PLAN9")) != 0) return s; - /* could do better - search $PATH */ - s = "/usr/local/plan9"; + s = PLAN9_TARGET; return s; } blob - db267dfed587aa96952ee1c3dda1e01833e04a1b blob + ed4315ff4f390f25ea3c7ceff0aa78332eae8cf5 --- src/lib9/mkfile +++ src/lib9/mkfile @@ -175,6 +175,9 @@ HFILES=\ %.$O: utf/%.c $CC $CFLAGS utf/$stem.c +get9root.$O: get9root.c + $CC $CFLAGS -DPLAN9_TARGET=\"$PLAN9_TARGET\" get9root.c + XLIB=$PLAN9/lib/$LIB testfmt: testfmt.$O $XLIB blob - dfccd36944829290c85e9e0fd2afad1ab6373526 blob + 8971864892ebcf1c9b6abbb48357cad2486d9a73 --- src/mkmk.sh +++ src/mkmk.sh @@ -36,7 +36,7 @@ echo cd `pwd` 9c exitcode.c 9c fcallfmt.c 9c frand.c -9c get9root.c +9c -DPLAN9_TARGET=\"$PLAN9_TARGET\" get9root.c 9c getcallerpc.c 9c getenv.c 9c getfields.c