Commit Diff


commit - fe67a6742c21d58ed966eb3472101039b94bd418
commit + 26e95b82a96d043e96f6364a9053c02d5d855ece
blob - 66e45249a521ca684e82a0124682cc90e98213f7
blob + ee92ccb9378b576dfa1f07f2530588635bf91971
--- fs.c
+++ fs.c
@@ -67,6 +67,8 @@ char		known_hosts_file[PATH_MAX], known_hosts_tmp[PATH
 char		crashed_file[PATH_MAX];
 char		session_file[PATH_MAX], session_file_tmp[PATH_MAX];
 char		history_file[PATH_MAX], history_file_tmp[PATH_MAX];
+
+char		cwd[PATH_MAX];
 
 static int
 select_non_dot(const struct dirent *d)
@@ -300,6 +302,9 @@ init_paths(void)
 	char		*home;
 	struct stat	 info;
 
+	if (getcwd(cwd, sizeof(cwd)) == NULL)
+		err(1, "getcwd failed");
+
 	/* old path */
 	if ((home = getenv("HOME")) == NULL)
 		errx(1, "HOME is not defined");
blob - a907499540a49280b469c1392c0fd0ff39c063b5
blob + c18c4d95757e523512b6cf129160fa9189ceb0cb
--- include/fs.h
+++ include/fs.h
@@ -33,6 +33,8 @@ extern char	crashed_file[PATH_MAX];
 extern char	session_file[PATH_MAX], session_file_tmp[PATH_MAX];
 extern char	history_file[PATH_MAX], history_file_tmp[PATH_MAX];
 
+extern char	cwd[PATH_MAX];
+
 int		 fs_init(void);
 void		 fs_load_url(struct tab *, const char *);
 
blob - 523b39689816b53dd033316708ec647afbfe020c
blob + 2957b75bcacd65449e3944e17755a0e98e92afa5
--- telescope.c
+++ telescope.c
@@ -55,7 +55,6 @@ static const char *opts = "Cc:hnST:v";
 
 static int	has_url;
 static char	url[GEMINI_URL_LEN];
-static char	cwd[PATH_MAX];
 
 /*
  * Used to know when we're finished loading.
@@ -1044,9 +1043,6 @@ main(int argc, char * const *argv)
 
 	if (getenv("NO_COLOR") != NULL)
 		enable_colors = 0;
-
-	if (getcwd(cwd, sizeof(cwd)) == NULL)
-		err(1, "getcwd failed");
 
 	while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
 		switch (ch) {