Minor bug fixes for descu. See PR#66, PR#94, PR#95, and the README

file with the describe source.
This commit is contained in:
gdr-ftp 1999-04-05 19:47:20 +00:00
parent c1c6594ed0
commit 07e0f96d2a
12 changed files with 70 additions and 38 deletions

View File

@ -1,7 +1,7 @@
$Id: README,v 1.8 1998/02/07 06:39:53 gdr-ftp Exp $
$Id: README,v 1.9 1999/04/05 19:47:19 gdr-ftp Exp $
This is the README file for the describe package. This package is
designated as version 1.0.6, and consists of the following utilities:
designated as version 1.0.7, and consists of the following utilities:
describe - show database entries describing the current
status of programs
@ -131,6 +131,17 @@ CHANGES
This details changes to the entire distribution.
v1.0.7 April 1999
Make sure that if descu's rejects file already exists, that it
is a regular file. This prevents us from overwriting it.
If the rejects file is empty at the end of the run, then delete it.
Don't emit unchanged entries into the rejects file. Changes are
based on a whitespace-insensitive and case-insensitive
on all fields.
In descu, fix a bug that would sometimes eliminate blank lines
between the "FTP:" header and the description.
Removed some dead code in descu.
v1.0.6 February 1998
There used to be a limit of 65k on the size of the describe
database source when using descu. This limit was imposed

View File

@ -2,14 +2,15 @@
* Header file for the describe package. This file is
* used by describe(1), descc(8), and descu(8).
*
* $Id: desc.h,v 1.7 1998/02/07 06:39:55 gdr-ftp Exp $
* $Id: desc.h,v 1.8 1999/04/05 19:47:19 gdr-ftp Exp $
*/
/*
* Keep these utilities in lockstep. Don't forget to change the version
* number in the *.rez files and in the manual pages.
*/
#define _VERSION_ "v1.0.6"
#define _VERSION_ "v1.0.7"
#define CURRENT_YEAR "1999"
#define QUOTE_CHAR '#'
#define DATABASE "/usr/lib/describe.db"

View File

@ -1,5 +1,5 @@
.\"
.\" $Id: descc.8,v 1.7 1998/02/07 06:39:57 gdr-ftp Exp $
.\" $Id: descc.8,v 1.8 1999/04/05 19:47:19 gdr-ftp Exp $
.\"
.TH DESCC 8 "6 February 1998" GNO "System Administration"
.SH NAME
@ -13,7 +13,7 @@ descc \- the describe(1) source compiler
.SH DESCRIPTION
This manual page documents
.BR descc
version 1.0.6.
version 1.0.7.
.LP
.BR descc
compiles the describe source file
@ -55,7 +55,7 @@ a complete record:
.nf
Name: describe
Version: 1.0.6
Version: 1.0.7
Shell: GNO, ORCA/Shell
Author: James Brookes
Contact: jamesb@ecst.csuchico.edu

View File

@ -1,5 +1,5 @@
Name: descc
Version: 1.0.6
Version: 1.0.7
Shell: ORCA/Shell, GNO/ME
Author: James Brookes
Contact: jamesb@ecst.csuchico.edu

View File

