mirror of
https://github.com/moparisthebest/pacman
synced 2025-03-03 18:59:55 -05:00
vercmp: always return 0 if we perform a compare
And change the wording slightly to indicate we *print* a value, not *return* it. You can't return negative values (they get coerced to 255), so it isn't worth it to try and cram the result into the return code. Acked-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
26652768d6
commit
04dc87e012
@ -18,6 +18,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h> /* printf */
|
#include <stdio.h> /* printf */
|
||||||
#include <string.h> /* strncpy */
|
#include <string.h> /* strncpy */
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ int alpm_pkg_vercmp(const char *a, const char *b);
|
|||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s <ver1> <ver2>\n\n", BASENAME);
|
fprintf(stderr, "usage: %s <ver1> <ver2>\n\n", BASENAME);
|
||||||
fprintf(stderr, "return values:\n");
|
fprintf(stderr, "output values:\n");
|
||||||
fprintf(stderr, " < 0 : if ver1 < ver2\n");
|
fprintf(stderr, " < 0 : if ver1 < ver2\n");
|
||||||
fprintf(stderr, " 0 : if ver1 == ver2\n");
|
fprintf(stderr, " 0 : if ver1 == ver2\n");
|
||||||
fprintf(stderr, " > 0 : if ver1 > ver2\n");
|
fprintf(stderr, " > 0 : if ver1 > ver2\n");
|
||||||
@ -61,5 +62,5 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ret = alpm_pkg_vercmp(s1, s2);
|
ret = alpm_pkg_vercmp(s1, s2);
|
||||||
printf("%d\n", ret);
|
printf("%d\n", ret);
|
||||||
return(ret);
|
return(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user