home · contact · privacy
sorted_winttogle_and_activate() now sufficiently tolerates toggle_order_and_activate...
authorChristian Heller <c.heller@plomlompom.de>
Mon, 25 Nov 2013 01:03:43 +0000 (02:03 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 25 Nov 2013 01:03:43 +0000 (02:03 +0100)
config/windows/toggle_order_and_active
src/readwrite.h
src/wincontrol.c

index f188d839ab05bf4b020a4c1e9415c84c913d38a8..2ae7c2cbb1461101f9d09d26632e73070ebef7f8 100644 (file)
@@ -1,2 +1,2 @@
 kmicl
-m
\ No newline at end of file
+m
index 01a6f387b859f668ac1a91523ded69bd75ebbb5f..6f7bce377f82f40a4b68a9bcce33031d05b619cf 100644 (file)
@@ -33,8 +33,8 @@ extern void try_fclose_unlink_rename(FILE * file, char * p1, char * p2,
                                      char * f);
 
 /* Wrapper: Call textfile_sizes() from function called "f" to get max line
- * length of "file", exit via exit_err() with trouble_msg()-generated error
- * message on failure.
+ * length (includes newline char) of "file", exit via exit_err() with
+ * exit_trouble() on failure.
  */
 extern uint16_t get_linemax(FILE * file, char * f);
 
index bbb4c5ccdc1b165a23422777ae97e283a9aacf58..6fb9acb8a4c9f575ff93761efa9ccac9405c9615 100644 (file)
@@ -391,7 +391,6 @@ extern void sorted_wintoggle_and_activate()
     char * path = "config/windows/toggle_order_and_active";
     FILE * file = try_fopen(path, "r", f_name);
     uint16_t linemax = get_linemax(file, f_name);
-
     char win_order[linemax + 1];
     try_fgets(win_order, linemax + 1, file, f_name);
 
@@ -401,7 +400,7 @@ extern void sorted_wintoggle_and_activate()
     try_fclose(file, f_name);
 
     uint8_t i = 0;
-    for (; i < linemax - 1; i++)
+    for (; i < strlen(win_order) - 1; i++)
     {
         if (NULL == strchr(world.winconf_ids, win_order[i]))
         {