mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-02 08:35:06 -04:00
src/util: Clean up headers and a few fixes
Remove some unnecessary headers in the two utilities as well as fix a possible non-null termination issue in vercmp. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a65ad4efc1
commit
f4dbb204f1
@ -2,7 +2,7 @@ bin_PROGRAMS = vercmp testpkg
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/lib/libalpm
|
||||
|
||||
AM_CFLAGS = -pedantic
|
||||
AM_CFLAGS = -pedantic -D_GNU_SOURCE
|
||||
|
||||
vercmp_SOURCES = vercmp.c
|
||||
vercmp_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la
|
||||
|
@ -21,11 +21,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <stdio.h> /* printf */
|
||||
#include <stdarg.h> /* va_list */
|
||||
#include <string.h> /* strlen */
|
||||
|
||||
#include <alpm.h>
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user