1993-08-26 01:19:55 +00:00
|
|
|
#ifndef lint
|
1995-07-30 01:08:34 +00:00
|
|
|
static const char *rcsid = "$Id: show.c,v 1.6 1995/05/30 03:50:02 rgrimes 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
|
|
|
|
* 23 Aug 1993
|
|
|
|
*
|
|
|
|
* Various display routines for the info module.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "lib.h"
|
|
|
|
#include "info.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
show_file(char *title, char *fname)
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
char line[1024];
|
|
|
|
int n;
|
|
|
|
|
1993-09-08 01:46:59 +00:00
|
|
|
if (!Quiet)
|
|
|
|
printf("%s%s", InfoPrefix, title);
|
1993-08-26 01:19:55 +00:00
|
|
|
fp = fopen(fname, "r");
|
1995-07-30 01:08:34 +00:00
|
|
|
if (!fp)
|
|
|
|
printf("ERROR: show_file: Can't open '%s' for reading!\n", fname);
|
|
|
|
else {
|
|
|
|
while (n = fread(line, 1, 1024, fp))
|
|
|
|
fwrite(line, 1, n, stdout);
|
|
|
|
fclose(fp);
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
|
|
|
printf("\n"); /* just in case */
|
|
|
|
}
|
|
|
|
|
1995-01-05 01:10:13 +00:00
|
|
|
void
|
|
|
|
show_index(char *title, char *fname)
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
char line[MAXINDEXSIZE+2];
|
|
|
|
int i,n;
|
1995-05-30 03:57:47 +00:00
|
|
|
|
1995-01-05 01:10:13 +00:00
|
|
|
if (!Quiet)
|
|
|
|
printf("%s%s", InfoPrefix, title);
|
|
|
|
fp = fopen(fname, "r");
|
|
|
|
if (!fp) {
|
|
|
|
whinge("show_file: Can't open '%s' for reading.", fname);
|
|
|
|
return;
|
1995-05-30 03:57:47 +00:00
|
|
|
}
|
1995-01-05 01:10:13 +00:00
|
|
|
if(fgets(line, MAXINDEXSIZE+1, fp)) {
|
|
|
|
if(line[MAXINDEXSIZE-1] != '\n')
|
|
|
|
line[MAXINDEXSIZE] = '\n';
|
|
|
|
line[MAXINDEXSIZE+1] = 0;
|
|
|
|
fputs(line, stdout);
|
|
|
|
}
|
|
|
|
fclose(fp);
|
1995-05-30 03:57:47 +00:00
|
|
|
}
|
1995-01-05 01:10:13 +00:00
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
/* Show a packing list item type. If type is -1, show all */
|
|
|
|
void
|
|
|
|
show_plist(char *title, Package *plist, plist_t type)
|
|
|
|
{
|
|
|
|
PackingList p;
|
|
|
|
Boolean ign = FALSE;
|
|
|
|
|
1993-09-08 01:46:59 +00:00
|
|
|
if (!Quiet)
|
|
|
|
printf("%s%s", InfoPrefix, title);
|
1993-08-26 01:19:55 +00:00
|
|
|
p = plist->head;
|
|
|
|
while (p) {
|
|
|
|
if (p->type != type && type != -1) {
|
|
|
|
p = p->next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
switch(p->type) {
|
|
|
|
case PLIST_FILE:
|
|
|
|
if (ign) {
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "%s\n" : "File: %s (ignored)\n", p->name);
|
1993-08-26 01:19:55 +00:00
|
|
|
ign = FALSE;
|
|
|
|
}
|
|
|
|
else
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "%s\n" : "File: %s\n", p->name);
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
1995-05-30 03:57:47 +00:00
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case PLIST_CWD:
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "@cwd %s\n" : "\tCWD to %s\n", p->name);
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
case PLIST_SRC:
|
|
|
|
printf(Quiet ? "@srcdir %s\n" : "\tSRCDIR to %s\n", p->name);
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case PLIST_CMD:
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "@exec %s\n" : "\tEXEC '%s'\n", p->name);
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_CHMOD:
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "@chmod %s\n" : "\tCHMOD to %s\n",
|
|
|
|
p->name ? p->name : "(clear default)");
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_CHOWN:
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "@chown %s\n" : "\tCHOWN to %s\n",
|
|
|
|
p->name ? p->name : "(clear default)");
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_CHGRP:
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "@chgrp %s\n" : "\tCHGRP to %s\n",
|
|
|
|
p->name ? p->name : "(clear default)");
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_COMMENT:
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "@comment %s\n" : "\tComment: %s\n", p->name);
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_IGNORE:
|
|
|
|
ign = TRUE;
|
|
|
|
break;
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
case PLIST_IGNORE_INST:
|
|
|
|
printf(Quiet ? "@ignore_inst ??? doesn't belong here.\n" :
|
|
|
|
"\tIgnore next file installation directive (doesn't belong)\n");
|
|
|
|
ign = TRUE;
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case PLIST_NAME:
|
1993-09-08 01:46:59 +00:00
|
|
|
printf(Quiet ? "@name %s\n" : "\tPackage name: %s\n", p->name);
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
case PLIST_DISPLAY:
|
|
|
|
printf(Quiet ? "@display %s\n" : "\tInstall message file: %s\n", p->name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_PKGDEP:
|
|
|
|
printf(Quiet ? "@pkgdep %s\n" : "\tPackage depends on: %s\n", p->name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_MTREE:
|
|
|
|
printf(Quiet ? "@mtree %s\n" : "\tPackage mtree file: %s\n", p->name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_DIR_RM:
|
|
|
|
printf(Quiet ? "@dirrm %s\n" : "\tDeinstall directory remove: %s\n", p->name);
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
default:
|
|
|
|
barf("Unknown command type %d (%s)\n", p->type, p->name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
p = p->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1993-09-08 01:46:59 +00:00
|
|
|
/* Show all files in the packing list (except ignored ones) */
|
|
|
|
void
|
|
|
|
show_files(char *title, Package *plist)
|
|
|
|
{
|
|
|
|
PackingList p;
|
|
|
|
Boolean ign = FALSE;
|
|
|
|
char *dir = ".";
|
|
|
|
|
|
|
|
if (!Quiet)
|
|
|
|
printf("%s%s", InfoPrefix, title);
|
|
|
|
p = plist->head;
|
|
|
|
while (p) {
|
|
|
|
switch(p->type) {
|
|
|
|
case PLIST_FILE:
|
|
|
|
if (!ign)
|
|
|
|
printf("%s/%s\n", dir, p->name);
|
|
|
|
ign = FALSE;
|
|
|
|
break;
|
1995-05-30 03:57:47 +00:00
|
|
|
|
1993-09-08 01:46:59 +00:00
|
|
|
case PLIST_CWD:
|
|
|
|
dir = p->name;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLIST_IGNORE:
|
|
|
|
ign = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
p = p->next;
|
|
|
|
}
|
|
|
|
}
|