示例#1
0
文件: dbase.c 项目: OPSF/uClinux
/*
 * Query table for specified rows
 * _h: structure representing database connection
 * _k: key names
 * _op: operators
 * _v: values of the keys that must match
 * _c: column names to return
 * _n: nmber of key=values pairs to compare
 * _nc: number of columns to return
 * _o: order by the specified column
 */
int db_query(db_con_t* _h, db_key_t* _k, db_op_t* _op,
	     db_val_t* _v, db_key_t* _c, int _n, int _nc,
	     db_key_t _o, db_res_t** _r)
{
	int off, rv;
	if (!_c) {
		off = snprintf(sql_buf, SQL_BUF_LEN,
			"select * from %s ", CON_TABLE(_h));
	} else {
		off = snprintf(sql_buf, SQL_BUF_LEN, "select ");
		off += print_columns(sql_buf + off, SQL_BUF_LEN - off, _c, _nc);
		off += snprintf(sql_buf + off, SQL_BUF_LEN - off,
			"from %s ", CON_TABLE(_h));
	}
	if (_n) {
		off += snprintf(sql_buf + off, SQL_BUF_LEN - off, "where ");
		off += print_where(sql_buf + off, SQL_BUF_LEN - off,
			_k, _op, _v, _n);
	}
	if (_o) {
		off += snprintf(sql_buf + off, SQL_BUF_LEN - off,
			"order by %s", _o);
	}

	if(begin_transaction(_h, sql_buf)) return(-1);
	if (submit_query(_h, sql_buf) < 0) {
		LOG(L_ERR, "db_query(): Error while submitting query\n");
		return -2;
	}
	rv = get_result(_h, _r);
	free_query(_h);
	commit_transaction(_h);
	return(rv);
}
示例#2
0
文件: misc.c 项目: adtools/abcsh
static void
printoptions(int verbose)
{
        int i;

        if (verbose) {
                struct options_info oi;
                int n, len;

                /* verbose version */
                shprintf("Current option settings\n");

                for (i = n = oi.opt_width = 0; i < NELEM(options); i++)
                        if (options[i].name) {
                                len = strlen(options[i].name);
                                oi.opts[n].name = options[i].name;
                                oi.opts[n++].flag = i;
                                if (len > oi.opt_width)
                                        oi.opt_width = len;
                        }
                print_columns(shl_stdout, n, options_fmt_entry, &oi,
                        oi.opt_width + 5, 1);
        } else {
                /* short version ala ksh93 */
                shprintf("set");
                for (i = 0; i < NELEM(options); i++)
                        if (Flag(i) && options[i].name)
                                shprintf(" -o %s", options[i].name);
                shprintf(newline);
        }
}
示例#3
0
/*----------------------------------------------------------------

     main

-----------------------------------------------------------------*/
int main(int argc, char **argv)
{

	RETCODE retcode = -1;
	int rc;
	GET_LOGIN_VARS()
	    retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HENV, &EnvHandle);

	if (retcode != SQL_SUCCESS) {
		printf("Unable to allocate ODBC environment handle!\n");

		return -1;
	}

	retcode =
	    SQLSetEnvAttr(EnvHandle, SQL_ATTR_ODBC_VERSION,
			  (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);

	if (retcode != SQL_SUCCESS) {
		printf("Unable to set version of ODBC environment handle!\n");
		LogODBCError(retcode, SQL_HANDLE_ENV, EnvHandle);
		return -2;
	}

	rc = db_connect();
	if (rc >= 0) {
		rc = print_columns("SOME_NUMERIC_TYPES");
	}
	return rc;
}
示例#4
0
 std::ostream &print_two_columns(
     std::ostream &out,
     const std::vector<std::string> &left,
     const std::vector<std::string> &right,
     uint pad) {
   std::vector<std::vector<std::string>> cols;
   cols.push_back(left);
   cols.push_back(right);
   return print_columns(out, cols, pad);
 }
示例#5
0
/*
 * Query table for specified rows
 * _h: structure representing database connection
 * _k: key names
 * _op: operators
 * _v: values of the keys that must match
 * _c: column names to return
 * _n: number of key=values pairs to compare
 * _nc: number of columns to return
 * _o: order by the specified column
 */
