dir.c: keep track of where patterns came from