Ꮢ๐ϲoᴄo Ⅿoԁem Ᏼasіlisk is a user on mastodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

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

@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

@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 @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')

Ꮢ๐ϲoᴄo Ⅿoԁem Ᏼasіlisk @enkiv2

@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.

· Web · 0 · 1

@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