commit - 9e4e21f929949583450edcb7ecb1072a7cfb975f
commit + ade78a5f9f5e649c90b9bb8e5918160917006f44
blob - f58fe287f5a03c63cca850d61f608f9272a7b4ca
blob + 3ffee0beee1663f6c8a6433dfe4a5f0bb8c68d68
--- make/TODO.md
+++ make/TODO.md
Allow specifying additional `PATH` directories.
-# Replace usage of `strtok()` and `strtok_r()` with `strsep()`
-
-
# Provide implementations of non-standard functions (libcompat)
- `err(3)` and `errx(3)`
- `reallocarray(3)`
-- `asprintf(3)`
-- `strsep(3)` or `strtok_r(3)`
+- `strsep(3)`
# Future TODOs
blob - d1396fc54787ab618c23cbad4d91c972a9532ed1
blob + cc694d669c9d7bfe6c8b778df8d0e882ec1264be
--- make/make.c
+++ make/make.c
sub->makefile = NULL;
sc->dir->subdirs = sub;
- p = strtok (s, ",");
+ p = strsep (&s, ",");
if (p == NULL)
return -1;
if (access (path, F_OK) != 0)
errx (1, "%s: directory not found: %s", path_to_str (dir), sub->name);
- p = strtok (NULL, ",");
+ p = strsep (&s, ",");
if (p == NULL) {
sub->type = SC_DIR;
sub->dir = NULL;
return 0;
}
+ // TODO: handle empty fields
p = trim (p);
if (strcmp (p, "DIR") == 0) {
sub->type = SC_DIR;
sub->dir = NULL;
sub->makefile = MAKEFILE;
- p = strtok (NULL, ",");
+ p = strsep (&s, ",");
if (p == NULL)
return 0;
sub->gnu = new (struct gnu);
sub->gnu->prog = NULL;
- p = strtok (NULL, ",");
+ p = strsep (&s, ",");
if (p == NULL)
return 0;
sub->gnu->prog = strdup (trim (p));
- p = strtok (NULL, ",");
+ p = strsep (&s, ",");
if (p == NULL)
return 0;
sub->makefile = strdup (trim (p));
} else {
return -1;
}
-
}
struct rule *