author | drw <drw> | 2003-06-11 02:04:00 (UTC) |
---|---|---|
committer | drw <drw> | 2003-06-11 02:04:00 (UTC) |
commit | d47a08d2f8944deb1ee0945075c3443de82442ea (patch) (side-by-side diff) | |
tree | 807387a6bf5cfd9b445f14e6560118cc652e1868 /noncore/settings/aqpkg/version.cpp | |
parent | 57d61689f8212e317d8f578dc29cb63f572caf81 (diff) | |
download | opie-d47a08d2f8944deb1ee0945075c3443de82442ea.zip opie-d47a08d2f8944deb1ee0945075c3443de82442ea.tar.gz opie-d47a08d2f8944deb1ee0945075c3443de82442ea.tar.bz2 |
Some missing/fixed tr()s for HEAD
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 @@ -20,13 +20,15 @@ */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> -# define _(Text) Text +#include <qobject.h> + +//# define _(Text) Text class versionrevision { public: versionrevision() { @@ -41,20 +43,20 @@ public: void setVersion( const char *str ) { version = new char[(strlen(str)+1)]; strcpy( version, str ); } - + unsigned long epoch; char *version; const char *revision; const char *familiar_revision; -}; +}; -static int verrevcmp(const char *val, const char *ref) +static int verrevcmp(const char *val, const char *ref) { int vc, rc; long vl, rl; const char *vp, *rp; if (!val) val= ""; @@ -79,26 +81,26 @@ static int verrevcmp(const char *val, const char *ref) if (!*val) return -1; if (!*ref) return +1; } } int versioncompare(const struct versionrevision *version, - const struct versionrevision *refversion) + const struct versionrevision *refversion) { int r; if (version->epoch > refversion->epoch) return 1; if (version->epoch < refversion->epoch) return -1; r= verrevcmp(version->version,refversion->version); if (r) return r; r= verrevcmp(version->revision,refversion->revision); if (r) return r; return verrevcmp(version->familiar_revision,refversion->familiar_revision); } int versionsatisfied3(const struct versionrevision *it, const struct versionrevision *ref, - const char *op) + const char *op) { int r; r= versioncompare(it,ref); if (strcmp(op, "<=") == 0 || strcmp(op, "<") == 0) return r <= 0; if (strcmp(op, ">=") == 0 || strcmp(op, ">") == 0) @@ -106,29 +108,32 @@ int versionsatisfied3(const struct versionrevision *it, if (strcmp(op, "<<") == 0) return r < 0; if (strcmp(op, ">>") == 0) return r > 0; if (strcmp(op, "=") == 0) return r == 0; - fprintf(stderr, "unknown operator: %s", op); +// fprintf(stderr, "unknown operator: %s", op); exit(1); } -const char *parseversion(struct versionrevision *rversion, const char *string) +const char *parseversion(struct versionrevision *rversion, const char *string) { char *hyphen, *colon, *eepochcolon; unsigned long epoch; - if (!*string) return _("version string is empty"); - + if ( !*string ) + return QObject::tr( "Version string is empty." ); + colon= strchr(string,':'); if (colon) { epoch= strtoul(string,&eepochcolon,10); - if (colon != eepochcolon) return _("epoch in version is not number"); - if (!*++colon) return _("nothing after colon in version number"); + if ( colon != eepochcolon ) + return QObject::tr( "Epoch in version is not number." ); + if ( !*++colon ) + return QObject::tr( "Nothing after colon in version number." ); string= colon; rversion->epoch= epoch; } else { rversion->epoch= 0; } @@ -153,43 +158,43 @@ const char *parseversion(struct versionrevision *rversion, const char *string) /* fprintf(stderr,"Parsed version: %lu, %s, %s, %s\n", rversion->epoch, rversion->version, rversion->revision, rversion->familiar_revision); -*/ +*/ return 0; } int compareVersions( const char *v1, const char *v2 ) { const char *err; versionrevision ver, ref; err = parseversion(&ref, v1); if (err) { - fprintf(stderr, "Invalid version `%s': %s\n", v2, err); +// fprintf(stderr, "Invalid version `%s': %s\n", v2, err); return -2; } err = parseversion(&ver, v2); if (err) { - fprintf(stderr, "Invalid version `%s': %s\n", v1, err); +// fprintf(stderr, "Invalid version `%s': %s\n", v1, err); return -2; } if ( versionsatisfied3( &ver, &ref, "=" ) ) return 0; else if ( versionsatisfied3( &ver, &ref, "<" ) ) return -1; else return 1; } /* -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { const char *err; versionrevision ver, ref; if (argc < 4) { fprintf(stderr, "usage: %s: version op refversion\n", argv[0]); @@ -198,13 +203,13 @@ int main(int argc, char *argv[]) err = parseversion(&ver, argv[1]); if (err) { fprintf(stderr, "Invalid version `%s': %s\n", argv[1], err); return 2; } - + err = parseversion(&ref, argv[3]); if (err) { fprintf(stderr, "Invalid version `%s': %s\n", argv[3], err); return 2; } |