index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2010-10-11 20:20:06 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-10-11 20:29:22 -0500 |
commit | 0ff2a9149711b9179d288f579c792890cd81d79b (patch) | |
tree | e6828df064a844ecf44992f8773f3a4c69369d73 /src/util/vercmp.c | |
parent | 05f0a28932c1acab7a9ddb58435d69626dad54da (diff) |
-rw-r--r-- | src/util/vercmp.c | 23 |
diff --git a/src/util/vercmp.c b/src/util/vercmp.c index 959dc137..8a785bb8 100644 --- a/src/util/vercmp.c +++ b/src/util/vercmp.c @@ -18,20 +18,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <stdio.h> /* printf */ #include <string.h> /* strncpy */ #define BASENAME "vercmp" -#define MAX_LEN 255 - /* forward declaration, comes from vercmp.o in libalpm source that is linked in * directly so we don't have any library deps */ int alpm_pkg_vercmp(const char *a, const char *b); -static void usage() +static void usage(void) { fprintf(stderr, "usage: %s <ver1> <ver2>\n\n", BASENAME); fprintf(stderr, "return values:\n"); @@ -42,8 +38,8 @@ static void usage() int main(int argc, char *argv[]) { - char s1[MAX_LEN] = ""; - char s2[MAX_LEN] = ""; + const char *s1 = ""; + const char *s2 = ""; int ret; if(argc == 1) { @@ -56,16 +52,11 @@ int main(int argc, char *argv[]) usage(); return(0); } - if(argc > 1) { - strncpy(s1, argv[1], MAX_LEN); - s1[MAX_LEN -1] = '\0'; - } if(argc > 2) { - strncpy(s2, argv[2], MAX_LEN); - s2[MAX_LEN -1] = '\0'; - } else { - printf("0\n"); - return(0); + s2 = argv[2]; + } + if(argc > 1) { + s1 = argv[1]; } ret = alpm_pkg_vercmp(s1, s2); |