summaryrefslogtreecommitdiff
blob: cc7b12e95fc491623b1d1c4d7972af65a46f029e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--- src/mtoolsfm.c	2001-08-27 08:45:25.000000000 +0200
+++ src/mtoolsfm.c.1	2003-07-04 20:24:03.000000000 +0200
@@ -85,6 +85,10 @@
 char *homedir;
 int debug=0;
 
+char *leftpath = "";
+char *rightpath = "";
+int sidecount=0;
+
 /* should a configuration file ~/.mtoolsfm be written in user's homedir ? */
 #ifdef DEFAULT_NOSAVE
     int nosave=1;
@@ -652,6 +656,7 @@
   char *nextposition;
   unsigned int path_length=50;
   unsigned int path_add=50;
+  sidecount++;
 
   if (debug) {
     printf ("In gethdpath()\n");
@@ -660,11 +665,19 @@
   clearpath (whichside);
   errno = 0;
   path = malloc (path_length * sizeof (char));
+  if (sidecount == 1 && strlen(leftpath) != 0) {
+	  strcpy(path, leftpath);
+  }
+  else if (sidecount == 2 && strlen(rightpath) != 0) {
+	  strcpy(path, rightpath);
+  }
+  else {
   while ((!getcwd (path, path_length - 2)) && (errno == ERANGE))
 	{
 		if (debug) printf("  getcwd buffer resize: errno=%d, path_length=%d, path=%s\n",errno,path_length,path);
 		path = g_realloc (path, (path_length+=path_add) * sizeof (char));
 	}
+  }
   strcat (path, "/");
   if (debug)
     printf ("  path: %s\n", path);
@@ -2920,6 +2933,20 @@
       debug = 1;
     else if (!strcmp (argv[i], "--debug"))
       debug = 1;
+	else if (!strncmp (argv[i], "--leftpath", 10)) {
+      leftpath = strchr(argv[i], '=');
+      if(leftpath) {
+        *leftpath = 0;
+        leftpath++;
+      }
+    }
+	else if (!strncmp (argv[i], "--rightpath", 11)) {
+      rightpath = strchr(argv[i], '=');
+      if(rightpath) {
+        *rightpath = 0;
+        rightpath++;
+      }
+    }
     else if (!strcmp (argv[i], "--help")) {
       g_print ("\n%s%s\n%s%s%s\n",ABOUTMTOOLSFM_1,ABOUTMTOOLSFM_2,
 	       MTOOLSFMOPTIONS_1,CONFFILE,MTOOLSFMOPTIONS_2);