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
This commit is contained in:
parent
2cd24b447e
commit
01ea2a8822
@ -57,6 +57,13 @@
|
||||
/* Usually "rm", but often "echo" during debugging! */
|
||||
#define RMDIR_CMD "/bin/rmdir"
|
||||
|
||||
/* Where the ports lives by default */
|
||||
#define DEF_PORTS_DIR "/usr/ports"
|
||||
/* just in case we change the environment variable name */
|
||||
#define PORTSDIR "PORTSDIR"
|
||||
/* macro to get name of directory where the ports lives */
|
||||
#define PORTS_DIR (getenv(PORTSDIR) ? getenv(PORTSDIR) : 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 */
|
||||
|
@ -8,4 +8,7 @@ CFLAGS+= -I${.CURDIR}/../lib
|
||||
WARNS?= 6
|
||||
WFORMAT?= 1
|
||||
|
||||
DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
|
||||
LDADD= ${LIBINSTALL} -lfetch -lmd
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -23,13 +23,6 @@
|
||||
#ifndef _INST_VERSION_H_INCLUDE
|
||||
#define _INST_VERSION_H_INCLUDE
|
||||
|
||||
/* Where the ports lives by default */
|
||||
#define DEF_PORTS_DIR "/usr/ports"
|
||||
/* just in case we change the environment variable name */
|
||||
#define PORTSDIR "PORTSDIR"
|
||||
/* macro to get name of directory where we put logging information */
|
||||
#define PORTS_DIR (getenv(PORTSDIR) ? getenv(PORTSDIR) : DEF_PORTS_DIR)
|
||||
|
||||
struct index_entry {
|
||||
SLIST_ENTRY(index_entry) next;
|
||||
char *name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user