1993-08-26 01:19:55 +00:00
|
|
|
#ifndef lint
|
1997-10-08 07:48:21 +00:00
|
|
|
static const char rcsid[] =
|
1997-12-26 05:29:29 +00:00
|
|
|
"$Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp $";
|
1993-08-26 01:19:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* FreeBSD install - a package for the installation and maintainance
|
|
|
|
* of non-core utilities.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* Jordan K. Hubbard
|
|
|
|
* 18 July 1993
|
|
|
|
*
|
1997-12-26 05:29:29 +00:00
|
|
|
* This is the info module.
|
1993-08-26 01:19:55 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1997-10-08 07:48:21 +00:00
|
|
|
#include <err.h>
|
1993-08-26 01:19:55 +00:00
|
|
|
#include "lib.h"
|
|
|
|
#include "info.h"
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
static char Options[] = "acdDe:fikrRpLqImvhl:";
|
1993-08-26 01:19:55 +00:00
|
|
|
|
|
|
|
int Flags = 0;
|
|
|
|
Boolean AllInstalled = FALSE;
|
1993-09-08 01:46:59 +00:00
|
|
|
Boolean Quiet = FALSE;
|
1993-09-03 23:01:17 +00:00
|
|
|
char *InfoPrefix = "";
|
1995-10-25 15:38:37 +00:00
|
|
|
char PlayPen[FILENAME_MAX];
|
1993-09-05 22:36:54 +00:00
|
|
|
char *CheckPkg = NULL;
|
1993-08-26 01:19:55 +00:00
|
|
|
|
1997-10-08 07:48:21 +00:00
|
|
|
static void usage __P((void));
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
char **pkgs, **start;
|
|
|
|
|
|
|
|
pkgs = start = argv;
|
1997-03-31 05:11:47 +00:00
|
|
|
while ((ch = getopt(argc, argv, Options)) != -1)
|
1993-08-26 01:19:55 +00:00
|
|
|
switch(ch) {
|
|
|
|
case 'a':
|
|
|
|
AllInstalled = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'v':
|
|
|
|
Verbose = TRUE;
|
|
|
|
/* Reasonable definition of 'everything' */
|
|
|
|
Flags = SHOW_COMMENT | SHOW_DESC | SHOW_PLIST | SHOW_INSTALL |
|
1994-12-06 00:51:50 +00:00
|
|
|
SHOW_DEINSTALL | SHOW_REQUIRE | SHOW_DISPLAY | SHOW_MTREE;
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'I':
|
|
|
|
Flags |= SHOW_INDEX;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'p':
|
|
|
|
Flags |= SHOW_PREFIX;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'c':
|
|
|
|
Flags |= SHOW_COMMENT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
Flags |= SHOW_DESC;
|
|
|
|
break;
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
case 'D':
|
|
|
|
Flags |= SHOW_DISPLAY;
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case 'f':
|
|
|
|
Flags |= SHOW_PLIST;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'i':
|
|
|
|
Flags |= SHOW_INSTALL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'k':
|
|
|
|
Flags |= SHOW_DEINSTALL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'r':
|
|
|
|
Flags |= SHOW_REQUIRE;
|
|
|
|
break;
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
case 'R':
|
|
|
|
Flags |= SHOW_REQBY;
|
|
|
|
break;
|
|
|
|
|
1993-09-08 01:46:59 +00:00
|
|
|
case 'L':
|
|
|
|
Flags |= SHOW_FILES;
|
|
|
|
break;
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
case 'm':
|
|
|
|
Flags |= SHOW_MTREE;
|
|
|
|
break;
|
|
|
|
|
1993-09-03 23:01:17 +00:00
|
|
|
case 'l':
|
|
|
|
InfoPrefix = optarg;
|
|
|
|
break;
|
|
|
|
|
1993-09-08 01:46:59 +00:00
|
|
|
case 'q':
|
|
|
|
Quiet = TRUE;
|
|
|
|
break;
|
|
|
|
|
1993-09-05 04:54:24 +00:00
|
|
|
case 't':
|
1995-10-25 15:38:37 +00:00
|
|
|
strcpy(PlayPen, optarg);
|
1993-09-05 04:54:24 +00:00
|
|
|
break;
|
|
|
|
|
1993-09-05 22:36:54 +00:00
|
|
|
case 'e':
|
|
|
|
CheckPkg = optarg;
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case 'h':
|
|
|
|
case '?':
|
|
|
|
default:
|
1997-10-08 07:48:21 +00:00
|
|
|
usage();
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1995-05-30 03:57:47 +00:00
|
|
|
argc -= optind;
|
1993-08-26 01:19:55 +00:00
|
|
|
argv += optind;
|
|
|
|
|
|
|
|
/* Set some reasonable defaults */
|
|
|
|
if (!Flags)
|
1994-12-06 00:51:50 +00:00
|
|
|
Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY;
|
1993-08-26 01:19:55 +00:00
|
|
|
|
|
|
|
/* Get all the remaining package names, if any */
|
|
|
|
while (*argv)
|
|
|
|
*pkgs++ = *argv++;
|
|
|
|
|
|
|
|
/* If no packages, yelp */
|
1993-09-05 22:36:54 +00:00
|
|
|
if (pkgs == start && !AllInstalled && !CheckPkg)
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("missing package name(s)"), usage();
|
1993-08-26 01:19:55 +00:00
|
|
|
*pkgs = NULL;
|
|
|
|
return pkg_perform(start);
|
|
|
|
}
|
|
|
|
|
1997-10-08 07:48:21 +00:00
|
|
|
static void
|
|
|
|
usage()
|
1993-08-26 01:19:55 +00:00
|
|
|
{
|
1997-10-08 07:48:21 +00:00
|
|
|
fprintf(stderr, "%s\n%s\n%s\n",
|
|
|
|
"usage: pkg_info [-cdDikrRpLqImv] [-e package] [-l prefix]",
|
|
|
|
" pkg-name [pkg-name ...]",
|
|
|
|
" pkg_info -a [flags]");
|
1993-08-26 01:19:55 +00:00
|
|
|
exit(1);
|
|
|
|
}
|