CM3_ROOT is defined as:

if the environment variable CM3_ROOT is defined, then that is it
else:
  if the current directory contains a directory named CVS,
    and that directory contains a file named Repository
      and that file contains one line
        and that line equals "cm3"
          then the current directory is CM3_ROOT
        else if that line starts "cm3/"
          count the number of slashes
          CM3_ROOT is current directory, removing number
           of trailing path elements equal to the number of slashes
       reduce to:
        if the first path element in the line is "cm3"
          count the number of slashes
            etc.

This is teaching cm3 about stuff perhaps it should not know about.
It will ease automation and make cm3 more standalone.
It maybe redundant however with translating Quake code into Modula-3.