'\" t .\" Title: dk-t2db .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 03/28/2017 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "DK\-T2DB" "1" "03/28/2017" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" dk-t2db \- Text to database converter .SH "SYNOPSIS" .sp \fBdk\-t2db\fR [\fIoptions\fR] [\fIfile\fR\&...] \fIdatabase\fR .SH "DESCRIPTION" .sp The program converts text from the specified files or standard input into a simple text database\&. .sp A \fIsimple\fR \fIdatabase\fR is a Berkeley DB, NDBM or in\-memory database\&. The records are key/value pairs, both key and value are a byte array\&. Keys are unique\&. .sp In a \fIsimple\fR \fItext\fR \fIdatabase\fR all keys and values are text strings\&. The finalizing 0 character is saved in the database together with the texts\&. .sp Use type::filename to specify databases (Type and file name are separated by two colons)\&. The following type names can be used: .TS tab(:); lt lt lt lt lt lt. T{ .sp bdb T}:T{ .sp Berkeley DB T} T{ .sp ndbm T}:T{ .sp NDBM database T} T{ .sp mem T}:T{ .sp in\-memory database T} .TE .sp 1 .SH "OPTIONS" .PP \fB\-a\fR, \fB\-\-add\fR .RS 4 adds data to an existing database (modifies or adds records)\&. Without this option the program deletes an exisiting database and creates a new one\&. .RE .PP \fB\-R\fR, \fB\-\-reset\fR .RS 4 ignores preference values for line, key and value buffer size\&. .RE .PP \fB\-l\fR \fIsize\fR, \fB\-\-line\-size=\fR\fIsize\fR .RS 4 Line buffer size (number of characters), default: 1024\&. .RE .PP \fB\-k\fR \fIsize\fR, \fB\-\-key\-buffer\-size=\fR\fIsize\fR .RS 4 Key buffer size (number of characters), default: 512\&. .RE .PP \fB\-v\fR \fIsize\fR, \fB\-\-value\-buffer\-size=\fR\fIsize\fR .RS 4 Value buffer size (number of characters), default: 512\&. .RE .PP \fB\-i\fR \fIstring\fR, \fB\-\-input\-encoding=\fR\fIstring\fR .RS 4 Expected input encoding\&. The encoding is overwritten if a byte order marker (BOM) is found at the start of input\&. .RE .PP \fB\-c\fR \fIstring\fR, \fB\-\-comment=\fR\fIstring\fR .RS 4 Optional comment character\&. All lines having the comment character as first non\-whitespace character are comments\&. .RE .SH "EXIT STATUS" .sp The program returns exit status code 0 on success, all other status codes indicate an error\&. .SH "PREFERENCES" .PP \fBline\&.size\fR .RS 4 Input line buffer size .RE .PP \fBtext\-db\&.key\&.max\-size\fR .RS 4 Key buffer size .RE .PP \fBtext\-db\&.value\&.max\-size\fR .RS 4 Value buffer size .RE .SH "FILES" .sp Input files are text files\&. Each text line specifies one record\&. The first word in a line (first sequence of non\-whitespace characters) is the key text\&. All further text started by the second word until the line end is used as value\&. .sp The key can not contain spaces, the value can contain spaces\&. .sp A line containing just a key but no value results in deletion of the specified record\&. .SH "EXAMPLES" .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Process standard input, create in\-memory database file db\&.dat: .sp dk\-t2db \-c "#" mem::db\&.dat .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Process text input file db\&.in, create Berkeley DB file bdb\&.dat: .sp dk\-t2db \-c "#" db\&.in bdb::bdb\&.dat .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Process text input file db\&.in, modify existing NDBM database ndbm\&.dat: .sp dk\-t2db \-a \-c "#" db\&.in ndbm::ndbm\&.dat .RE .SH "RESTRICTIONS" .sp On Windows the file name length is restricted to _MAX_PATH (260) characters if the file name contains a wildcard (* or ? character)\&. .sp Wildcards can not be used to specify the database file name\&. .SH "NOTES" .sp This program uses DK libraries version 4\&. .SH "AUTHORS" .sp Dirk Krause .SH "COPYRIGHT AND LICENSE" .sp Copyright (c) 2016, Dirk Krause .sp All rights reserved\&. .sp Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} 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\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Neither the name of the copyright holder(s) nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission\&. .RE .sp THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \(lqAS IS\(rq AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED\&. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\&. .SH "SEE ALSO" .PP http://dktools\&.sourceforge\&.net .RS 4 Project homepage\&. .RE