int db_query(db_con_t* _h, db_key_t* _k, db_op_t* _op,
	     db_val_t* _v, db_key_t* _c, int _n, int _nc,
	     db_key_t _o, db_res_t** _r)
{
	int off, ret;

	if (!_h) {
		LOG(L_ERR, "db_query: Invalid parameter value\n");
		return -1;
	}

	if (!_c) {
		ret = snprintf(sql_buf, SQL_BUF_LEN, "select * from %s ", CON_TABLE(_h));
		if (ret < 0 || ret >= SQL_BUF_LEN) goto error;
		off = ret;
	} else {
		ret = snprintf(sql_buf, SQL_BUF_LEN, "select ");
		if (ret < 0 || ret >= SQL_BUF_LEN) goto error;
		off = ret;

		ret = print_columns(sql_buf + off, SQL_BUF_LEN - off, _c, _nc);
		if (ret < 0) return -1;
		off += ret;

		ret = snprintf(sql_buf + off, SQL_BUF_LEN - off, "from %s ", CON_TABLE(_h));
		if (ret < 0 || ret >= (SQL_BUF_LEN - off)) goto error;
		off += ret;
	}
	if (_n) {
		ret = snprintf(sql_buf + off, SQL_BUF_LEN - off, "where ");
		if (ret < 0 || ret >= (SQL_BUF_LEN - off)) goto error;
		off += ret;

		ret = print_where(CON_CONNECTION(_h), sql_buf + off, SQL_BUF_LEN - off, _k, _op, _v, _n);
		if (ret < 0) return -1;;
		off += ret;
	}
	if (_o) {
		ret = snprintf(sql_buf + off, SQL_BUF_LEN - off, "order by %s", _o);
		if (ret < 0 || ret >= (SQL_BUF_LEN - off)) goto error;
		off += ret;
	}
	
	*(sql_buf + off) = '\0';
	if (submit_query(_h, sql_buf) < 0) {
		LOG(L_ERR, "db_query: Error while submitting query\n");
		return -2;
	}

	return store_result(_h, _r);

 error:
	LOG(L_ERR, "db_query: Error in snprintf\n");
	return -1;
}
示例#6
0
int main(void)
{
	int n_columns;
	int columns[MAX_COLS];
	char input[MAX_INPUT_LENGTH];
	char output[MAX_INPUT_LENGTH];
	
	n_columns = read_column_numbers(columns, MAX_COLS);
		
	printf("unsorted columns: ");
	print_columns(columns, n_columns);
	selection_sort(columns, n_columns); // sort columns array in place
	printf("sorted columns: ");
	print_columns(columns, n_columns);
	
	while(gets(input) != NULL) {
		printf("Original input: %s\n", input);
		rearrange(output, input, n_columns, columns);
		printf("Rearranged line: %s\n", output);
	}

	return EXIT_SUCCESS;
}
示例#7
0
static void wt_status_print_other(struct wt_status *s,
				  struct string_list *l,
				  const char *what,
				  const char *how)
{
	int i;
	struct strbuf buf = STRBUF_INIT;
	static struct string_list output = STRING_LIST_INIT_DUP;
	struct column_options copts;

	if (!l->nr)
		return;

	wt_status_print_other_header(s, what, how);

	for (i = 0; i < l->nr; i++) {
		struct string_list_item *it;
		const char *path;
		it = &(l->items[i]);
		path = quote_path(it->string, s->prefix, &buf);
		if (column_active(s->colopts)) {
			string_list_append(&output, path);
			continue;
		}
		status_printf(s, color(WT_STATUS_HEADER, s), "\t");
		status_printf_more(s, color(WT_STATUS_UNTRACKED, s),
				   "%s\n", path);
	}

	strbuf_release(&buf);
	if (!column_active(s->colopts))
		goto conclude;

	strbuf_addf(&buf, "%s%s\t%s",
		    color(WT_STATUS_HEADER, s),
		    s->display_comment_prefix ? "#" : "",
		    color(WT_STATUS_UNTRACKED, s));
	memset(&copts, 0, sizeof(copts));
	copts.padding = 1;
	copts.indent = buf.buf;
	if (want_color(s->use_color))
		copts.nl = GIT_COLOR_RESET "\n";
	print_columns(&output, s->colopts, &copts);
	string_list_clear(&output, 0);
	strbuf_release(&buf);
conclude:
	status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
}
示例#8
0
文件: dbase.c 项目: OPSF/uClinux
/*
 * Insert a row into specified table
 * _h: structure representing database connection
 * _k: key names
 * _v: values of the keys
 * _n: number of key=value pairs
 */
