My shell prompt
Go to file
Érico Rolim 46ea87ea21 Fix showing current path again.
Avoid unnecessary heap allocations (though we added new ones in main())
if possible by using a PATH_MAX buffer.

Check for PWD matching current directory ourselves, which allows us to
save a stat syscall, by re-using the stat(".") result to compare to
stat("$HOME"). Improve how we check if HOME is actually part of pwd -
previous would get confused with "${HOME}char", which should not get the
prompt to display '~'.

Use strtok_r to scan characters now. Writing directly to p() makes more
sense than writing chars to a buffer, so remove that.

I'm somewhat unhappy with the rpwd and mrpwd solution, since while
coding I forgot to set one or the other a couple of times. It would be
nice if I could "unconst" the variable at some point, though I greatly
dislike that pattern.
2021-03-07 04:17:23 -03:00
po Change translated strings to .c file. 2021-02-22 01:57:46 -03:00
.gitignore Initial commit. 2021-02-22 00:38:41 -03:00
Makefile Fix hostname printing. 2021-02-22 12:34:34 -03:00
ep.c Fix showing current path again. 2021-03-07 04:17:23 -03:00
ep.h Fix showing current path again. 2021-03-07 04:17:23 -03:00
git.c Remove global variables from git.c. 2021-03-07 02:36:13 -03:00
lang.c Detect a void-packages repository. 2021-02-22 12:35:53 -03:00
out.c Move output and path handling code outside main. 2021-02-22 01:53:44 -03:00
path.c Fix showing current path again. 2021-03-07 04:17:23 -03:00
ssh.c Fix hostname printing. 2021-02-22 12:34:34 -03:00