]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/pkg_install/lib/version.c
This commit was generated by cvs2svn to compensate for changes in r90792,
[FreeBSD/FreeBSD.git] / usr.sbin / pkg_install / lib / version.c
1 #ifndef lint
2 static const char rcsid[] =
3   "$FreeBSD$";
4 #endif
5
6 /*
7  * FreeBSD install - a package for the installation and maintainance
8  * of non-core utilities.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * Maxim Sobolev
20  * 31 July 2001
21  *
22  * Routines to assist with PLIST_FMT_VER numbers in the packing
23  * lists.
24  *
25  * Following is the PLIST_FMT_VER history:
26  * 1.0 - Initial revision;
27  * 1.1 - When recording/checking checksum of symlink use hash of readlink()
28  *       value insted of the hash of an object this links points to.
29  *
30  */
31
32 #include "lib.h"
33 #include <err.h>
34
35 int
36 verscmp(Package *pkg, int major, int minor)
37 {
38     int rval = 0;
39
40     if ((pkg->fmtver_maj < major) || (pkg->fmtver_maj == major &&
41         pkg->fmtver_mnr < minor))
42         rval = -1;
43     else if ((pkg->fmtver_maj > major) || (pkg->fmtver_maj == major &&
44              pkg->fmtver_mnr > minor))
45         rval = 1;
46
47     return rval;
48 }