From: Omar Polo Subject: don't hardcode /usr/bin/vi To: gameoftrees@openbsd.org Date: Mon, 18 Mar 2024 12:48:53 +0100 This moves the hardcoded "/usr/bin/vi" to a (overridable) define. This is mostly for -portable, so packages on other systems can provide a different path (I'm thinking in particular of NixOS where in /usr/ there is only /usr/bin/env and all the "usual" paths are otherwise absent.) We do the same for the other programs (ssh, ssh-keygen, signify). As side-effect I'll be able to switch back to ed locally, too :) ok? diff /home/op/w/got commit - c5d61cbc3a9c337b669af6b330709b6b4d43c872 path + /home/op/w/got blob - 395b21d6bf1ba81c76d54f3c0c75a094440ca583 file + cvg/cvg.c --- cvg/cvg.c +++ cvg/cvg.c @@ -69,6 +69,10 @@ #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif +#ifndef GOT_DEFAULT_EDITOR +#define GOT_DEFAULT_EDITOR "/usr/bin/vi" +#endif + static volatile sig_atomic_t sigint_received; static volatile sig_atomic_t sigpipe_received; @@ -281,7 +285,7 @@ get_editor(char **abspath) } if (*abspath == NULL) { - *abspath = strdup("/usr/bin/vi"); + *abspath = strdup(GOT_DEFAULT_EDITOR); if (*abspath == NULL) return got_error_from_errno("strdup"); } blob - 488dc79c339ccc7d9f24681ea94bbf19ab7b4309 file + got/got.c --- got/got.c +++ got/got.c @@ -68,6 +68,10 @@ #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif +#ifndef GOT_DEFAULT_EDITOR +#define GOT_DEFAULT_EDITOR "/usr/bin/vi" +#endif + static volatile sig_atomic_t sigint_received; static volatile sig_atomic_t sigpipe_received; @@ -310,7 +314,7 @@ get_editor(char **abspath) } if (*abspath == NULL) { - *abspath = strdup("/usr/bin/vi"); + *abspath = strdup(GOT_DEFAULT_EDITOR); if (*abspath == NULL) return got_error_from_errno("strdup"); }