]> git.armaanb.net Git - bin.git/commitdiff
tides: add current working directory
authorArmaan Bhojwani <me@armaanb.net>
Sun, 11 Apr 2021 01:02:35 +0000 (21:02 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 11 Apr 2021 01:02:35 +0000 (21:02 -0400)
tides.c

diff --git a/tides.c b/tides.c
index 18c430f8220e3cc1e087253f6d05a5905dd4bdc7..70866712263bbfc90c25dfacb0dbe238730483e7 100644 (file)
--- a/tides.c
+++ b/tides.c
@@ -20,6 +20,10 @@ main(void)
        char username[LOGIN_NAME_MAX];
        getlogin_r(username, LOGIN_NAME_MAX);
 
+       // Get current working directory
+       char cwd[PATH_MAX];
+       getcwd(cwd, PATH_MAX);
+
        // Get assorted system info
        struct sysinfo info;
        sysinfo(&info);
@@ -56,6 +60,7 @@ main(void)
 
        // Display
        printf("%s@%s\n", username, hostname);
+       printf("%s\n", cwd);
        printf("%d-%02d-%02d %02d:%02d:%02d\n", wtime->tm_year + 1900, wtime->tm_mon,
                                 wtime->tm_mday, wtime->tm_hour, wtime->tm_min, wtime->tm_sec);
        printf("%0.0f/%0.0f MB RAM\n", (total_kb - avail_kb)/1024.0, total_kb/1024.0);