diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-09-01 13:40:18 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-09-01 13:40:18 -0400 |
commit | 8000855e4837e9996af3423ea48be502567bc23b (patch) | |
tree | 7962b8dc0f3382d64246fe51963658042627c3d1 | |
parent | 1b28a9fff5035e93c7782359e0df8b5c2d2b0f66 (diff) | |
download | multihome-8000855e4837e9996af3423ea48be502567bc23b.tar.gz |
Get basename from program entrypoint instead of hardcoding the program name
-rw-r--r-- | multihome.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/multihome.c b/multihome.c index c553cc0..18fe413 100644 --- a/multihome.c +++ b/multihome.c @@ -295,13 +295,17 @@ void write_init_script() { char buf[PATH_MAX]; char date[100]; char *path; + char *entry_point; struct tm *tm; time_t now; FILE *fp; - path = find_program("multihome"); + strcpy(buf, multihome.entry_point); + entry_point = basename(buf); + + path = find_program(entry_point); if (path == NULL) { - fprintf(stderr, "multihome not found on $PATH"); + fprintf(stderr, "%s not found on $PATH\n", buf); exit(1); } |