kasran is a user on awoo.space. You can follow them or interact with them if you have an account anywhere in the fediverse.
kasran @typhlosion

TIL there is no good equivalent of fortune for the windows command prompt

· Web · 1 · 0

@typhlosion You can't just compile it for Windows, though?

(I mean, not users compiling it themselves, but you'd think something like that might have Windows binaries)

@TrollDecker apparently the original version would, for some terrible reason, require significant porting to work on windows. i found some instructions on compiling it for cygwin but fuck cygwin

i guess i could make my own but i can't find any documentation on how to use any of the fortune databases i've found

YEAH APPARENTLY THIS DOESN'T JUST GRAB A RANDOM LINE FROM A PLAINTEXT FILE AND PRINT IT. I DON'T KNOW WHY.

@TrollDecker i'll probably just write my own anyway, starting off with a plaintext file of little silly quotes i've maintained for years and used to use for skype status messages

@typhlosion Microsoft really quit caring about the command prompt some time ago. It began with not releasing MS-DOS as a separate product starting with Windows 95. Almost everything is supposed to be done through the GUI which makes writing batch files/shell scripts damn near impossible because you can't automate mouse movements.

@skquinn oh well. my not caring about that bullshit is aggressive enough that i'm just writing my own

AND IT'LL BE CROSS PLATFORM AND SUPPORT PLAINTEXT, because i care about bringing these truly important utilities into the 21st century

@skquinn after that i'll write my own cowsay because at that point why not

@typhlosion The command line of MS-DOS was always a bit of a botch. I wish that Unix or a variant thereof had been the OS of choice on PCs since the beginning so we didn't have this issue.

As for writing your own, you should be able to compile the one from your favorite GNU/Linux distribution or *BSD using something like MinGW.

@skquinn from what i've gathered reading up about it, apparently it'd require significant porting effort for some reason, at least for the original BSD impl

but i can't imagine a version that uses a plaintext database would be hard to write, and if i figure out how the original database is formatted i could implement support for it later

@typhlosion In years past I'd just go over to my Windows box and try it. However, I ran from that dumpster fire over a decade ago and haven't really looked back, for better or worse.

@typhlosion @skquinn
The format is strfile -- a flat format consisting of a dat file which has a list of offsets to the beginnings of fortunes in the second, paired file.

I'm not sure if it encodes length or if it expects the offsets to be in order (with the end being the next start offset minus three bytes, because the separator for the text part is '\n%\n')

@skquinn @typhlosion
But, you could just escape newlines and split on lines and be fine if you didn't want to support the original format.

@enkiv2 @skquinn > (hi i'm talking about this over here now cos this is my code talkin account)

yeah i've been investigating the strfile format just now, in principle it doesn't seem too difficult but if i want to make my program compatible with the databases from the other fortune program i gotta know how it works eheh

@typhlosion I'm pretty sure you can install fortune under Cygwin or WSL :>

@kellerfuchs fuck cygwin

i did forget about wsl though