MODE does indeed have verbose errorlevels in codepage handling:

With FreeCOM, you can display them like this:

C:\>mode con cp prepare=((437) c:\freedos\cpi\ega.cpx)
MODE: No compatible FreeDOS DISPLAY driver loaded.
Syntax example: ... DISPLAY CON=(VGA,437,1)

C:\>echo %errorlevel%

Other MODE functions are more boring in their errorlevels, for example they just produce 0 if okay and 1 or 255 (-1) on error.

Regards, Eric

Mode is a typical example. At

there is a big explanation what the original mode.com from 1995 can do
for me. But the last change was in 2015 - and as it looks like a lot of
things were changed without a documentation, among others FD has no park

If I understand this right, the actual errorlevels should be like this
(found them at modecp.c - hopefully correct?)

MODE has the following ERRORLEVEL / EXITCODES [1]:
     100:  INTERNAL ERROR: size for prepared table too small
     101:  No compatible FreeDOS DISPLAY [2] driver loaded.
           Syntax example: ... DISPLAY [2] CON=(VGA,437,1)
     102:  File not found
     103:  Error specifying codepage / buffer
     104:  Error: selected buffer not present
     105:  Syntax error
   check codepage:
     26:  Active codepage was never set
     27:  Device read codepage error
   prepare codepage:
     27:  Codepage was not found in CPI file
     29:  Could not get codepage info from file (or XMS troubles)
     31:  specified CPI file is damaged (or XMS troubles)
   end prepare codepage:
     31:  INTERNAL ERROR: End prepare without Begin prepare
   select codepage:
     26:  Specified codepage was not found in file
     27:  KEYB failed to change codepage
     29:  Device select codepage failed (or XMS troubles)
     31:  Device select codepage error

(I think 0 should be added too)

The orignal looks as follows:

Errorlevels returned by MODE are as follows:

     0    No error
     115    Serial port does not exist (either for COMn: or LPTn:=COMx)
     117    No hard disk(s) found to park
     118    Specified video mode is not supported on this machine
     162    Insufficient memory (MODE requires about 6K of memory)
     241    Parameter out of range (e.g. time value, LPT port number etc)
     242    Cannot have 43-line or 50-line modes with modes other than
     243    Unknown baud rate
     244    Must specify both DELAY= and RATE= for typematic setting
     246    More than one command or command type was given
     255    Incorrect usage syntax (all usage syntax errors)

Question: Which are the correct errorlevels?

Freedos-devel mailing list

Reply via email to