diff options
author | Remi Collet <remi@remirepo.net> | 2018-01-26 08:39:51 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2018-01-26 08:39:51 +0100 |
commit | 38f121fe9ce6448a04ade52ad5cb35844c60b820 (patch) | |
tree | 472d7c7246832769a24f5bf5b9a0f341832cb191 /examples/rpmvercmp.php | |
parent | 0abcde252d1d955d9aa633b4032e9275ace132a5 (diff) |
add rpmvercmp example
Diffstat (limited to 'examples/rpmvercmp.php')
-rw-r--r-- | examples/rpmvercmp.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/rpmvercmp.php b/examples/rpmvercmp.php new file mode 100644 index 0000000..de2acae --- /dev/null +++ b/examples/rpmvercmp.php @@ -0,0 +1,14 @@ +#!/usr/bin/php +<?php + +extension_loaded("rpminfo") or die("rpminfo extension missing"); + +if ($_SERVER['argc'] < 3) { + die("usage rpmvercmp evr1 evr2 [ evr3 ... ]\n"); +} + +$vers = $_SERVER['argv']; +unset($vers[0]); +usort($vers, 'rpmvercmp'); +echo implode(' < ', $vers) . "\n"; + |