@ -1,7 +1,7 @@
/*
* Resources for version and comment
*
* $Id: descc.rez,v 1.4 1998/03/08 17:58:41 gdr-ftp Exp $
* $Id: descc.rez,v 1.5 1999/04/05 19:47:19 gdr-ftp Exp $
*/
#include "Types.rez"
@ -28,7 +28,7 @@ resource rVersion (1, purgeable3) {
* Comment
*/
resource rComment (1, purgeable3) {
PROG " v1.0.6\n"
PROG " v1.0.7\n"
DESC " (GNO) \n"
BUILD_DATE "\n"
AUTHOR

View File

@ -1,5 +1,5 @@
.\"
.\" $Id: describe.1,v 1.7 1998/02/07 06:40:00 gdr-ftp Exp $
.\" $Id: describe.1,v 1.8 1999/04/05 19:47:19 gdr-ftp Exp $
.\"
.TH DESCRIBE 1 "6 February 1998" GNO "Commands and Applications"
.SH NAME
@ -13,7 +13,7 @@ describe \- show information about a program
.SH DESCRIPTION
This manual page documents
.BR describe
version 1.0.6.
version 1.0.7.
.LP
.BR describe
will show current information about

View File

@ -1,5 +1,5 @@
Name: describe
Version: 1.0.6
Version: 1.0.7
Shell: ORCA/Shell, GNO/ME
Author: James Brookes
Contact: jamesb@ecst.csuchico.edu

View File

@ -1,7 +1,7 @@
/*
* Resources for version and comment
*
* $Id: describe.rez,v 1.4 1998/03/08 17:58:43 gdr-ftp Exp $
* $Id: describe.rez,v 1.5 1999/04/05 19:47:19 gdr-ftp Exp $
*/
#include "Types.rez"
@ -28,7 +28,7 @@ resource rVersion (1, purgeable3) {
* Comment
*/
resource rComment (1, purgeable3) {
PROG " v1.0.6\n"
PROG " v1.0.7\n"
DESC " (GNO) \n"
BUILD_DATE "\n"
AUTHOR

View File

@ -1,7 +1,7 @@
.\"
.\" $Id: descu.8,v 1.7 1998/02/07 06:40:07 gdr-ftp Exp $
.\" $Id: descu.8,v 1.8 1999/04/05 19:47:19 gdr-ftp Exp $
.\"
.TH DESCU 8 "6 February 1998" GNO "System Administration"
.TH DESCU 8 "5 April 1999" GNO "System Administration"
.SH NAME
descu \- the describe(1) source updater
.SH SYNOPSIS
@ -20,7 +20,7 @@ descu \- the describe(1) source updater
.SH DESCRIPTION
This manual page documents
.BR descu
version 1.0.6.
version 1.0.7.
.LP
.BR descu
updates the describe source file

View File

@ -11,7 +11,7 @@
* Copyright 1995-1997 by Devin Reade for James Brookes' describe(1) utility.
* See the included README file and man page for details.
*
* $Id: descu.c,v 1.8 1998/02/07 06:40:08 gdr-ftp Exp $
* $Id: descu.c,v 1.9 1999/04/05 19:47:19 gdr-ftp Exp $
*/
#include <sys/types.h>
@ -174,11 +174,6 @@ extract_info(char *source) {
if (q < p) {
*q++ = '\n';
}
#if 0
if (q < p) {
*q++ = '\n';
}
#endif
if (q < p) {
*q = '\0';
}
@ -195,7 +190,7 @@ extract_info(char *source) {
/* move q to first non-whitespace character */
q = p;
while (isspace(*q)) q++;
while (isspace(*q) && *q != '\n') q++;
if (*q == '\0') break;
/* shift the buffer */
@ -426,9 +421,9 @@ int ns_stricmp (char *a, char *b) {
void version (char *progName) {
fprintf(stderr,
"%s version %s Copyright 1995-1997 Devin Reade\n"
"%s version %s Copyright 1995-%s Devin Reade\n"
"Freeware. See the manual page for copying restrictions.\n",
progName,versionStr);
progName, versionStr, CURRENT_YEAR);
return;
}
@ -459,6 +454,7 @@ void usage(char *progName) {
int main(int argc, char **argv) {
static char *revisionMagic = "\n# Last revision:";
static struct stat sbuf;
time_t t;
char *buffer;
int i, j;
@ -500,6 +496,26 @@ int main(int argc, char **argv) {
/* show version info */
if (Vflag) version(basename(argv[0]));
/*
* Open the rejects file. Abort if it exists and is not a regular file
* (this is a security measure to avoid people putting in symlinks and
* thus overwriting files like, say, /etc/passwd).
*/
if (lstat(REJECT_FILE, &sbuf) < 0) {
if (errno != ENOENT) {
fprintf(stderr, "couldn't stat rejects file %s: %s\n",
REJECT_FILE, strerror(errno));
}
} else if (! S_ISREG(sbuf.st_mode)) {
fprintf(stderr, "%s exists and is not a regular file. Aborting\n",
REJECT_FILE);
exit(1);
}
if ((rejfp = fopen(REJECT_FILE,"w+"))==NULL) {
perror("couldn't open rejects file");
exit(1);
}
/*
* open output file if necessary. If the output filename matches
* that of the first input file, then dump stuff to a temporary file.
@ -521,12 +537,6 @@ int main(int argc, char **argv) {
outfp = stdout;
}
/* open the rejects file */
if ((rejfp = fopen(REJECT_FILE,"w+"))==NULL) {
perror("couldn't open rejects file");
exit(1);
}
/* read in original describe source file */
if ((buffer = inhale(argv[optind])) != NULL) {
insert(buffer,1);
@ -578,7 +588,9 @@ int main(int argc, char **argv) {
fprintf(outfp,"%s\n%s\n",entryArray2[j]->name,entryArray2[j]->data);
j++;
} else {
fprintf(rejfp,"%s\n%s\n",entryArray1[i]->name,entryArray1[i]->data);
if (ns_stricmp(entryArray1[i]->data, entryArray2[j]->data) != 0) {
fprintf(rejfp,"%s\n%s\n",entryArray1[i]->name,entryArray1[i]->data);
}
fprintf(outfp,"%s\n%s\n",entryArray2[j]->name,entryArray2[j]->data);
i++; j++;
}
@ -599,8 +611,16 @@ int main(int argc, char **argv) {
fprintf(outfp,"%s",trailer);
}
/* close the files and exit */
/* Close the files and exit. Don't keep the rejects file if it is empty. */
fclose(rejfp);
if (lstat(REJECT_FILE, &sbuf) < 0) {
fprintf(stderr, "couldn't stat rejects file %s: %s\n",
REJECT_FILE, strerror(errno));
} else {
if ((sbuf.st_size == 0) && S_ISREG(sbuf.st_mode)) {
unlink(REJECT_FILE);
}
}
if (oflag) {
if (temp != NULL) {
/* temp and outfp refer to the same FILE struct at this point */

View File

@ -1,5 +1,5 @@
Name: descu
Version: 1.0.6
Version: 1.0.7
Shell: ORCA/Shell, GNO/ME
Author: Devin Reade
Contact: gdr@trenco.gno.org

View File

@ -1,7 +1,7 @@
/*
* Resources for version and comment
*
* $Id: descu.rez,v 1.4 1998/03/08 17:58:44 gdr-ftp Exp $
* $Id: descu.rez,v 1.5 1999/04/05 19:47:20 gdr-ftp Exp $
*/
#include "Types.rez"
@ -28,7 +28,7 @@ resource rVersion (1, purgeable3) {
* Comment
*/
resource rComment (1, purgeable3) {
PROG " v1.0.6\n"
PROG " v1.0.7\n"
DESC " (GNO) \n"
BUILD_DATE "\n"
AUTHOR