VistaIOReportBadArgs(3)

πŸ’– VistaIOReportBadArgs β€” the "bestie, what even ARE these flags" reporter πŸ’–

okay so real talk: this is a <pink>Library Functions Manual</pink> page for <cyan>VistaIOReportBadArgs</cyan>, section 3. It's the friend who politely tells everyone which command line arguments nobody understood. 🫢


✨ NAME ✨

VistaIOReportBadArgs β€” report unrecognized command line arguments

no cap, that's literally the whole job. it snitches (kindly) on the args nobody claimed. πŸ’…


🌸 SYNOPSIS 🌸

#include <vistaio.h>

void VistaIOReportBadArgs (argc, argv)
       int argc;
       char *argv;

yes bestie, it's giving vintage K&R energy and we respect it. πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • argc β€” how many unrecognized command line arguments there are. the count. the number. the vibe check quantity. ✨
  • argv β€” a vector of the unrecognized command line arguments. the actual receipts. 🧾

πŸ’œ DESCRIPTION πŸ’œ

So VistaIOReportBadArgs is usually called right after VistaIOParseCommand has already indicated a problem parsing command line arguments. like, VistaIOParseCommand raised its hand and said "bestie, something's off" β€” and then this function is the one that prints the message listing exactly those arguments that VistaIOParseCommand could not comprehend. 😭

Here's the tea: VistaIOParseCommand leaves the program name and any unrecognized arguments in the first argc entries of the argv vector. VistaIOReportBadArgs finds them right there. it assumes that:

  • argv[0] contains the program's name πŸ‘‘
  • argv[1] through argv[argc - 1] are the arguments that could not be parsed πŸ™ˆ

The message it prints to the standard error stream is of the form:

program: Unrecognized arguments: arg1 arg2 ...

where program is the first element of argv and arg1, arg2, etc. are the remaining elements. iconic formatting, honestly. 🌈


⭐ EXAMPLES ⭐

The following code fragment parses command line arguments using VistaIOParseCommand. Any arguments not recognized by VistaIOParseCommand are then parsed by some other means (e.g., by XtDisplayInitialize(3Xt)). Finally, if any arguments remain, having not been recognized during either parsing, they are printed along with information on the valid program options. 🌸

#include <vistaio.h>

static VistaIOOptionDescRec options[] = { /* option table entries */ };

int main (int argc, char *argv)
{
       if (! VistaIOParseCommand (VistaIONumber (options), options, & argc, argv))
              goto Usage;

       Parse arguments remaining in argv[1] ... argv[argc - 1].

       if (argc > 1) {
              VistaIOReportBadArgs (argc, argv);
Usage:
              VistaIOReportUsage (argv[0], VistaIONumber (options), options, NULL);
              fprintf (stderr, "    plus any X Windows options.\n\n");
              exit (1);
       }

       ...

}

see how it all flows? parse, parse again, and if stuff is still left over β€” report it, show usage, dip out with exit (1). main character energy fr fr. πŸ’…βœ¨


πŸ‘‘ SEE ALSO πŸ‘‘

go read those next bestie, they're the whole friend group. 🫢


πŸŽ€ AUTHOR πŸŽ€

Art Pope <pope@cs.ubc.ca>

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


ngl this whole page is <rainbow>VistaIO Version 1.2.14</rainbow>, dated <hotpink>24 April 1993</hotpink>, and it still ate. periodt. πŸ’–βœ¨πŸ¦‹