MKSTR(1)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

✨ MKSTR πŸ’… β€” creating an error message file by massaging C source πŸŽ€

okay bestie, so we're doing mkstr from the General Commands Manual section (1) and honestly? she's a little vintage icon. buckle up πŸ¦‹


🌸 SYNOPSIS 🌸

mkstr [-] mesgfile prefix file ...

πŸ’– DESCRIPTION πŸ’–

so the mkstr utility literally creates a file full of error messages, all extracted from C source, and then restructures that same C source so it can use the error message file it just made. iconique behavior ✨

the intent of mkstr was to reduce the size of large programs and reduce swapping β€” and yes bestie, go read the β€œBUGS” section below, it's giving foreshadowing πŸ’€

the mkstr utility processes each of the specified files, placing a restructured version of the input in a file whose name consists of the specified prefix and the original name. a typical usage of mkstr is

mkstr pistrings xx *.c

this command causes all the error messages from the C source files in the current directory to be placed in the file pistrings and restructured copies of the sources to be placed in files whose names are prefixed with β€œxx”. like, it ate and left no crumbs πŸ”₯

🌈 Options 🌈

  • - β€” error messages are placed at the end of the specified message file, for recompiling part of a large mkstred program. (yes, only one option. she's lowkey minimal πŸŽ€)

the mkstr utility finds error messages in the source by searching for the string β€˜error("’ in the input stream. every single time it occurs, the C string starting at the β€˜"’ is stored in the message file followed by a null character and a new-line character 😭 the new source is restructured with lseek(2) pointers into the error message file for retrieval. it's giving scavenger hunt but make it pointers 🧚

char efilname = "/usr/lib/pi_strings";
int efil = -1;

error(a1, a2, a3, a4)
{
        char buf[256];

        if (efil < 0) {
                efil = open(efilname, 0);
                if (efil < 0)
                        err(1, "%s", efilname);
        }
        if (lseek(efil, (off_t)a1, SEEK_SET) < 0 ||
            read(efil, buf, 256) <= 0)
                err(1, "%s", efilname);
        printf(buf, a2, a3, a4);
}

🫢 SEE ALSO 🫢

gencat(1), xstr(1), lseek(2) 🌸


πŸ‘‘ HISTORY πŸ‘‘

the mkstr utility first appeared in 1BSD. a true elder emoji πŸ’œ


⭐ AUTHORS ⭐

Bill Joy and Chuck Haley, 1977. absolute main characters, no cap πŸŽ€


πŸ’€ BUGS πŸ’€

okay so this is the part where we get real 🫢 the mkstr utility was intended for the limited architecture of the PDP 11 family. very few programs actually use it. the memory savings are negligible in modern computers. so like… she served her purpose, but she is not the moment anymore 😭


ngl bestie, this one is a museum piece β€” cute, historic, and not saving you any RAM in 2024 πŸ’…

and that's the whole page, periodt ✨ this beauty comes to you from Debian, dated June 6, 2015, and she's filed under MKSTR(1) πŸ¦‹πŸ“

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms