Exemplo n.º 1
0
void	say (const char *format, ...)
{
	va_list args;
	va_start(args, format);
	vsay(format, args);
	va_end(args);
}
Exemplo n.º 2
0
static
void
say(const char *fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	vsay(fmt, ap);
	va_end(ap);
}
Exemplo n.º 3
0
say(
	char const * const	fmt,
	...
)
{
	va_list		ap;

	va_start( ap, fmt );
	vsay( fmt, ap );
	va_end( ap );
}
Exemplo n.º 4
0
/*
 * Begin a subreport. This does *not* flush because sometimes the
 * subreports are in subprocesses and we want each one to print a
 * whole line at once to avoid output interleaving.
 */
void
report_beginsub(const char *descfmt, ...)
{
	va_list ap;

	assert(horizpos == 0);
	say("   ");
	va_start(ap, descfmt);
	vsay(descfmt, ap);
	va_end(ap);
	indent_to(subpos);
}
Exemplo n.º 5
0
/*
 * Begin a test. This flushes the description so it can be seen before
 * the test happens, in case the test explodes or deadlocks the system.
 */
void
report_begin(const char *descfmt, ...)
{
	va_list ap;

	say("badcall: ");
	va_start(ap, descfmt);
	vsay(descfmt, ap);
	va_end(ap);
	say("... ");
	flush();
}
Exemplo n.º 6
0
void
report_warnx(const char *fmt, ...)
{
	size_t pos;
	va_list ap;

	pos = horizpos;
	say("\n     oops: ");
	va_start(ap, fmt);
	vsay(fmt, ap);
	va_end(ap);
	say("\n");
	indent_to(pos);
	flush();
}
Exemplo n.º 7
0
bool
ok_to_reverse (char const *format, ...)
{
  bool r = false;

  if (noreverse || ! (force && verbosity == SILENT))
    {
      va_list args;
      va_start (args, format);
      vsay (format, args);
      va_end (args);
    }

  if (noreverse)
    {
      say ("  Skipping patch.\n");
      skip_rest_of_patch = true;
    }
  else if (force)
    {
      if (verbosity != SILENT)
	say ("  Applying it anyway.\n");
    }
  else if (batch)
    {
      say (reverse ? "  Ignoring -R.\n" : "  Assuming -R.\n");
      r = true;
    }
  else
    {
      ask (reverse ? "  Ignore -R? [n] " : "  Assume -R? [n] ");
      r = *buf == 'y';
      if (! r)
	{
	  ask ("Apply anyway? [n] ");
	  if (*buf != 'y')
	    {
	      if (verbosity != SILENT)
		say ("Skipping patch.\n");
	      skip_rest_of_patch = true;
	    }
	}
    }

  return r;
}
Exemplo n.º 8
0
/*
 * Print a warning message (when within a test). This generates an
 * extra line for the warning. The warnx form is the same but doesn't
 * add errno.
 */
void
report_warn(const char *fmt, ...)
{
	size_t pos;
	const char *errmsg;
	va_list ap;

	pos = horizpos;
	errmsg = strerror(errno);
	say("\n   OOPS: ");
	va_start(ap, fmt);
	vsay(fmt, ap);
	va_end(ap);
	say(": %s\n", errmsg);
	indent_to(pos);
	flush();
}
Exemplo n.º 9
0
usage(
	char const * const	fmt,
	...
)
{
	static char const	opt_fmt[] = "  %-11s %s\n";

	if( fmt )	{
		va_list		ap;

		va_start( ap, fmt );
		vsay( fmt, ap );
		va_end( ap );
		printf( "\n" );
	}
	printf( "NAME\n" );
	printf( "  %s - add newlines to 80-column card images\n", me );
	printf( "\n" );
	printf( "SYNOPSIS\n" );
	printf( "  %s", me );
	printf( " [-D]" );
	printf( " [file..]" );
	printf( "\n" );
	printf( "\n" );
	printf( "DESCRIPTION\n" );
	printf( "  The %s program expects input of 80-column card\n", me );
	printf( "  images.  Each card image is simply copied to the output\n" );
	printf( "  with a newline appended.\n" );
	printf( "\n" );
	printf( "  Input is read from stdin if the 'file' argument is\n" );
	printf( "  not provided.\n" );
	printf( "\n" );
	printf( "OPTIONS\n" );
	printf( opt_fmt, "-D",		"Increase debug output verbosity" );
	printf( opt_fmt, "file",	"80-column card image file" );
	printf( "\n" );
}
Exemplo n.º 10
0
/*
	Routine to process a transitive verb
*/
trverb()
{
	switch(verb){
	case CALM:
	case WALK:
	case QUIT:
	case SCORE:
	case FOO:
	case BRIEF:
	case SUSPEND:
	case HOURS:
	case LOG:
		actspk(verb);
		break;
	case TAKE:
		vtake();
		break;
	case DROP:
		vdrop();
		break;
	case OPEN:
	case LOCK:
		vopen();
		break;
	case SAY:
		vsay();
		break;
	case NOTHING:
		rspeak(54);
		break;
	case ON:
		von();
		break;
	case OFF:
		voff();
		break;
	case WAVE:
		vwave();
		break;
	case KILL:
		vkill();
		break;
	case POUR:
		vpour();
		break;
	case EAT:
		veat();
		break;
	case DRINK:
		vdrink();
		break;
	case RUB:
		if (object != LAMP)
			rspeak(76);
		else
			actspk(RUB);
		break;
	case THROW:
		vthrow();
		break;
	case FEED:
		vfeed();
		break;
	case FIND:
	case INVENTORY:
		vfind();
		break;
	case FILL:
		vfill();
		break;
	case READ:
		vread();
		break;
	case BLAST:
		vblast();
		break;
	case BREAK:
		vbreak();
		break;
	case WAKE:
		vwake();
		break;
	default:
		printf("This verb is not implemented yet.\n");
	}
}