diff options
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"; + |