int db_insert(db_con_t* _h, db_key_t* _k, db_val_t* _v, int _n)
{
	int off;
	off = snprintf(sql_buf, SQL_BUF_LEN, "insert into %s (", CON_TABLE(_h));
	off += print_columns(sql_buf + off, SQL_BUF_LEN - off, _k, _n);
	off += snprintf(sql_buf + off, SQL_BUF_LEN - off, ") values (");
	off += print_values(sql_buf + off, SQL_BUF_LEN - off, _v, _n);
	*(sql_buf + off++) = ')';
	*(sql_buf + off) = '\0';

	if(begin_transaction(_h, sql_buf)) return(-1);
	if (submit_query(_h, sql_buf) < 0) {
		LOG(L_ERR, "db_insert(): Error while inserting\n");
		return -2;
	}
	free_query(_h);
	commit_transaction(_h);
	return(0);
}
void
pr_list(char * const *ap)
{
	size_t acols = 0, aocts = 0, i;
	unsigned int n;
	char * const *pp;

	for (n = 0, pp = ap; *pp; n++, pp++) {
		i = strlen(*pp);
		if (i > aocts)
			aocts = i;
		i = utf_mbswidth(*pp);
		if (i > acols)
			acols = i;
	}

	print_columns(shl_out, n, plain_fmt_entry, (const void *)ap,
	    aocts, acols, false);
}
示例#10
0
文件: column.c 项目: guban/git
int cmd_column(int argc, const char **argv, const char *prefix)
{
	struct string_list list = STRING_LIST_INIT_DUP;
	struct strbuf sb = STRBUF_INIT;
	struct column_options copts;
	const char *command = NULL, *real_command = NULL;
	struct option options[] = {
		OPT_STRING(0, "command", &real_command, N_("name"), N_("lookup config vars")),
		OPT_COLUMN(0, "mode", &colopts, N_("layout to use")),
		OPT_INTEGER(0, "raw-mode", &colopts, N_("layout to use")),
		OPT_INTEGER(0, "width", &copts.width, N_("Maximum width")),
		OPT_STRING(0, "indent", &copts.indent, N_("string"), N_("Padding space on left border")),
		OPT_INTEGER(0, "nl", &copts.nl, N_("Padding space on right border")),
		OPT_INTEGER(0, "padding", &copts.padding, N_("Padding space between columns")),
		OPT_END()
	};

	git_config(platform_core_config, NULL);

	/* This one is special and must be the first one */
	if (argc > 1 && starts_with(argv[1], "--command=")) {
		command = argv[1] + 10;
		git_config(column_config, (void *)command);
	} else
		git_config(column_config, NULL);

	memset(&copts, 0, sizeof(copts));
	copts.width = term_columns();
	copts.padding = 1;
	argc = parse_options(argc, argv, "", options, builtin_column_usage, 0);
	if (argc)
		usage_with_options(builtin_column_usage, options);
	if (real_command || command) {
		if (!real_command || !command || strcmp(real_command, command))
			die(_("--command must be the first argument"));
	}
	finalize_colopts(&colopts, -1);
	while (!strbuf_getline(&sb, stdin))
		string_list_append(&list, sb.buf);

	print_columns(&list, colopts, &copts);
	return 0;
}
示例#11
0
文件: help.c 项目: CSRedRat/git
static void pretty_print_cmdnames(struct cmdnames *cmds, unsigned int colopts)
{
	struct string_list list = STRING_LIST_INIT_NODUP;
	struct column_options copts;
	int i;

	for (i = 0; i < cmds->cnt; i++)
		string_list_append(&list, cmds->names[i]->name);
	/*
	 * always enable column display, we only consult column.*
	 * about layout strategy and stuff
	 */
	colopts = (colopts & ~COL_ENABLE_MASK) | COL_ENABLED;
	memset(&copts, 0, sizeof(copts));
	copts.indent = "  ";
	copts.padding = 2;
	print_columns(&list, colopts, &copts);
	string_list_clear(&list, 0);
}
示例#12
0
/*
 *	print a select style menu
 */
