index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2007-08-15 20:16:46 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-08-15 20:16:46 -0400 |
commit | f4dbb204f1ad99179c145558ababf1190f067083 (patch) | |
tree | 6a9679bce55e272a00750d3f7d2a2a802e51924e /src/util/vercmp.c | |
parent | a65ad4efc1102449a087b464d3b8d4670a614b99 (diff) |
-rw-r--r-- | src/util/vercmp.c | 23 |
diff --git a/src/util/vercmp.c b/src/util/vercmp.c index cc951988..873ef1c9 100644 --- a/src/util/vercmp.c +++ b/src/util/vercmp.c @@ -21,29 +21,26 @@ #include "config.h" -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <unistd.h> -#include <limits.h> -/* TODO this is probably not the best way to do this */ -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif +#include <stdio.h> /* printf */ +#include <string.h> /* strncpy */ #include <alpm.h> +#define MAX_LEN 255 + int main(int argc, char *argv[]) { - char s1[255] = ""; - char s2[255] = ""; + char s1[MAX_LEN] = ""; + char s2[MAX_LEN] = ""; int ret; if(argc > 1) { - strncpy(s1, argv[1], 255); + strncpy(s1, argv[1], MAX_LEN); + s1[MAX_LEN -1] = '\0'; } if(argc > 2) { - strncpy(s2, argv[2], 255); + strncpy(s2, argv[2], MAX_LEN); + s2[MAX_LEN -1] = '\0'; } else { printf("0\n"); return(0); |