Diffstat (limited to 'noncore/settings/aqpkg/version.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/version.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/noncore/settings/aqpkg/version.cpp b/noncore/settings/aqpkg/version.cpp index e836da1..59e6f3f 100644 --- a/noncore/settings/aqpkg/version.cpp +++ b/noncore/settings/aqpkg/version.cpp | |||
@@ -24,5 +24,7 @@ | |||
24 | #include <string.h> | 24 | #include <string.h> |
25 | 25 | ||
26 | # define _(Text) Text | 26 | #include <qobject.h> |
27 | |||
28 | //# define _(Text) Text | ||
27 | 29 | ||
28 | class versionrevision | 30 | class versionrevision |
@@ -45,12 +47,12 @@ public: | |||
45 | strcpy( version, str ); | 47 | strcpy( version, str ); |
46 | } | 48 | } |
47 | 49 | ||
48 | unsigned long epoch; | 50 | unsigned long epoch; |
49 | char *version; | 51 | char *version; |
50 | const char *revision; | 52 | const char *revision; |
51 | const char *familiar_revision; | 53 | const char *familiar_revision; |
52 | }; | 54 | }; |
53 | 55 | ||
54 | static int verrevcmp(const char *val, const char *ref) | 56 | static int verrevcmp(const char *val, const char *ref) |
55 | { | 57 | { |
56 | int vc, rc; | 58 | int vc, rc; |
@@ -83,5 +85,5 @@ static int verrevcmp(const char *val, const char *ref) | |||
83 | 85 | ||
84 | int versioncompare(const struct versionrevision *version, | 86 | int versioncompare(const struct versionrevision *version, |
85 | const struct versionrevision *refversion) | 87 | const struct versionrevision *refversion) |
86 | { | 88 | { |
87 | int r; | 89 | int r; |
@@ -96,5 +98,5 @@ int versioncompare(const struct versionrevision *version, | |||
96 | int versionsatisfied3(const struct versionrevision *it, | 98 | int versionsatisfied3(const struct versionrevision *it, |
97 | const struct versionrevision *ref, | 99 | const struct versionrevision *ref, |
98 | const char *op) | 100 | const char *op) |
99 | { | 101 | { |
100 | int r; | 102 | int r; |
@@ -110,21 +112,24 @@ int versionsatisfied3(const struct versionrevision *it, | |||
110 | if (strcmp(op, "=") == 0) | 112 | if (strcmp(op, "=") == 0) |
111 | return r == 0; | 113 | return r == 0; |
112 | fprintf(stderr, "unknown operator: %s", op); | 114 | // fprintf(stderr, "unknown operator: %s", op); |
113 | 115 | ||
114 | exit(1); | 116 | exit(1); |
115 | } | 117 | } |
116 | 118 | ||
117 | const char *parseversion(struct versionrevision *rversion, const char *string) | 119 | const char *parseversion(struct versionrevision *rversion, const char *string) |
118 | { | 120 | { |
119 | char *hyphen, *colon, *eepochcolon; | 121 | char *hyphen, *colon, *eepochcolon; |
120 | unsigned long epoch; | 122 | unsigned long epoch; |
121 | 123 | ||
122 | if (!*string) return _("version string is empty"); | 124 | if ( !*string ) |
123 | 125 | return QObject::tr( "Version string is empty." ); | |
126 | |||
124 | colon= strchr(string,':'); | 127 | colon= strchr(string,':'); |
125 | if (colon) { | 128 | if (colon) { |
126 | epoch= strtoul(string,&eepochcolon,10); | 129 | epoch= strtoul(string,&eepochcolon,10); |
127 | if (colon != eepochcolon) return _("epoch in version is not number"); | 130 | if ( colon != eepochcolon ) |
128 | if (!*++colon) return _("nothing after colon in version number"); | 131 | return QObject::tr( "Epoch in version is not number." ); |
132 | if ( !*++colon ) | ||
133 | return QObject::tr( "Nothing after colon in version number." ); | ||
129 | string= colon; | 134 | string= colon; |
130 | rversion->epoch= epoch; | 135 | rversion->epoch= epoch; |
@@ -157,5 +162,5 @@ const char *parseversion(struct versionrevision *rversion, const char *string) | |||
157 | rversion->revision, | 162 | rversion->revision, |
158 | rversion->familiar_revision); | 163 | rversion->familiar_revision); |
159 | */ | 164 | */ |
160 | return 0; | 165 | return 0; |
161 | } | 166 | } |
@@ -168,5 +173,5 @@ int compareVersions( const char *v1, const char *v2 ) | |||
168 | err = parseversion(&ref, v1); | 173 | err = parseversion(&ref, v1); |
169 | if (err) { | 174 | if (err) { |
170 | fprintf(stderr, "Invalid version `%s': %s\n", v2, err); | 175 | // fprintf(stderr, "Invalid version `%s': %s\n", v2, err); |
171 | return -2; | 176 | return -2; |
172 | } | 177 | } |
@@ -174,5 +179,5 @@ int compareVersions( const char *v1, const char *v2 ) | |||
174 | err = parseversion(&ver, v2); | 179 | err = parseversion(&ver, v2); |
175 | if (err) { | 180 | if (err) { |
176 | fprintf(stderr, "Invalid version `%s': %s\n", v1, err); | 181 | // fprintf(stderr, "Invalid version `%s': %s\n", v1, err); |
177 | return -2; | 182 | return -2; |
178 | } | 183 | } |
@@ -187,5 +192,5 @@ int compareVersions( const char *v1, const char *v2 ) | |||
187 | 192 | ||
188 | /* | 193 | /* |
189 | int main(int argc, char *argv[]) | 194 | int main(int argc, char *argv[]) |
190 | { | 195 | { |
191 | const char *err; | 196 | const char *err; |
@@ -202,5 +207,5 @@ int main(int argc, char *argv[]) | |||
202 | return 2; | 207 | return 2; |
203 | } | 208 | } |
204 | 209 | ||
205 | err = parseversion(&ref, argv[3]); | 210 | err = parseversion(&ref, argv[3]); |
206 | if (err) { | 211 | if (err) { |