src/main.c
changeset 247 63444a10fb8e
parent 245 0311b3fe72e3
child 249 061a5b815727
child 258 29d5002bd17f
     1.1 --- a/src/main.c	Thu Jun 19 00:32:24 2008 -0400
     1.2 +++ b/src/main.c	Fri Jun 20 14:18:52 2008 -0400
     1.3 @@ -73,17 +73,14 @@
     1.4  }
     1.5  
     1.6  static int
     1.7 -list_properties(const char *package_name,
     1.8 -		enum razor_property_type required_type)
     1.9 +list_properties(const char *package_name, uint32_t type)
    1.10  {
    1.11 -	static const char *relation_string[] = { "<", "<=", "=", ">=", ">" };
    1.12  	struct razor_set *set;
    1.13  	struct razor_property *property;
    1.14  	struct razor_package *package;
    1.15  	struct razor_property_iterator *pi;
    1.16  	const char *name, *version;
    1.17 -	enum razor_property_type type;
    1.18 -	enum razor_version_relation relation;
    1.19 +	uint32_t flags;
    1.20  
    1.21  	set = razor_set_open(repo_filename);
    1.22  	if (package_name)
    1.23 @@ -93,15 +90,28 @@
    1.24  
    1.25  	pi = razor_property_iterator_create(set, package);
    1.26  	while (razor_property_iterator_next(pi, &property,
    1.27 -					    &name, &relation, &version,
    1.28 -					    &type)) {
    1.29 -		if (type != required_type)
    1.30 +					    &name, &flags, &version)) {
    1.31 +		if ((flags & RAZOR_PROPERTY_TYPE_MASK) != type)
    1.32  			continue;
    1.33 -		if (version[0] == '\0')
    1.34 -			printf("%s\n", name);
    1.35 -		else
    1.36 -			printf("%s %s %s\n", name,
    1.37 -			       relation_string[relation], version);
    1.38 +		printf("%s", name);
    1.39 +		if (version[0] != '\0')
    1.40 +			printf(" %s %s",
    1.41 +			       razor_property_relation_to_string(property),
    1.42 +			       version);
    1.43 +
    1.44 +		if (flags & ~(RAZOR_PROPERTY_RELATION_MASK | RAZOR_PROPERTY_TYPE_MASK)) {
    1.45 +			printf(" [");
    1.46 +			if (flags & RAZOR_PROPERTY_PRE)
    1.47 +				printf(" pre");
    1.48 +			if (flags & RAZOR_PROPERTY_POST)
    1.49 +				printf(" post");
    1.50 +			if (flags & RAZOR_PROPERTY_PREUN)
    1.51 +				printf(" preun");
    1.52 +			if (flags & RAZOR_PROPERTY_POSTUN)
    1.53 +				printf(" postun");
    1.54 +			printf(" ]");
    1.55 +		}
    1.56 +		printf("\n");
    1.57  	}
    1.58  	razor_property_iterator_destroy(pi);
    1.59  
    1.60 @@ -203,14 +213,13 @@
    1.61  static int
    1.62  list_property_packages(const char *ref_name,
    1.63  		       const char *ref_version,
    1.64 -		       enum razor_property_type ref_type)
    1.65 +		       uint32_t type)
    1.66  {
    1.67  	struct razor_set *set;
    1.68  	struct razor_property *property;
    1.69  	struct razor_property_iterator *pi;
    1.70  	const char *name, *version;
    1.71 -	enum razor_property_type type;
    1.72 -	enum razor_version_relation relation;
    1.73 +	uint32_t flags;
    1.74  
    1.75  	if (ref_name == NULL)
    1.76  		return 0;
    1.77 @@ -221,14 +230,14 @@
    1.78  
    1.79  	pi = razor_property_iterator_create(set, NULL);
    1.80  	while (razor_property_iterator_next(pi, &property,
    1.81 -					    &name, &relation, &version,
    1.82 -					    &type)) {
    1.83 +					    &name, &flags, &version)) {
    1.84  		if (strcmp(ref_name, name) != 0)
    1.85  			continue;
    1.86 -		if (ref_version && relation == RAZOR_VERSION_EQUAL &&
    1.87 +		if (ref_version &&
    1.88 +		    (flags & RAZOR_PROPERTY_RELATION_MASK) == RAZOR_PROPERTY_EQUAL &&
    1.89  		    strcmp(ref_version, version) != 0)
    1.90  			continue;
    1.91 -		if (ref_type != type)
    1.92 +		if ((flags & RAZOR_PROPERTY_TYPE_MASK) != type)
    1.93  			continue;
    1.94  
    1.95  		list_packages_for_property(set, property);