View | Details | Raw Unified | Return to bug 173589
Collapse All | Expand All

(-)main.c (-2 / +47 lines)
Lines 38-43 Boolean Remote = FALSE; Link Here
38
Boolean KeepPackage	= FALSE;
38
Boolean KeepPackage	= FALSE;
39
Boolean FailOnAlreadyInstalled	= TRUE;
39
Boolean FailOnAlreadyInstalled	= TRUE;
40
Boolean IgnoreDeps	= FALSE;
40
Boolean IgnoreDeps	= FALSE;
41
Boolean PrintDirectory	= FALSE;
41
42
42
char	*Mode		= NULL;
43
char	*Mode		= NULL;
43
char	*Owner		= NULL;
44
char	*Owner		= NULL;
Lines 104-116 struct { Link Here
104
};
105
};
105
106
106
static char *getpackagesite(void);
107
static char *getpackagesite(void);
108
static char *getpackagedirectory(void);
107
int getosreldate(void);
109
int getosreldate(void);
108
110
109
static void usage(void);
111
static void usage(void);
110
112
111
static char opts[] = "hviIRfFnrp:P:SMt:C:K";
113
static char opts[] = "hviIRdfFnrp:P:SMt:C:K";
112
static struct option longopts[] = {
114
static struct option longopts[] = {
113
	{ "chroot",	required_argument,	NULL,		'C' },
115
	{ "chroot",	required_argument,	NULL,		'C' },
116
	{ "directory",  no_argument,		NULL,		'd' },
114
	{ "dry-run",	no_argument,		NULL,		'n' },
117
	{ "dry-run",	no_argument,		NULL,		'n' },
115
	{ "force",	no_argument,		NULL,		'f' },
118
	{ "force",	no_argument,		NULL,		'f' },
116
	{ "help",	no_argument,		NULL,		'h' },
119
	{ "help",	no_argument,		NULL,		'h' },
Lines 207-212 main(int argc, char **argv) Link Here
207
	    IgnoreDeps = TRUE;
210
	    IgnoreDeps = TRUE;
208
	    break;
211
	    break;
209
212
213
	case 'd':
214
	    PrintDirectory = TRUE;
215
	    break;
216
210
	case 'h':
217
	case 'h':
211
	default:
218
	default:
212
	    usage();
219
	    usage();
Lines 216-221 main(int argc, char **argv) Link Here
216
    argc -= optind;
223
    argc -= optind;
217
    argv += optind;
224
    argv += optind;
218
225
226
    if ( PrintDirectory ) {
227
	char * pdir = getpackagedirectory();
228
	if (pdir) {
229
	  fprintf(stdout,"%s",pdir);	
230
	  exit (0);
231
	} else {
232
	  exit (1);
233
	}
234
    }
235
219
    if (AddMode != SLAVE) {
236
    if (AddMode != SLAVE) {
220
	pkgs = (char **)malloc((argc+1) * sizeof(char *));
237
	pkgs = (char **)malloc((argc+1) * sizeof(char *));
221
	for (ch = 0; ch <= argc; pkgs[ch++] = NULL) ;
238
	for (ch = 0; ch <= argc; pkgs[ch++] = NULL) ;
Lines 364-374 getpackagesite(void) Link Here
364
381
365
}
382
}
366
383
384
static char *
385
getpackagedirectory(void)
386
{
387
    int reldate, i;
388
    static char sitepath[MAXPATHLEN];
389
    int archmib[] = { CTL_HW, HW_MACHINE_ARCH };
390
    char arch[64];
391
    size_t archlen = sizeof(arch);
392
393
    if (sysctl(archmib, 2, arch, &archlen, NULL, 0) == -1)
394
	return NULL;
395
    arch[archlen-1] = 0;
396
    if (strlcat(sitepath, arch, sizeof(sitepath)) >= sizeof(sitepath))
397
	return NULL;
398
399
    reldate = getosreldate();
400
    for(i = 0; releases[i].directory != NULL; i++) {
401
	if (reldate >= releases[i].lowver && reldate <= releases[i].hiver) {
402
	    if (strlcat(sitepath, releases[i].directory, sizeof(sitepath))
403
		>= sizeof(sitepath))
404
		return NULL;
405
	    break;
406
	}
407
    }
408
    return sitepath;
409
410
}
411
367
static void
412
static void
368
usage(void)
413
usage(void)
369
{
414
{
370
    fprintf(stderr, "%s\n%s\n",
415
    fprintf(stderr, "%s\n%s\n",
371
	"usage: pkg_add [-viInfFrRMSK] [-t template] [-p prefix] [-P prefix] [-C chrootdir]",
416
	"usage: pkg_add [-viInfdFrRMSK] [-t template] [-p prefix] [-P prefix] [-C chrootdir]",
372
	"               pkg-name [pkg-name ...]");
417
	"               pkg-name [pkg-name ...]");
373
    exit(1);
418
    exit(1);
374
}
419
}
(-)pkg_add.1 (+2 lines)
Lines 87-92 Turn on verbose output. Link Here
87
Keep any downloaded package in
87
Keep any downloaded package in
88
.Ev PKGDIR
88
.Ev PKGDIR
89
if it is defined or in current directory by default.
89
if it is defined or in current directory by default.
90
.It Fl d , -directory
91
Output ARCH/PACKAGES subdirectory and immediately exit.
90
.It Fl i , -no-deps
92
.It Fl i , -no-deps
91
Install the package without fetching and installing
93
Install the package without fetching and installing
92
dependencies.
94
dependencies.

Return to bug 173589