VistaIOWarning(3)

πŸ’– VistaIOWarning(3) β€” the "hey bestie, something's off but we're not dying" page πŸ’–

okay so this is a page from the Library Functions Manual, and it's about two little functions that go "psst… something went wrong" without like, ending everything. very demure, very mindful, very nonfatal. ✨


🌸 NAME 🌸

VistaIOWarning, VistaIOSystemWarning β€” report a nonfatal error πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

void VistaIOWarning (format [, arg...])
       VistaIOStringConst format;

void VistaIOSystemWarning (format [, arg...])
       VistaIOStringConst format;

πŸ¦‹ ARGUMENTS πŸ¦‹

  • format β€” the format of the message that's gonna get reported. like, the blueprint of the yap. πŸ“
  • arg β€” the values that get slotted into the formatted message. the little guys that fill in the blanks. 🫢

✨ DESCRIPTION ✨

So VistaIOWarning is what you call when you wanna report a nonfatal error. not the end of the world, not a crash, just a heads-up. it composes an error message and hands it off to the nonfatal error handler, which β€” and this is the typical behaviour, not a promise β€” usually prints the message and then returns. (peep VistaIOSetWarningHandler(3) for the deets on that handler.)

The message that VistaIOWarning puts together looks like this:

Program: Warning: Description.

Program is the program's name, and it only shows up if it was previously established with a call to VistaIOSetProgramName. Description is a string that's been formatted by sprintf using format, plus all of the optional arguments, arg. πŸ’«

VistaIOSystemWarning is identical to VistaIOWarning, except it also tosses a phrase into the message based on the current value of the external variable errno β€” which is the thing system calls use to return diagnostic codes. the message from VistaIOSystemWarning looks like this:

Program: Warning: Description: Diagnostic.

Diagnostic is a short phrase that corresponds to the value of errno. that phrase comes from the table used by perror(3). πŸ”₯


πŸ’€ EXAMPLES πŸ’€

okay first example: the values of attr_name, act_value, and exp_value get incorporated into the error message that VistaIOWarning produces. it's giving "personalised callout".

char *attr_name;
float act_value, exp_value;

if (act_value != exp_value)
     VistaIOWarning ("MyRoutine: Attribute %s is %f rather than %f",
          attr_name, act_value, exp_value);

second example: the diagnostic phrase that corresponds to the value of errno gets incorporated into the error message that VistaIOSystemWarning produces. ioctl said no and we're reporting it. πŸ™ˆ

if (ioctl (fd, request, arg) == -1)
     VistaIOSystemWarning ("MyRoutine: ioctl failed");

πŸ‘‘ SEE ALSO πŸ‘‘

VistaIOError(3), VistaIOSetWarningHandler(3), VistaIOSetProgramName(3), perror(3),

(yes bestie there's a trailing comma at the end, it's part of the vibe, leave it alone 😭)


πŸ’œ AUTHOR πŸ’œ

Art Pope <pope@cs.ubc.ca>

Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>


and that's the whole page, bestie!! πŸŽ€ this was VistaIO Version 1.2.14, dated 24 April 1993 β€” iconic behaviour from the archives, honestly. go forth and warn responsibly, nonfatally, periodt. πŸ’…βœ¨πŸŒˆ