void
pr_menu(const char * const *ap)
{
	struct select_menu_info smi;
	const char * const *pp;
	size_t acols = 0, aocts = 0, i;
	unsigned int n;

	/*
	 * width/column calculations were done once and saved, but this
	 * means select can't be used recursively so we re-calculate
	 * each time (could save in a structure that is returned, but
	 * it's probably not worth the bother)
	 */

	/*
	 * get dimensions of the list
	 */
	for (n = 0, pp = ap; *pp; n++, pp++) {
		i = strlen(*pp);
		if (i > aocts)
			aocts = i;
		i = utf_mbswidth(*pp);
		if (i > acols)
			acols = i;
	}

	/*
	 * we will print an index of the form "%d) " in front of
	 * each entry, so get the maximum width of this
	 */
	for (i = n, smi.num_width = 1; i >= 10; i /= 10)
		smi.num_width++;

	smi.args = ap;
	print_columns(shl_out, n, select_fmt_entry, (void *)&smi,
	    smi.num_width + 2 + aocts, smi.num_width + 2 + acols,
	    true);
}
示例#13
0
/*
 * Insert a row into specified table
 * _h: structure representing database connection
 * _k: key names
 * _v: values of the keys
 * _n: number of key=value pairs
 */
int db_insert(db_con_t* _h, db_key_t* _k, db_val_t* _v, int _n)
{
	int off, ret;

	if ((!_h) || (!_k) || (!_v) || (!_n)) {
		LOG(L_ERR, "db_insert: Invalid parameter value\n");
		return -1;
	}

	ret = snprintf(sql_buf, SQL_BUF_LEN, "insert into %s (", CON_TABLE(_h));
	if (ret < 0 || ret >= SQL_BUF_LEN) goto error;
	off = ret;

	ret = print_columns(sql_buf + off, SQL_BUF_LEN - off, _k, _n);
	if (ret < 0) return -1;
	off += ret;

	ret = snprintf(sql_buf + off, SQL_BUF_LEN - off, ") values (");
	if (ret < 0 || ret >= (SQL_BUF_LEN - off)) goto error;
	off += ret;

	ret = print_values(CON_CONNECTION(_h), sql_buf + off, SQL_BUF_LEN - off, _v, _n);
	if (ret < 0) return -1;
	off += ret;

	*(sql_buf + off++) = ')';
	*(sql_buf + off) = '\0';

	if (submit_query(_h, sql_buf) < 0) {
	        LOG(L_ERR, "db_insert: Error while submitting query\n");
		return -2;
	}
	return 0;

 error:
	LOG(L_ERR, "db_insert: Error in snprintf\n");
	return -1;
}
示例#14
0
static void
printoptions(bool verbose)
{
	int i = 0;

	if (verbose) {
		int n = 0, len, octs = 0;
		struct options_info oi;

		/* verbose version */
		shf_puts("Current option settings\n", shl_stdout);

		oi.opt_width = 0;
		while (i < (int)NELEM(options)) {
			if (options[i].name) {
				oi.opts[n++] = i;
				len = strlen(options[i].name);
				if (len > octs)
					octs = len;
				len = utf_mbswidth(options[i].name);
				if (len > oi.opt_width)
					oi.opt_width = len;
			}
			++i;
		}
		print_columns(shl_stdout, n, options_fmt_entry, &oi,
		    octs + 4, oi.opt_width + 4, true);
	} else {
		/* short version á la AT&T ksh93 */
		shf_puts("set", shl_stdout);
		while (i < (int)NELEM(options)) {
			if (Flag(i) && options[i].name)
				shprintf(" -o %s", options[i].name);
			++i;
		}
		shf_putc('\n', shl_stdout);
	}
}
示例#15
0
/*
 * Just like insert, but replace the row if it exists
 */
