Пример #1
0
/*
 * history <file1> ... <fileN>
 */
void
hammer_cmd_history(const char *offset_str, char **av, int ac)
{
	off_t off;
	int i;
	int len;
	char *rptr;

	len = 32;
	if (*offset_str == '@') {
		off = strtoll(offset_str + 1, &rptr, 0);
		if (*rptr == ',')
			len = strtol(rptr + 1, NULL, 0);
	} else {
		off = -1;
	}

	for (i = 0; i < ac; ++i)
		hammer_do_history(av[i], off, len);
}
Пример #2
0
/*
 * history <file1> ... <fileN>
 */
void
hammer_cmd_history(const char *offset_str, char **av, int ac)
{
	int i;
	int old_behavior = 0;
	cmd_attr_t ca;

	bzero(&ca, sizeof(ca));
	if (parse_attr(offset_str, &ca) == 0)
		old_behavior = 1;

	for (i = 0; i < ac; ++i) {
		if (!old_behavior)
			parse_attr_path(av[i], &ca);
		if (ca.path == NULL)
			ca.path = strdup(av[i]);
		hammer_do_history(ca.path, ca.offset, ca.length);
		free(ca.path);
		ca.path = NULL;
	}
}