- eliminate some extraneous whitespace in the database sources

describe.1, descc.8:
	- change database path to /usr/lib/describe.db
This commit is contained in:
gdr 1997-10-30 04:19:10 +00:00
parent c6e102e916
commit 293fc61f14
4 changed files with 70 additions and 19 deletions

View File

@ -19,9 +19,12 @@ LDLIBS +=
# If this is not part of the GNO builds, RELEASE_DIR is not defined
# so things get installed in a live file system instead.
BINDIR = $(RELEASE_DIR)/usr/bin
SBINDIR = $(RELEASE_DIR)/usr/sbin
MANDIR = $(RELEASE_DIR)/usr/man
BINDIR = /usr/bin
SBINDIR = /usr/sbin
MANDIR = /usr/man
RELBIN = $(RELEASE_DIR)$(BINDIR)
RELSBIN = $(RELEASE_DIR)$(SBINDIR)
RELMAN = $(RELEASE_DIR)$(MANDIR)
# If you have an old copy of GNO's libc, you may need to compile basename.c
# yourself. (As of v2.0.6, it's part of the standard libc.) vaend.c may
@ -61,13 +64,18 @@ descc.o:: desc.h
describe.o:: desc.h
descu.o:: desc.h
install release:
$(INSTALL) -d $(BINDIR) $(SBINDIR) $(MANDIR)/man1 $(MANDIR)/man8
release:
$(INSTALL) -d $(RELBIN) $(RELSBIN) $(RELMAN)/man1 $(RELMAN)/man8
$(INSTALL) -d $(DESC_DIR)
$(INSTALL) describe $(BINDIR)
$(INSTALL) descc $(SBINDIR)
$(INSTALL) descu $(SBINDIR)
$(INSTALL) describe.1 $(MANDIR)/man1
$(INSTALL) descc.8 $(MANDIR)/man8
$(INSTALL) descu.8 $(MANDIR)/man8
$(INSTALL) describe $(RELBIN)
$(INSTALL) descc descu $(RELSBIN)
$(INSTALL) describe.1 $(RELMAN)/man1
$(INSTALL) descc.8 descu.8 $(RELMAN)/man8
./descu -o $(DESC_SRC) $(DESC_SRC) $(DESC_FILES)
install:
$(INSTALL) -d $(BINDIR) $(SBINDIR) $(MANDIR)/man1 $(MANDIR)/man8
$(INSTALL) describe $(BINDIR)
$(INSTALL) descc descu $(SBINDIR)
$(INSTALL) describe.1 $(MANDIR)/man1
$(INSTALL) descc.8 descu.8 $(MANDIR)/man8

View File

@ -1,5 +1,5 @@
.\"
.\" $Id: descc.8,v 1.4 1997/09/24 06:34:57 gdr Exp $
.\" $Id: descc.8,v 1.5 1997/10/30 04:19:10 gdr Exp $
.\"
.TH DESCC 8 "22 September 1997" GNO "System Administration"
.SH NAME
@ -90,7 +90,7 @@ in the following format:
.fi
.SH FILES
.IP \fB/usr/lib/describe\fR
.IP \fB/usr/lib/describe.db\fR
The system
.B describe
database. If the environment variable
@ -101,7 +101,7 @@ is set, its value will be used instead.
Full path to the system describe database. If
.B DESCDB
is set, its value is used instead of the default location
.BR /usr/lib/describe .
.BR /usr/lib/describe.db .
.SH AUTHOR
James Brookes <jamesb@ecst.csuchico.edu>.
.SH HISTORY

View File

@ -1,5 +1,5 @@
.\"
.\" $Id: describe.1,v 1.4 1997/09/24 06:34:58 gdr Exp $
.\" $Id: describe.1,v 1.5 1997/10/30 04:19:10 gdr Exp $
.\"
.TH DESCRIBE 1 "22 September 1997" GNO "Commands and Applications"
.SH NAME
@ -44,7 +44,7 @@ uses a database compiled by
\fB-V\fR Show version information.
.fi
.SH FILES
.IP \fB/usr/lib/describe\fR
.IP \fB/usr/lib/describe.db\fR
The system
.B describe
database. If the environment variable
@ -55,7 +55,7 @@ is set, its value will be used instead.
Full path to the system describe database. If
.B DESCDB
is set, its value is used instead of the default location
.BR /usr/lib/describe .
.BR /usr/lib/describe.db .
.SH AUTHOR
James Brookes <jamesb@ecst.csuchico.edu>.
.SH "SEE ALSO"

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.4 1997/09/24 06:34:58 gdr Exp $
* $Id: descu.c,v 1.5 1997/10/30 04:19:10 gdr Exp $
*/
#include <sys/types.h>
@ -141,7 +141,7 @@ inhale (char *pathname) {
descEntry *
extract_info(char *source) {
char *p;
char *p, *q, *r;
descEntry *entry;
if ((entry = malloc(sizeof(descEntry))) == NULL) {
@ -166,6 +166,49 @@ extract_info(char *source) {
do { --p; } while (isspace(*p));
*(p+1) = '\0';
/* drop trailing blank lines, except for one */
p = r = entry->data;
p += strlen(p);
q = p - 1;
while ((q >= r) && isspace(*q)) {
*q-- = '\0';
}
q++;
if (q < p) {
*q++ = '\n';
}
#if 0
if (q < p) {
*q++ = '\n';
}
#endif
if (q < p) {
*q = '\0';
}
/* eliminate whitespace at the beginning of lines */
p = entry->data;
for (;;) {
/* skip to next newline */
while (*p && *p != '\n') p++;
if (*p == '\0') break;
p++;
while (*p == '\n') p++;
if (!isspace(*p)) continue;
/* move q to first non-whitespace character */
q = p;
while (isspace(*q)) q++;
if (*q == '\0') break;
/* shift the buffer */
r = p;
while (*q) {
*r++ = *q++;
}
*r = '\0';
}
return entry;
}