(replying under a new 'Subject' line so it's easier to find)

On Sun, Oct 5, 2025 at 10:15 AM Fritz Mueller via Freedos-devel
<[email protected]> wrote:
>
> As it is a technical meeting today, here a question you could
> discuss about:
>
> In NLS Jerome changed Brazil from "ptbr" to "ptb" to use 8.3
> (pt=portugal). In the meantime I noticed that several nls files
> only support 8.2!  Simple test: copy e.g. find.pt to find.ptb,
> then set lang=ptb, run find /? and check if there is english
> text.  As the keyboards already use "BR" for Brazil this would
> be a good ending for this. Could you please discuss about this?

We talked about it online today. It was a good opportunity for live debugging.

The short version is that this is a limitation built into the Kitten
language library. I think it may go back to my original Catgets
library, but I didn't go back that far.

For example, here's the Kitten that's included in FIND:

https://gitlab.com/FreeDOS/base/find/-/blob/master/SOURCE/FIND/KITTEN.C


On line 159, the 'catlang' string variable is set to 3 (that's enough
room for 2 characters plus the null terminator).

A little further down, Kitten gets the value of the LANG environment
variable, and fails if the LANG is not exactly 2 characters long. But
it succeeds if LANG is longer than 2, and the third character is a
hyphen (that's to accommodate language variations like "en-us" for US
English and "en-uk" for British English .. and so on for other
regional language variations).

>  /* We will need the value of LANG, and may need a 2-letter abbrev of
>     LANG later on, so get it now. */
>
>  lang = getenv ("LANG");
>
>  if (lang == NULL) {
>      /* printf("no lang= found\n"); */ /* not fatal, though */
>      /* Return failure - we won't be able to locate the cat file */
>      return (-1);
>  }
>
>  if ( ( strlen(lang) < 2 ) ||
>       ( (strlen(lang) > 2) && (lang[2] != '-') ) ) {
>      /* Return failure - we won't be able to locate the cat file */
>      return (-1);
>  }
>
>  memcpy(catlang, lang, 2);
>  /* we copy the full LANG value or the part before "-" if "-" found */
>  catlang[2] = '\0';


We tried some live debugging during the video call -- and yes, if you
copy FIND.ES to another 2-letter extension, and set LANG to that
2-letter "language" value, FIND/? will display Spanish:

C:\FREEDOS\NLS>copy find.es find.xs
find.es =>> find.xs

C:\FREEDOS\NLS>set lang=xs

C:\FREEDOS\NLS>find /?
FreeDOS Find, version 3.0
GNU GPLv2 - copyright 1994-2007 by Jim Hall, Eric Auer and Imre Leber
FIND: Muestra las líneas de un archivo que contienen una cadena
FIND [ /C ] [ /I ] [ /N ] [ /V ] "cadena" [ archivo... ]
  /C  Cuenta el número de líneas que contienen una cadena
  /I  No distingue mayúsculas y minúsculas
  /N  Enumera las líneas mostradas, comenzando por 1
  /V  Muestra las líneas que NO contienen la cadena




But if you instead use a 1-letter "language" then it doesn't work:

C:\FREEDOS\NLS>ren find.xs find.x
C:\FREEDOS\NLS>set lang=x
C:\FREEDOS\NLS>find /?
FreeDOS Find, version 3.0
GNU GPLv2 - copyright 1994-2007 by Jim Hall, Eric Auer and Imre Leber
FIND: Prints all lines of a file that contain a string
FIND [ /C ] [ /I ] [ /N ] [ /V ] "string" [ file... ]
  /C  Only count the matching lines
  /I  Ignore case
  /N  Show line numbers
  /V  Print lines that do not contain the string


And of course, a 3-letter "language" doesn't work either:

C:\FREEDOS\NLS>ren find.x find.esx
C:\FREEDOS\NLS>set lang=esx
C:\FREEDOS\NLS>find /?
FreeDOS Find, version 3.0
GNU GPLv2 - copyright 1994-2007 by Jim Hall, Eric Auer and Imre Leber
FIND: Prints all lines of a file that contain a string
FIND [ /C ] [ /I ] [ /N ] [ /V ] "string" [ file... ]
  /C  Only count the matching lines
  /I  Ignore case
  /N  Show line numbers
  /V  Print lines that do not contain the string


It only works if LANG is exactly 2-letters, or 2-letters plus a hyphen:

C:\FREEDOS\NLS>ren find.esx find.zx
C:\FREEDOS\NLS>set lang=zx-xz
C:\FREEDOS\NLS>find /?
FreeDOS Find, version 3.0
GNU GPLv2 - copyright 1994-2007 by Jim Hall, Eric Auer and Imre Leber
FIND: Muestra las líneas de un archivo que contienen una cadena
FIND [ /C ] [ /I ] [ /N ] [ /V ] "cadena" [ archivo... ]
  /C  Cuenta el número de líneas que contienen una cadena
  /I  No distingue mayúsculas y minúsculas
  /N  Enumera las líneas mostradas, comenzando por 1
  /V  Muestra las líneas que NO contienen la cadena



or:

C:\FREEDOS\NLS>set lang=zx
C:\FREEDOS\NLS>find /?
FreeDOS Find, version 3.0
GNU GPLv2 - copyright 1994-2007 by Jim Hall, Eric Auer and Imre Leber
FIND: Muestra las líneas de un archivo que contienen una cadena
FIND [ /C ] [ /I ] [ /N ] [ /V ] "cadena" [ archivo... ]
  /C  Cuenta el número de líneas que contienen una cadena
  /I  No distingue mayúsculas y minúsculas
  /N  Enumera las líneas mostradas, comenzando por 1
  /V  Muestra las líneas que NO contienen la cadena



**I'll reply in a separate email with comments about fixes


_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to