ref: ca81298ff007e930fb84a57df875664b6a81fe0d
parent: fbeb4cd4542ba98f54caa4892bd334fa34c8cbf4
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Jan 14 07:07:32 EST 2021
mkplist: store full paths, always
--- a/mkplist.c
+++ b/mkplist.c
@@ -268,7 +268,7 @@
void
main(int argc, char **argv)
{
- char *dir;
+ char *dir, wd[4096];
int i;
if(argc < 2){
@@ -275,6 +275,7 @@
fprint(2, "usage: mkplist DIR [DIR2 ...] > noise.plist\n");
exits("usage");
}
+ getwd(wd, sizeof(wd));
Binit(&out, 1, OWRITE);
@@ -288,7 +289,11 @@
if(icyfill(curr) != 0)
fprint(2, "%s: %r\n", argv[i]);
}else{
- dir = strdup(argv[i]);
+ if(argv[i][0] == '/')
+ dir = strdup(argv[i]);
+ else
+ dir = smprint("%s/%s", wd, argv[i]);
+ cleanname(dir);
scan(&dir, 0);
}
}