From d91b47b1e25a40080962aa38ddeb681db9dc8352 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:46:07 -0500 Subject: [PATCH] Documentation! --- pwd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pwd.c b/pwd.c index 09d6474..65247f3 100755 --- a/pwd.c +++ b/pwd.c @@ -5,7 +5,15 @@ #include int main(int argc, char * argv[]) { - int mode = 01; /* 01: print PWD -L, 02: print physical path -P */ + /* + The -L option prints the logical path, corresponding to the PWD envar. + -P prints the physical path. The logical path includes any symbolic + links followed to get there, where as the physical path doesn't. So, + for example, if /lib links to /usr/lib, then if we cd /lib, pwd -L will + print /lib, whereas pwd -P will print /usr/lib, even though cd .. will + take us back to / + */ + int mode = 01; /* 01: -L, 02: -P */ char c; while((c = getopt(argc, argv, "LP")) != -1) {