realpath / readlink -f: the anchored path, when it is decidable. */
| 771 | |
| 772 | /* realpath / readlink -f: the anchored path, when it is decidable. */ |
| 773 | static const char *sh_absolute(sh_t *s, const char *v) { |
| 774 | if (!v) { |
| 775 | return NULL; |
| 776 | } |
| 777 | if (v[0] == SH_ANCHOR) { |
| 778 | return sh_anchor(s->a, sh_join(s->a, "", v + SKIP_ONE)); |
| 779 | } |
| 780 | if (v[0] == '/' || s->cwd.mode != SH_AT) { |
| 781 | return NULL; |
| 782 | } |
| 783 | return sh_anchor(s->a, sh_join(s->a, s->cwd.dir, v)); |
| 784 | } |
| 785 | |
| 786 | typedef struct { |
| 787 | const char **v; |
no test coverage detected