• Please review our updated Terms and Rules here

DOS 2.11 NOW Redirection Bug?

charnitz

Experienced Member
Joined
Nov 17, 2020
Messages
55
Location
North America
Why does redirecting the output of NOW to a file result in the zeroes in the time code being put on a second line in the file?

Assume it is 2:03:04:18 when this is executed:

Code:
> now > a.txt

> type a.txt
  It is now  March 24 2021,  2:3:4.18 .
00

Assume it is 2:03:14:18 when this is executed:

Code:
> now > a.txt

> type a.txt
  It is now  March 24 2021,  2:3:14.18 .
0

Assume it is 2:13:14:18 when this is executed:

Code:
> now > a.txt

> type a.txt
  It is now  March 24 2021,  2:13:14.18 .

For the zeroes at minutes and seconds, it seems to impact them only if they occur directly after the preceding colon. Assume it is 2:50:05.41 when this is executed:

Code:
> now > a.txt

> type a.txt
  It is now  March 24 2021,  2:50:5.41 .
0

ECHO does not replicate the behavior:

Code:
> echo   It is now  March 24 2021,  2:03:04.18 . > a.txt

> type a.txt
It is now  March 24 2021,  2:03:04.18 .

For:

Code:
> ver

Toshiba MS-DOS Version 2.11 / R2A10US
 
Last edited:
As far as I know, NOW is not a DOS command but obviously written by "someone".
And obviously "someone" wrote a buggy program.
Where did this program come from? Should be easy to rewrite with any programming language.
 
Many DOS programs, including command line-only programs, were written to access the screen directly for speed. This bypasses DOS, making it impossible to redirect output.

So if this was not something included standard with DOS, then it may not be redirectable.
 
As far as I know, NOW is not a DOS command but obviously written by "someone".
And obviously "someone" wrote a buggy program.
Where did this program come from? Should be easy to rewrite with any programming language.

Thank you for pointing out that NOW is not an official DOS command.

It is in the Toshiba MS-DOS V2.1 Reference Manual and the Toshiba MS-DOS 3.30 Operation System manual, but not in the MS-DOS Encyclopedia. Did Toshiba add it to their distribution of DOS?

However, should it even be possible for the same command to have different output to the console than to a file through redirection? Can redirection influence the logic of the command itself or is redirection handled entirely by the operating system after the output from the command?
 
Last edited:
Many DOS programs, including command line-only programs, were written to access the screen directly for speed. This bypasses DOS, making it impossible to redirect output.

So if this was not something included standard with DOS, then it may not be redirectable.

It is redirecting to the file, though, even if goofily. In the examples above, I use type to type the file out after NOW and the redirection is complete. If NOW accessed the screen directly for speed, wouldn't there be nothing in the redirection file, instead of the output mostly right with some goofiness of the zeroes?
 
It was quite common, that OEMs, like SONY, added some extra commands for their systems. They might even describe it in their manuals together with the standard MS-DOS commands.

The redirection will simply write to a file what is written to standard output.

It may be possible, that the command uses Sony-specific escape sequences to position the cursor for output.
You can examine the redirected result with a HEX Editor or simply with DEBUG to see what is actually written.

Maybe NOW shows a running close(seconds updated regularly?) Then it may use some control characters or escape sequences in its output.
 
Back
Top