Skip to content

Commit

Permalink
added: dictfmt.1, dictfmt_index2suffix, patched version of dictfmt.c
Browse files Browse the repository at this point in the history
several changes in dictd.8
fixed: typo in utf8_ucs4.c
added: uninstall target in Makefile.in

Now dictfmt is a part of dictd distribution
  • Loading branch information
cheusov committed Aug 12, 2002
1 parent e7d7794 commit 0590798
Show file tree
Hide file tree
Showing 7 changed files with 1,032 additions and 22 deletions.
58 changes: 45 additions & 13 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: Makefile.in,v 1.50 2002/08/05 14:58:49 cheusov Exp $
# $Id: Makefile.in,v 1.51 2002/08/12 16:27:33 cheusov Exp $
#

# Add a _letter_ if you change the version number and release your own version.
# Numbers are for the original author(s) only.
DICT_VERSION=1.7.1
DICT_VERSION=1.8.0

ifneq (,)
This makefile requires GNU Make.
Expand Down Expand Up @@ -61,9 +61,10 @@ XTRACFLAGS= @WCFLAGS@ @XTRACFLAGS@ @DEFS@ @CPPFLAGS@ -I. -Iregex
XTRALDFLAGS= @WLDFLAGS@ @XTRALDFLAGS@
LDLIBS= @LIBS@ -Lregex -lregex

EXES= dict dictd dictzip
EXES= dict dictd dictzip dictfmt

HEADERS= ./config.h @XTRAHEADERS@ dictzip.h dictd.h dict.h codes.h md5.h
HEADERS= ./config.h @XTRAHEADERS@ dictzip.h dictd.h dict.h \
codes.h md5.h utf8_ucs4.h

SRCHOBJS= index.o data.o utf8_ucs4.o
NETOBJS= daemon.o net.o servscan.o servparse.o md5.o
Expand Down Expand Up @@ -108,7 +109,10 @@ dictd:: dictd.c $(HEADERS) $(NETOBJS) $(SRCHOBJS)
$(CC) $(ALLFLAGS) -o $@ $< $(NETOBJS) $(SRCHOBJS) $(ZIPOBJS) $(LDLIBS)

dictzip:: dictzip.c $(HEADERS) $(SRCHOBJS)
$(CC) $(ALLFLAGS) -o $@ $< $(SRCHOBJS) $(LDLIBS)
$(CC) $(ALLFLAGS) -o $@ $< $(SRCHOBJS) $(LDLIBS)

dictfmt:: dictfmt.c $(HEADERS) utf8_ucs4.o
$(CC) $(ALLFLAGS) -o $@ $< utf8_ucs4.o $(LDLIBS)

servscan.c: servscan.l
$(LEX) $(LFLAGS) -o$@ $<
Expand Down Expand Up @@ -140,37 +144,65 @@ clientparse.c: clientparse.y
clientparse.o: clientparse.c $(HEADERS)
$(CC) -c $(XTRACFLAGS) $(CFLAGS) $(SCFLAGS) $<

.PHONY: install.dict install.dictzip install.dictfmt install.dictd

