Changeset 3755


Ignore:
Timestamp:
Dec 22, 2019, 1:11:47 PM (5 years ago)
Author:
Andreas Schnellbacher
Message:
  • Add _removemultispaces.
  • This avoids multiple spaces read from the mode config files and written to NEPMD.INI -> \NEPMD\Var\Mode\<mode>\.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/gui/common/hilite.c

    r3754 r3755  
    210210   }
    211211
     212return string;
     213}
     214
     215// ----------------------------------------------------------------------
     216
     217// Copyright 1987-88, Robert B.Stout
     218// https://people.cs.umu.se/~isak/snippets/
     219// Subset version released to the public domain, 1992
     220// Original name: lv1ws
     221// Altered for NEPMD.
     222//
     223// Makes all whitespace single spaces. Passed a string, lv1ws()
     224// converts all multiple whitespace characters to single spaces.
     225
     226static PSZ _removemultispaces( PSZ string)
     227{
     228         PSZ      ibuf = string;
     229         PSZ      obuf = string;
     230         INT      i = 0;
     231         BOOL     fPrevSpace = FALSE;
     232
     233// Check parameter
     234if (string)
     235   {
     236   // Collapse embedded spaces (from LV1WS.C)
     237   while (*ibuf)
     238      {
     239      if (isspace( *ibuf) && fPrevSpace)
     240         ibuf++;
     241      else
     242         {
     243         if (!isspace( *ibuf))
     244            fPrevSpace = FALSE;
     245         else
     246            {
     247            *ibuf = ' ';
     248            fPrevSpace = TRUE;
     249            }
     250         obuf[i++] = *ibuf++;
     251         }
     252      }
     253   obuf[i] = '\0';
     254   }
    212255return string;
    213256}
     
    10391082      sprintf( szRegPath, pszRegPathTemplate, pszEpmMode, apszKeys[i+1]);
    10401083//    DPRINTF(( "Regpath. Key '%s' Full path '%s'\n", apszKeys[i+1], szRegPath));
     1084      _removemultispaces( szFileBuffer);
    10411085      rc = WriteConfigValue( hconfig, szRegPath, szFileBuffer);
    10421086//    DPRINTF(( "Regupd rc %d Value '%s'\n", rc, szFileBuffer));
Note: See TracChangeset for help on using the changeset viewer.