From: Armaan Bhojwani Date: Sun, 11 Apr 2021 01:02:35 +0000 (-0400) Subject: tides: add current working directory X-Git-Tag: v0.0.1 X-Git-Url: https://git.armaanb.net/?p=bin.git;a=commitdiff_plain;h=6378c0ac0b09ff910d9932460001dabd12ebd150 tides: add current working directory --- diff --git a/tides.c b/tides.c index 18c430f..7086671 100644 --- 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);