install.dict: dict
if test ! -d $(bindir); then $(INSTALL) -d 755 $(bindir); fi
if test ! -d $(man1_prefix); then $(INSTALL) -d 755 $(man1_prefix); fi
$(INSTALL_PROGRAM) dict $(bindir)
$(INSTALL_DATA dict.1 $(man1_prefix)/dict.1
$(INSTALL_DATA) dict.1 $(man1_prefix)/dict.1

install.dictzip: dictzip
if test ! -d $(bindir); then $(INSTALL) -d 755 $(bindir); fi
if test ! -d $(man1_prefix); then $(INSTALL) -d 755 $(man1_prefix); fi
$(INSTALL_PROGRAM) dictzip $(bindir)
$(INSTALL_DATA) dictzip.1 $(man1_prefix)/dictzip.1

install.dictfmt: dictfmt
if test ! -d $(bindir); then $(INSTALL) -d 755 $(bindir); fi
if test ! -d $(man1_prefix); then $(INSTALL) -d 755 $(man1_prefix); fi
$(INSTALL_PROGRAM) dictfmt $(bindir)
$(INSTALL_DATA) dictfmt.1 $(man1_prefix)/dictfmt.1

install.dictd: dictd
if test ! -d $(sbindir); then $(INSTALL) -d 755 $(sbindir); fi
if test ! -d $(man8_prefix); then install -d 755 $(man8_prefix); fi
$(INSTALL_PROGRAM) dictd $(sbindir)
$(INSTALL_DATA) dictd.8 $(man8_prefix)/dictd.8

install: $(EXES) install.dict install.dictzip install.dictd
.PHONY: install

install: $(EXECS) install.dict install.dictzip install.dictd install.dictfmt

.PHONY: uninstall.dict uninstall.dictzip uninstall.dictfmt uninstall.dictd

uninstall.dict:
rm -f $(bindir)/dict $(man1_prefix)/dict.1

uninstall.dictzip:
rm -f $(bindir)/dictzip $(man1_prefix)/dictzip.1

uninstall.dictd:
rm -f $(sbindir)/dictd $(man8_prefix)/dictd.8

uninstall.dictfmt:
rm -f $(bindir)/dictfmt $(man1_prefix)/dictfmt.1

.PHONY: uninstall

uninstall: uninstall.dict uninstall.dictd uninstall.dictfmt uninstall.dictzip

.PHONY: ChangeLog
ChangeLog:
@(echo "***** Making new ChangeLog..."; \
rm -f ChangeLog; \
AWK=gawk rcs2log -i 2 -r -d'1996-09-20<' . doc regex zlib libmaa \
| sed 's,/cvsroot/dict/dictd1/,,g' \
| sed 's,/cvs/dict/dictd1/,,g' \
| sed 's/cheusov[^>]*/Aleksey Cheusov <[email protected]/' \
| sed 's,faith@[^>]*,[email protected],g' \
| sed 's,hilliard...hilliard@.*,Bob Hilliard <[email protected]>,g'\
| sed 's,tek...tek@.*,Julian Squires <[email protected]>,g' \
| sed 's,/cvsroot/dict/dictd1/,,g; \
s,/cvs/dict/dictd1/,,g;\
s/cheusov[^>]*/Aleksey Cheusov <[email protected]/;\
s,faith@[^>]*,[email protected],g;\
s,hilliard...hilliard@.*,Bob Hilliard <[email protected]>,g;
s,tek...tek@.*,Julian Squires <[email protected]>,g' \
> ChangeLog;)


Expand Down
6 changes: 4 additions & 2 deletions dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: dict.c,v 1.28 2002/08/02 19:43:14 faith Exp $
* $Id: dict.c,v 1.29 2002/08/12 16:27:33 cheusov Exp $
*
*/

Expand Down Expand Up @@ -942,7 +942,7 @@ static const char *id_string( const char *id )
static const char *client_get_banner( void )
{
static char *buffer= NULL;
const char *id = "$Id: dict.c,v 1.28 2002/08/02 19:43:14 faith Exp $";
const char *id = "$Id: dict.c,v 1.29 2002/08/12 16:27:33 cheusov Exp $";
struct utsname uts;

if (buffer) return buffer;
Expand Down Expand Up @@ -1086,6 +1086,7 @@ int main( int argc, char **argv )
while ((c = getopt_long( argc, argv,
"h:p:d:i:Ims:DSHau:c:Ck:VLvrP:",
longopts, NULL )) != EOF)
{
switch (c) {
case 'h': host = optarg; break;
case 'p': service = optarg; break;
Expand Down Expand Up @@ -1113,6 +1114,7 @@ int main( int argc, char **argv )
case 501: help( stdout ); exit(1); break;
default: help( stderr ); exit(1); break;
}
}

if (optind == argc && (!(function & ~(DEFINE|MATCH)))) {
banner( stderr );
Expand Down
10 changes: 5 additions & 5 deletions dictd.8
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ file at compile time (DICT_DAEMON_LIMIT).
Specifies the locale used for searching. If no locale is specified, the
"C" locale is used. The locale used for the server should be the same
as that used for dictfmt when the database was built (specifically, the
locale under which the index was sorted). This is a temporary kludge to
allow support of non-ASCII7 databases until full UTF-8 support is
added. Note that if your database is not in ASCII7 or UTF-8 format,
then the dictd server will not be compliant to RFC 2229. However, for
many uses, this is sufficient until full UTF-8 support can be added.
locale under which the index was sorted). The locale should be specified
for both 8-bit and UTF-8 formats. If locale contains utf8 or utf-8
substring, UTF-8 format is expected.
Note that if your database is not in ASCII7 or UTF-8 format,
then the dictd server will not be compliant to RFC 2229.
.TP
.BI \-l " option\fR or " \-\-log " option"
Specify a logging option. This is effective only if logging has been
Expand Down
202 changes: 202 additions & 0 deletions dictfmt.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
.\" dictfmt.1 --
.\" Created: Sat, 23 Dec 2000 13:56:42 -0500 by [email protected]
.\" Copyright 2000 Robert D. Hilliard <[email protected]>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.TH DICTFMT 1 "25 December 2000" "" ""
.SH NAME
dictfmt \- formats a DICT protocol dictionary database
.SH SYNOPSIS
.nf
.BI dictfmt " -c5|-e|-f|-h|-j|-p -u url -s name basename"
.fi
.SH DESCRIPTION
.B dictfmt
takes a file,
.I FILE,
on stdin, and creates a dictionary database named
.I basename.dict,
that conforms to the DICT protocol. It also creates an index file named
.I basename.index. (
.IR basename " is commonly chosen to correspond to the basename of"
.I FILE
, but this is not mandatory.)

Unless the database is extremely small, it is
highly recommended that
.I basename.dict
be compressed with
.I /usr/bin/dictzip
to create
.I basename.dict.dz.
(dictzip is included in
the
.B dictd
package.)
.P
FILE may be in any of the several formats described by
the format options \-c5,-e,\-f,\-h,\-j, or \-p. Exactly one of
these options must be given.
.P
Headers are prepended to the file giving the URL of the site from
which the original database was obtained, and the name of the
dictionary. If the -u and/or -s options are omitted, the value
"unknown" will be included in these headers, which is undesirable. A
header giving the date of conversion is also added.
.SH OPTIONS
.TP
.BI \-c5
.I
FILE
is formatted with
.B headwords
preceded by 5 or more underscore characters (_) and a blank line.
All text until the next
.B headword
is considered the definition. If the
.B headwords
are all caps, they are changed to mixed case. Any leading `@'
characters are stripped out, but the file is otherwise unchanged. This
option was written to format the CIA WORLD FACTBOOK 1995.
.TP
.BI \-e
.I
FILE
is in html format, with the
.B headword
tagged as bold. (<B>headword - </B>)
.RS
This option was written to format EASTON'S 1897 BIBLE DICTIONARY. The
head of a typical entry from Easton is:
.P
<A NAME="T0000005">
.br
<B>Abagtha - </B>
.br
one of the seven eunuchs in Ahasuerus's court (Esther 1:10;
2:21).

This is converted to:
.br
Abagtha
.br
one of the seven eunuchs in Ahasuerus's court (Esther 1:10;
2:21).

The
.B headword
`Abagtha' is indexed.

.B NOTE:
This option should be used with caution. It removes several
html tags (enough to format Easton properly), but not all. The
Makefile for dict-misc uses a sed script to modify certain cross
reference tags. It may be necessary to pipe the input file through a
sed script, or hack the source of dictfmt in order to properly format
other html databases.
.RE
.TP
.BI \-f
.I FILE
is formatted with the
.B headword
starting in column 0, followed by a blank line, with the definition
indented 8 spaces (or one tab character) on subsequent lines. This
option was written to format the FOLDOC.
.TP
.BI \-h
.I
FILE
is formatted with the
.B headword
starting in column 0, followed by a comma, with the definition
continuing on the same line.
.RS
This option was written to format HITCHCOCK'S BIBLE
NAMES DICTIONARY. The
.B headword
is indexed; the text of the file is not changed.
.RE
.TP
.BI \-j
.I
FILE
is formatted with
.B headwords
surrounded by colons, followed by the definition.
.RS
This option was written to format the JARGON FILE. The colons
surrounding the
.B headword
are removed, and the
.B headword
is indexed.

.B NOTE:
Recent versions of the jargon file insert three blanks before the
first colon at each headword. These must be removed before processing
with dictfmt. (sed scripts have been used for this purpose. ed, awk,
or perl scripts are also possible.)
.RE
.TP
.BI \-p
.I
FILE
is formatted with `%h' in column 0, followed by a blank, followed by the
.B headword
, followed by a line containing `%d' in column 0. The definition
starts on the following line.
..br
This option was written to format Jay Kominek's elements database.
.TP
.BI \-u " url"
Specifies the URL of the site from which the raw database was obtained.
.TP
.BI \-s " name"
Specifies the name and, optionally, the version and date, of the
database. (If this contains spaces, it must be quoted.)
.TP
.BI \-L
display license and copyright information
.TP
.BI \-V
display version information
.TP
.BI \-D
output debuugging information
.TP
.BI \--help
display a help message
.SH CREDITS
.B dictfmt
was written by Rik Faith ([email protected]) as part of the dict-misc
package, and modified by Robert D. Hilliard <[email protected]> to
be a stand-alone package. It is distributed under the terms of the
GNU General Public License. If you need to distribute under other
terms, write to the author.
.P
.SH "SEE ALSO"
.BR dict (1),
.BR dictd (8),
.BR dictzip (1),
.BR http://www.dict.org,
.B RFC 2229
Loading

0 comments on commit 0590798

Please sign in to comment.