diff options
author | krion <krion@FreeBSD.org> | 2007-11-10 10:21:29 +0000 |
---|---|---|
committer | krion <krion@FreeBSD.org> | 2007-11-10 10:21:29 +0000 |
commit | 4a3708c0c32da7c70de4a7ece2f3e37951bf40cf (patch) | |
tree | 8cef66b06544157ad48f99b95a0d55a2ed2f3927 /usr.sbin/pkg_install/updating | |
parent | 2f2d57f5929b63ec4a6f50fe8e25891bda1f37b0 (diff) | |
download | FreeBSD-src-4a3708c0c32da7c70de4a7ece2f3e37951bf40cf.zip FreeBSD-src-4a3708c0c32da7c70de4a7ece2f3e37951bf40cf.tar.gz |
Some code cleanups, including removing of stale getopt argument and
hardcoded +CONTENTS defines.
PR: bin/117855
Submitted by: Beat Gaetzi <beat@chruetertee.ch>
MFC after: 14 days
Diffstat (limited to 'usr.sbin/pkg_install/updating')
-rw-r--r-- | usr.sbin/pkg_install/updating/Makefile | 3 | ||||
-rw-r--r-- | usr.sbin/pkg_install/updating/main.c | 22 | ||||
-rw-r--r-- | usr.sbin/pkg_install/updating/pathnames.h | 19 |
3 files changed, 19 insertions, 25 deletions
diff --git a/usr.sbin/pkg_install/updating/Makefile b/usr.sbin/pkg_install/updating/Makefile index 980747e..cf8bfc8 100644 --- a/usr.sbin/pkg_install/updating/Makefile +++ b/usr.sbin/pkg_install/updating/Makefile @@ -8,4 +8,7 @@ CFLAGS+= -I${.CURDIR}/../lib WARNS?= 6 WFORMAT?= 1 +DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} +LDADD= ${LIBINSTALL} -lfetch -lmd + .include <bsd.prog.mk> diff --git a/usr.sbin/pkg_install/updating/main.c b/usr.sbin/pkg_install/updating/main.c index 84d089e..cb594de 100644 --- a/usr.sbin/pkg_install/updating/main.c +++ b/usr.sbin/pkg_install/updating/main.c @@ -10,18 +10,11 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/stat.h> -#include <sys/param.h> /* For MAXPATHLEN */ - -#include <dirent.h> #include <errno.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include <sysexits.h> -#include <unistd.h> +#include "lib.h" #include "pathnames.h" typedef struct installedport { @@ -81,7 +74,7 @@ main(int argc, char *argv[]) DIR *dir; FILE *fd; - while ((ch = getopt(argc, argv, "f:p:d:")) != -1) { + while ((ch = getopt(argc, argv, "f:d:")) != -1) { switch (ch) { case 'd': dflag = 1; @@ -146,7 +139,9 @@ main(int argc, char *argv[]) } if(attribute.st_mode & S_IFREG) continue; - (void)strlcat(tmp_file + n, "/+CONTENTS", + (void)strlcat(tmp_file + n, "/", + sizeof(tmp_file) - n); + (void)strlcat(tmp_file + n, CONTENTS_FNAME, sizeof(tmp_file) - n); /* Open +CONTENT file */ @@ -255,3 +250,10 @@ usage(void) "usage: pkg_updating [-d YYYYMMDD] [-f file] [portname ...]\n"); exit(EX_USAGE); } + +void +cleanup(int sig) +{ + if (sig) + exit(1); +} diff --git a/usr.sbin/pkg_install/updating/pathnames.h b/usr.sbin/pkg_install/updating/pathnames.h index d5ec1a0..7eed1b4 100644 --- a/usr.sbin/pkg_install/updating/pathnames.h +++ b/usr.sbin/pkg_install/updating/pathnames.h @@ -10,19 +10,8 @@ * */ -/* Copy from ../version/version.h */ - -/* Where the ports lives by default */ -#define DEF_PORTS_DIR "/usr/ports/UPDATING" -/* just in case we change the environment variable name */ -#define PORTSDIR "PORTSDIR" -/* macro to get name of directory where we put logging information */ +/* Where the updating file lives by default */ +#define DEF_UPDATING "/usr/ports/UPDATING" +/* macro to define location of the UPDATING file */ #define UPDATING (getenv(PORTSDIR) ? strcat(getenv(PORTSDIR), \ - "/UPDATING") : DEF_PORTS_DIR) - -/* Where we put logging information by default, else ${PKG_DBDIR} if set */ -#define DEF_LOG_DIR "/var/db/pkg" -/* just in case we change the environment variable name */ -#define PKG_DBDIR "PKG_DBDIR" -/* macro to get name of directory where we put logging information */ -#define LOG_DIR (getenv(PKG_DBDIR) ? getenv(PKG_DBDIR) : DEF_LOG_DIR) + "/UPDATING") : DEF_UPDATING) |