Ejemplo n.º 1
0
int main( int argc, char *argv[] )
{
	const char *flags = NULL;
	const char *file = NULL;
	off_t size = 0;

	if (!(2 <= argc && argc <= 4)) {
		fprintf(stderr, "Use: %s <flags> [file [size]]\n", argv[0]);
		fprintf(stderr, "Debug flags are: ");
		debug_flags_print(stderr);
		fprintf(stderr, "\n");
		exit(EXIT_FAILURE);
	}

	flags = argv[1];
	if (argc >= 3)
		file = argv[2];
	if (argc >= 4)
		size = strtol(argv[3], NULL, 10);

	int result = parrot_debug(flags, file, size);
	if (result == -1) {
		fprintf(stderr, "debug: %s\n", strerror(errno));
		exit(EXIT_FAILURE);
	}
	return 0;
}
Ejemplo n.º 2
0
static INT64_T do_help(int argc, char **argv)
{
	int i;
	printf("Commands:\n");
	for(i = 0; list[i].name; i++) {
		printf("%-12s %s\n", list[i].name, list[i].help);
	}
	printf("\nDebugging subsystems are:\n");
	debug_flags_print(stdout);
	printf("\n");
	return 0;
}
Ejemplo n.º 3
0
static void show_help(const char *cmd)
{
	fprintf(stdout, "Use: %s [options]\n", cmd);
	fprintf(stdout, "Where options are:\n");
	fprintf(stdout, " %-30s This message\n", "-h,--help=<flag>");
	fprintf(stdout, " %-30s Debugging\n", "-d,--debug=<flag>");
	fprintf(stdout, " %-30s Send debugging to this file. (can also be :stderr, :stdout, :syslog, or :journal)\n", "-o,--debug-file=<file>");
	fprintf(stdout, " %-30s Rotate debug files of this size (default 10M, 0 disables)\n", "-O,--debug-rotate-max=<bytes>");
	fprintf(stdout, " %-30s Allow this auth type\n", "-a,--auth=<type>");
	fprintf(stdout, " %-30s Port number\n", "-p,--port=<num>");
	fprintf(stdout, " %-30s Remote host\n", "-r,--host=<host>");
	fprintf(stdout, "Where debug flags arg: ");

	debug_flags_print(stderr);

	fprintf(stdout, "\n");
}
Ejemplo n.º 4
0
static INT64_T do_debug(int argc, char **argv)
{
	if(argv[1]) {
		if(debug_flags_set(argv[1])) {
			return 0;
		} else {
			printf("Valid debugging flags are: ");
			debug_flags_print(stdout);
			printf("\n");
			errno = EINVAL;
			return -1;
		}
	} else {
		debug_flags_clear();
		return 0;
	}

}