int db_replace(db_con_t* handle, db_key_t* keys, db_val_t* vals, int n)
{
	int off, ret;

	if (!handle || !keys || !vals) {
		LOG(L_ERR, "db_replace: Invalid parameter value\n");
		return -1;
	}

	ret = snprintf(sql_buf, SQL_BUF_LEN, "replace %s (", CON_TABLE(handle));
	if (ret < 0 || ret >= SQL_BUF_LEN) goto error;
	off = ret;

	ret = print_columns(sql_buf + off, SQL_BUF_LEN - off, keys, n);
	if (ret < 0) return -1;
	off += ret;

	ret = snprintf(sql_buf + off, SQL_BUF_LEN - off, ") values (");
	if (ret < 0 || ret >= (SQL_BUF_LEN - off)) goto error;
	off += ret;

	ret = print_values(CON_CONNECTION(handle), sql_buf + off, SQL_BUF_LEN - off, vals, n);
	if (ret < 0) return -1;
	off += ret;

	*(sql_buf + off++) = ')';
	*(sql_buf + off) = '\0';

	if (submit_query(handle, sql_buf) < 0) {
	        LOG(L_ERR, "db_replace: Error while submitting query\n");
		return -2;
	}
	return 0;

 error:
	LOG(L_ERR, "db_replace: Error in snprintf\n");
	return -1;
}
示例#16
0
void		re_size_column(int signo)
{
	struct winsize	s;
	t_data			*data;

	data = NULL;
	if (signo == SIGWINCH)
	{
		if (!g_argv)
			return ;
		if (!(data = alloc_memory(data, s)))
			return ;
		ioctl(0, TIOCGWINSZ, &s);
		data = get_column(data, g_argv, (s.ws_row - 2));
		if (g_pos)
			data->pos = g_pos;
		ft_putstr(CLEAR_SCREEN);
		if (check_column_size(data, s.ws_col))
			print_columns(data, 0, 0, get_bigger(data));
		else
			ft_putstr("Windows size is too small !\n");
	}
}
示例#17
0
文件: misc.c 项目: rovaughn/distro
static void
printoptions(bool verbose)
{
	size_t i = 0;

	if (verbose) {
		size_t n = 0, len, octs = 0;
		struct options_info oi;

		/* verbose version */
		shf_puts("Current option settings\n", shl_stdout);

		oi.opt_width = 0;
		while (i < NELEM(options)) {
			if ((len = strlen(OFN(i)))) {
				oi.opts[n++] = i;
				if (len > octs)
					octs = len;
				len = utf_mbswidth(OFN(i));
				if ((int)len > oi.opt_width)
					oi.opt_width = (int)len;
			}
			++i;
		}
		print_columns(shl_stdout, n, options_fmt_entry, &oi,
		    octs + 4, oi.opt_width + 4, true);
	} else {
		/* short version like AT&T ksh93 */
		shf_puts(Tset, shl_stdout);
		while (i < NELEM(options)) {
			if (Flag(i) && OFN(i)[0])
				shprintf(" -o %s", OFN(i));
			++i;
		}
		shf_putc('\n', shl_stdout);
	}
}
示例#18
0
文件: list.c 项目: wothke/spectrezx
static void list_file_contents(LHAFilter *filter, FILE *fstream,
                               LHAOptions *options, ListColumn **columns)
{
	FileStatistics stats;

	if (options->quiet < 2) {
		print_list_headings(columns);
		print_list_separators(columns);
	}

	stats.num_files = 0;
	stats.length = 0;
	stats.compressed_length = 0;
	stats.timestamp = read_file_timestamp(fstream);

	for (;;) {
		LHAFileHeader *header;

		header = lha_filter_next_file(filter);

		if (header == NULL) {
			break;
		}

		print_columns(columns, header);

		++stats.num_files;
		stats.length += header->length;
		stats.compressed_length += header->compressed_length;
	}

	if (options->quiet < 2) {
		print_list_separators(columns);
		print_footers(columns, &stats);
	}
}
示例#19
0
文件: misc.c 项目: a565109863/src
static void
printoptions(int verbose)
{
	unsigned int ele;

	if (verbose) {
		struct options_info oi;
		unsigned int n;
		int len;

		/* verbose version */
		shprintf("Current option settings\n");

		for (ele = n = oi.opt_width = 0; ele < NELEM(sh_options); ele++) {
			if (sh_options[ele].name) {
				len = strlen(sh_options[ele].name);
				oi.opts[n].name = sh_options[ele].name;
				oi.opts[n++].flag = ele;
				if (len > oi.opt_width)
					oi.opt_width = len;
			}
		}
		print_columns(shl_stdout, n, options_fmt_entry, &oi,
		    oi.opt_width + 5, 1);
	} else {
		/* short version ala ksh93 */
		shprintf("set");
		for (ele = 0; ele < NELEM(sh_options); ele++) {
			if (sh_options[ele].name)
				shprintf(" %co %s",
					 Flag(ele) ? '-' : '+',
					 sh_options[ele].name);
		}
		shprintf("\n");
	}
}
示例#20
0
void Configurable::print_properties()
{
	int cell_width = 40;

	std::cout << "Properties of '" << name << std::endl << std::endl;

	std::vector<std::string> interactive;
	std::vector<std::string> readonly;
	std::vector<std::string> create;
	std::vector<std::string> internal;

	for(std::map<const std::string, SettableItem *>::iterator it = properties.begin();
			it != properties.end();
			++it)
	{
		if(it->second->configurable)
		{
			if(it->second->interactive)
				interactive.push_back("'" + it->first + "'");
			else
				create.push_back("'" + it->first + "'");
		}
		else
		{
			if(it->second->interactive)
				readonly.push_back("'" + it->first + "'");
			else
				internal.push_back("'" + it->first + "'");
		}
	}

	print_columns(interactive, "Interactive", readonly, "Readonly", cell_width);
	std::cout << std::endl;

	if(create.size() > 0 || internal.size() > 0)
	{
		print_columns(create, "Set prior to creating", internal, "Internal", cell_width);
		std::cout << std::endl;
	}

	std::vector<std::string> active;
	std::vector<std::string> notactive;

	for(std::map<const std::string, std::map<const std::string, BaseAllocator *> >::iterator
			it = available_sub_contexts.begin();
			it != available_sub_contexts.end();
			++it)
	{
		std::map<const std::string, Configurable *>::iterator found
			= active_sub_contexts.find(it->first);

		std::vector<std::string> *pushed_to;

		if(found != active_sub_contexts.end())
		{
			std::string label;
			if(found->second->created)
				label += "(C) ";
			else
				label += "(A) ";

			std::string post_label;
			if(it->second.size() > 1)
				post_label = "('" + found->second->name + "')";

			active.push_back(label + "'" + found->first + "' " + post_label);
			pushed_to = &active;
		}
		else
		{
			notactive.push_back("'" + it->first + "'");
			pushed_to = &notactive;
		}

		if(it->second.size() > 1)
		{
			// A context with alternatives
			for(std::map<const std::string, BaseAllocator *>::iterator
					iter = it->second.begin();
					iter != it->second.end();
					++iter)
			{
				pushed_to->push_back(" - '" + iter->first + "'");
			}
		}
	}

	if(active.size() > 0 || notactive.size() > 0)
	{
		print_columns(active, "(A)ctive + (C)reated subcontexts", notactive, "Inactive subcontexts", cell_width);
		std::cout << std::endl;
	}

	std::cout << std::setfill('-') << std::setw(2*cell_width) << "" << std::endl;
}
示例#21
0
int main(int argc, char *argv[])
{
    struct GModule *module;

    char *input_opt, *field_opt;
    int hist_flag, col_flag, shell_flag;
    
    struct Map_info Map;
    
    G_gisinit(argv[0]);

    module = G_define_module();
    G_add_keyword(_("vector"));
    G_add_keyword(_("metadata"));
    G_add_keyword(_("topology"));
    G_add_keyword(_("extent"));
    G_add_keyword(_("history"));
    G_add_keyword(_("attribute columns"));
    
    module->description =
	_("Outputs basic information about a vector map.");

    G_debug(1, "LFS is %s", sizeof(off_t) == 8 ? "available" : "not available");
    
    parse_args(argc, argv,
	       &input_opt, &field_opt,
	       &hist_flag, &col_flag, &shell_flag);

     /* try to open head-only on level 2 */
    if (Vect_open_old_head2(&Map, input_opt, "", field_opt) < 2) {
	/* force level 1, open fully
	 * NOTE: number of points, lines, boundaries, centroids, faces, kernels is still available */
	Vect_close(&Map);
	Vect_set_open_level(1); /* no topology */
	if (Vect_open_old2(&Map, input_opt, "", field_opt) < 1)
	    G_fatal_error(_("Unable to open vector map <%s>"), Vect_get_full_name(&Map));

	/* level one info not needed for history, title, columns */
	if (!hist_flag && !col_flag)
	    level_one_info(&Map);
    }

    if (hist_flag || col_flag) {
	if (hist_flag) {
	    char buf[1001];
	    
	    Vect_hist_rewind(&Map);
	    while (Vect_hist_read(buf, 1000, &Map) != NULL) {
		fprintf(stdout, "%s\n", buf);
	    }
	}
	else if (col_flag) {
	    print_columns(&Map, input_opt, field_opt);
	}
	Vect_close(&Map);
	
	return (EXIT_SUCCESS);
    }
    
    if (shell_flag & SHELL_BASIC) {
	print_shell(&Map);
    }
    if (shell_flag & SHELL_REGION) {
	print_region(&Map);
    }
    if (shell_flag & SHELL_TOPO) {
	print_topo(&Map);
    }
    if (shell_flag == 0) {
	print_info(&Map);
    }

    Vect_close(&Map);

    return (EXIT_SUCCESS);
}