Example #1
0
void search_node( TiXmlNode* pNode , std::vector<std::string>& file_table )
{
	if ( pNode == NULL )
		return;

	for ( pNode ; pNode ; pNode = pNode->NextSibling( "ItemGroup" ) )
	{
		TiXmlNode* pChild = pNode->FirstChild();
		for( pChild ; pChild ; pChild = pChild->NextSibling("ClCompile" ) )
		{
			const char* filepath = 
				pChild->ToElement()->Attribute( "Include" );
			if ( filter_file( filepath ) )
			{
				find_fileconfiguration( pChild->ToElement() , filepath );
				file_table.push_back( std::string( filepath ) );
			}
		}
	}
}
Example #2
0
/* Is the given file can be open only for append */
int is_onlyappend(const char* filename){
	return filter_file(filename, SF_ONLYAPPEND);
}
Example #3
0
/* Is the given file unremovable */
int is_unremovable(const char* filename){
	return filter_file(filename, SF_UNREMOVABLE);
}
Example #4
0
/* Is the given file invisible */
int is_invisible(const char* filename){
	return filter_file(filename, SF_INVISIBLE);
}
Example #5
0
int
main(int argc, char **argv)
{
	const char *pattern = NULL;
	dev_t device = -1;
	ino_t node = -1;
	int32 id = -1;
	info_mode mode = kList;
	bool brief = false;

	// parse arguments

	if (argc == 2) {
		// filter output
		if (isdigit(argv[1][0]))
			id = atol(argv[1]);
		else if (argv[1][0] == '-')
			usage(!strcmp(argv[1], "--help"));
		else
			pattern = argv[1];
	} else if (argc > 2) {
		if (!strcmp(argv[1], "-d") || !strcmp(argv[1], "-D")) {
			// filter by device usage
			device = dev_for_path(argv[2]);
			if (device < 0) {
				fprintf(stderr, "%s: could not find device: %s\n", __progname,
					strerror(errno));
				return 1;
			}
			mode = kFilterDevice;
			if (argv[1][1] == 'D')
				brief = true;
		} else if (!strcmp(argv[1], "-f") || !strcmp(argv[1], "-F")) {
			// filter by file usage
			struct stat stat;
			if (::stat(argv[2], &stat) < 0) {
				fprintf(stderr, "%s: could not open file: %s\n", __progname,
					strerror(errno));
				return 1;
			}
			device = stat.st_dev;
			node = stat.st_ino;
			mode = kFilterFile;
			if (argv[1][1] == 'F')
				brief = true;
		} else
			usage(true);
	}

	// do the job!

	team_info info;
	int32 cookie = 0;

	while (get_next_team_info(&cookie, &info) == B_OK) {
		switch (mode) {
			case kList:
				if ((id != -1 && id != info.team)
					|| (pattern != NULL && !strstr(info.args, pattern)))
					continue;
				print_fds(info);
				break;

			case kFilterDevice:
				filter_device(info, device, brief);
				break;
			case kFilterFile:
				filter_file(info, device, node, brief);
				break;
		}
	}

	return 0;
}