From 07d2d86ea2ab2d44413fae9e2dd2df67773df2c5 Mon Sep 17 00:00:00 2001
From: Richard Leggett <rleggett@gitlab.riscosopen.org>
Date: Wed, 22 Jul 1998 10:39:32 +0000
Subject: [PATCH] Fixed bug which could cause wrong monitor name to be
 displayed if two MDFs had very similar filenames.

---
 Resources/UK/Messages | 2 +-
 UrsulaLog             | 8 +++++++-
 c/monitor             | 6 +++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Resources/UK/Messages b/Resources/UK/Messages
index 793d6f4..46ebfeb 100644
--- a/Resources/UK/Messages
+++ b/Resources/UK/Messages
@@ -2,7 +2,7 @@
 _TaskName:Screen configuration
 _Purpose:Configuring the screen
 _Author:© Acorn Computers Ltd, 1998
-_Version:0.08 (03-Jun-98)
+_Version:0.08 (21-Jul-98)
 _ConfigText:Screen
 _ConfigHelp:Click SELECT to open the monitor, screen and screen saver configuration window.
 _ConfigSprite:co_screen
diff --git a/UrsulaLog b/UrsulaLog
index 0a8bd0a..1e8c3c5 100644
--- a/UrsulaLog
+++ b/UrsulaLog
@@ -40,4 +40,10 @@ Wed 03-Jun-98
   - An Info menu is provided for screensavers author, version etc.
 
 Fri 05-Jun-98
-  - Clicks on Cancel only re-read settings if click was with adjust.
\ No newline at end of file
+  - Clicks on Cancel only re-read settings if click was with adjust.
+
+Checked in.
+
+Tue 21-Jul-98
+  - Fixed bug which could cause wrong monitor name to be displayed
+    if two MDFs had very similar filenames.
diff --git a/c/monitor b/c/monitor
index a962e01..dc4b881 100644
--- a/c/monitor
+++ b/c/monitor
@@ -22,6 +22,8 @@
 /*          16-Apr-98: RML: save_monitor_choices now also changes the to the */
 /*                          new setup.                                       */
 /*          01-May-98: RML: Bug fix.                                         */
+/*          21-Jul-98: RML: Bug fix: Monitor name could be displayed wrong   */
+/*                          if two very similar filenames existed.           */
 /*                                                                           */
 /* Copyright © 1998 Acorn Computers Ltd., Cambridge, UK.                     */
 /*---------------------------------------------------------------------------*/
@@ -193,11 +195,10 @@ void update_monitor_displayfields(void)
         menus_are_grey=1;
     }
 
-
     /* Update monitor name display */
     for (m=monitors_list; m; m =m->next)
     {
-        if (strncmp(current_monitor_file, m->file_name, strlen(m->file_name))==0)
+        if (strncmp(current_monitor_file, m->file_name, strlen(current_monitor_file))==0)
         {
             error_trap(stringset_set_selected(0, main_window_id, MonitorTypeStringSet, m->monitor_name), 0);
             break;
@@ -534,7 +535,6 @@ static void construct_monitors_list(char *dirname, char* buffer_end)
 
     dirname_end=dirname+strlen(dirname);
 
-
     while(last_item_read!=-1)
     {
         /* Get next entry from directory */
-- 
GitLab