summaryrefslogtreecommitdiffabout
path: root/doc/gdbm.texinfo
Unidiff
Diffstat (limited to 'doc/gdbm.texinfo') (more/less context) (ignore whitespace changes)
-rw-r--r--doc/gdbm.texinfo134
1 files changed, 65 insertions, 69 deletions
diff --git a/doc/gdbm.texinfo b/doc/gdbm.texinfo
index 9f0af5b..17f47f9 100644
--- a/doc/gdbm.texinfo
+++ b/doc/gdbm.texinfo
@@ -118,7 +118,7 @@ Functions:
118 118
119Programs 119Programs
120 120
121* testgdbm:: Test and modify a GDBM database. 121* gdbmtool:: Examine and modify a GDBM database.
122* gdbm_dump:: Dump the database into a flat file. 122* gdbm_dump:: Dump the database into a flat file.
123* gdbm_load:: Load the database from a flat file. 123* gdbm_load:: Load the database from a flat file.
124* gdbmexport:: Export a database into a portable format. 124* gdbmexport:: Export a database into a portable format.
@@ -1617,35 +1617,35 @@ memory managed by the compatibility library. The application should
1617never free it. 1617never free it.
1618@end deftypefn 1618@end deftypefn
1619 1619
1620@node testgdbm 1620@node gdbmtool
1621@chapter Test and modify a GDBM database. 1621@chapter Examine and modify a GDBM database.
1622@prindex testgdbm 1622@prindex gdbmtool
1623 1623
1624The @command{testgdbm} utility allows you to view and modify an 1624The @command{gdbmtool} utility allows you to view and modify an
1625existing @acronym{GDBM} database or to create a new one. 1625existing @acronym{GDBM} database or to create a new one.
1626 1626
1627@cindex default database, @command{testgdbm} 1627@cindex default database, @command{gdbmtool}
1628@flindex junk.gdbm 1628@flindex junk.gdbm
1629When invoked without arguments, it tries to open a database file called 1629When invoked without arguments, it tries to open a database file called
1630@file{junk.gdbm}, located in the current working directory. You can 1630@file{junk.gdbm}, located in the current working directory. You can
1631change this default by supplying the name of the database to use as 1631change this default by supplying the name of the database to use as
1632the only argument to @command{testgdbm}, e.g.: 1632the only argument to @command{gdbmtool}, e.g.:
1633 1633
1634@example 1634@example
1635$ testgdbm file.db 1635$ gdbmtool file.db
1636@end example 1636@end example
1637 1637
1638@cindex read-only mode, @command{testgdbm} 1638@cindex read-only mode, @command{gdbmtool}
1639@cindex @option{-r}, @command{testgdbm} option 1639@cindex @option{-r}, @command{gdbmtool} option
1640@cindex @option{--read-only}, @command{testgdbm} option 1640@cindex @option{--read-only}, @command{gdbmtool} option
1641The database will be opened in read-write mode, unless the 1641The database will be opened in read-write mode, unless the
1642@option{-r} (@option{--read-only}) option is specified, in which case 1642@option{-r} (@option{--read-only}) option is specified, in which case
1643it will be opened only for reading. 1643it will be opened only for reading.
1644 1644
1645@cindex creating a database, @command{testgdbm} 1645@cindex creating a database, @command{gdbmtool}
1646@cindex @option{-n}, @command{testgdbm} option 1646@cindex @option{-n}, @command{gdbmtool} option
1647@cindex @option{--newdb}, @command{testgdbm} option 1647@cindex @option{--newdb}, @command{gdbmtool} option
1648If the database does not exist, @command{testgdbm} will create it. 1648If the database does not exist, @command{gdbmtool} will create it.
1649There is a special option @option{-n} (@option{--newdb}, which 1649There is a special option @option{-n} (@option{--newdb}, which
1650instructs the utility to create a new database. If it is used and if 1650instructs the utility to create a new database. If it is used and if
1651the database already exists, it will be deleted, so use it sparingly. 1651the database already exists, it will be deleted, so use it sparingly.
@@ -1656,10 +1656,10 @@ the database already exists, it will be deleted, so use it sparingly.
1656@end menu 1656@end menu
1657 1657
1658@node invocation 1658@node invocation
1659@section testgdbm invocation 1659@section gdbmtool invocation
1660@cindex command line options, @command{testgdbm} 1660@cindex command line options, @command{gdbmtool}
1661 1661
1662The following table summarizes all @command{testgdbm} command line 1662The following table summarizes all @command{gdbmtool} command line
1663options: 1663options:
1664 1664
1665@table @option 1665@table @option
@@ -1681,6 +1681,9 @@ Disable file locking.
1681@item -m 1681@item -m
1682@itemx --no-mmap 1682@itemx --no-mmap
1683Disable mmap. 1683Disable mmap.
1684@item -q
1685@itemx --quiet
1686Don't print the usual welcome banner at startup.
1684@item -r 1687@item -r
1685@itemx --read-only 1688@itemx --read-only
1686Open the database in read-only mode. 1689Open the database in read-only mode.
@@ -1696,23 +1699,23 @@ command line options.
1696@end table 1699@end table
1697 1700
1698@node shell 1701@node shell
1699@section testgdbm interactive mode 1702@section gdbmtool interactive mode
1700@cindex interactive mode, @command{testgdbm} 1703@cindex interactive mode, @command{gdbmtool}
1701 1704
1702After successful startup, @command{testgdbm} starts a loop, in which 1705After successful startup, @command{gdbmtool} starts a loop, in which
1703it reads commands from the user, executes them and prints the results 1706it reads commands from the user, executes them and prints the results
1704on the standard output. If the standard input is attached to a console, 1707on the standard output. If the standard input is attached to a console,
1705@command{testgdbm} runs in interactive mode, which is indicated by its 1708@command{gdbmtool} runs in interactive mode, which is indicated by its
1706@dfn{prompt}: 1709@dfn{prompt}:
1707 1710
1708@example 1711@example
1709testgdbm> _ 1712gdbmtool> _
1710@end example 1713@end example
1711 1714
1712The utility finishes when it reads the @samp{quit} command (see below) or 1715The utility finishes when it reads the @samp{quit} command (see below) or
1713detects end-of-file on its standard input, whichever occurs first. 1716detects end-of-file on its standard input, whichever occurs first.
1714 1717
1715A @command{testgdbm} command consists of a @dfn{command verb}, 1718A @command{gdbmtool} command consists of a @dfn{command verb},
1716optionally followed by one or two @dfn{arguments}, separated by any 1719optionally followed by one or two @dfn{arguments}, separated by any
1717amount of white space. A command verb can be entered either in full 1720amount of white space. A command verb can be entered either in full
1718or in an abbreviated form, as long as that abbreviation does not match 1721or in an abbreviated form, as long as that abbreviation does not match
@@ -1727,35 +1730,35 @@ space. This limitation will be removed in future releases.
1727 1730
1728Each command takes at most two @dfn{formal parameters}, which can be 1731Each command takes at most two @dfn{formal parameters}, which can be
1729optional or mandatory. If the number of actual arguments is less than the 1732optional or mandatory. If the number of actual arguments is less than the
1730number of mandatory parameters, @command{testgdbm} will prompt you to 1733number of mandatory parameters, @command{gdbmtool} will prompt you to
1731supply missing arguments. For example, the @samp{store} command takes two 1734supply missing arguments. For example, the @samp{store} command takes two
1732mandatory parameters, so if you invoked it with no arguments, you 1735mandatory parameters, so if you invoked it with no arguments, you
1733would be prompted twice to supply the necessary data, as shown in 1736would be prompted twice to supply the necessary data, as shown in
1734example below: 1737example below:
1735 1738
1736@example 1739@example
1737testgdbm> @kbd{store} 1740gdbmtool> @kbd{store}
1738key> @kbd{three} 1741key> @kbd{three}
1739data> @kbd{3} 1742data> @kbd{3}
1740@end example 1743@end example
1741 1744
1742However, such prompting is possible only in interactive mode. In 1745However, such prompting is possible only in interactive mode. In
1743non-interactive mode (e.g.@: when running a script), all arguments must 1746non-interactive mode (e.g.@: when running a script), all arguments must
1744be supplied with each command, otherwise @command{testgdbm} will report an 1747be supplied with each command, otherwise @command{gdbmtool} will report an
1745error and exit immediately. 1748error and exit immediately.
1746 1749
1747@anchor{pager} 1750@anchor{pager}
1748@cindex pager, @command{testgdbm} 1751@cindex pager, @command{gdbmtool}
1749@cindex @env{PAGER} 1752@cindex @env{PAGER}
1750Some commands produce excessive amounts of output. To help you follow 1753Some commands produce excessive amounts of output. To help you follow
1751it, @command{testgdbm} uses a pager utility to display such 1754it, @command{gdbmtool} uses a pager utility to display such
1752output. The name of the pager utility is taken from the environment 1755output. The name of the pager utility is taken from the environment
1753variable @env{PAGER}. The pager is invoked only in interactive mode 1756variable @env{PAGER}. The pager is invoked only in interactive mode
1754and only if the estimated number of output lines is greater then the 1757and only if the estimated number of output lines is greater then the
1755number of lines on your screen. 1758number of lines on your screen.
1756 1759
1757@anchor{nul-termination} 1760@anchor{nul-termination}
1758Many of the @command{testgdbm} commands operate on database key and 1761Many of the @command{gdbmtool} commands operate on database key and
1759data values. The utility assumes that both keys and data are 1762data values. The utility assumes that both keys and data are
1760@acronym{ASCII} strings, either nul-terminated or not. By default, 1763@acronym{ASCII} strings, either nul-terminated or not. By default,
1761it is assumed that strings are nul-terminated. You can change this 1764it is assumed that strings are nul-terminated. You can change this
@@ -1765,39 +1768,36 @@ by using @code{z} (@code{key-zero}, for keys) and @code{Z}
1765The following table summarizes all available commands: 1768The following table summarizes all available commands:
1766 1769
1767@deffn {command verb} count 1770@deffn {command verb} count
1768@deffnx {command abbrev} co
1769@deffnx {command letter} c 1771@deffnx {command letter} c
1770Print the number of entries in the database. 1772Print the number of entries in the database.
1771@end deffn 1773@end deffn
1772 1774
1773@deffn {command verb} delete @var{key} 1775@deffn {command verb} delete @var{key}
1774@deffnx {command abbrev} de @var{key}
1775@deffnx {command letter} d @var{key} 1776@deffnx {command letter} d @var{key}
1776Delete entry with a given @var{key} 1777Delete entry with the given @var{key}
1777@end deffn 1778@end deffn
1778 1779
1779@anchor{testgdbm export} 1780@anchor{gdbmtool export}
1780@deffn {command verb} export @var{file-name} [truncate] [binary|ascii] 1781@deffn {command verb} export @var{file-name} [truncate] [binary|ascii]
1781@deffnx {command abbrev} e @var{file-name} [truncate] [binary|ascii] 1782@deffnx {command letter} e @var{file-name} [truncate] [binary|ascii]
1782Export the database to the flat file @var{file-name}. @xref{Flat files}, 1783Export the database to the flat file @var{file-name}. @xref{Flat files},
1783for a description of the flat file format and its purposes. This 1784for a description of the flat file format and its purposes. This
1784command will not overwrite an existing file, unless the argument 1785command will not overwrite an existing file, unless the
1785@samp{truncate} is also given. Another optional argument determines 1786@samp{truncate} parameter is also given. Another optional argument
1786the type of dump (@pxref{Flat files}). By default, ASCII dump is 1787determines the type of the dump (@pxref{Flat files}). By default, ASCII
1787created. 1788dump is created.
1788 1789
1789See also @ref{gdbmexport}. 1790See also @ref{gdbmexport}.
1790@end deffn 1791@end deffn
1791 1792
1792@deffn {command verb} fetch @var{key} 1793@deffn {command verb} fetch @var{key}
1793@deffnx {command abbrev} fe @var{key}
1794@deffnx {command letter} f @var{key} 1794@deffnx {command letter} f @var{key}
1795Fetch and display a record with the given @var{key}. 1795Fetch and display the record with the given @var{key}.
1796@end deffn 1796@end deffn
1797 1797
1798@anchor{testgdbm import} 1798@anchor{gdbmtool import}
1799@deffn {command verb} import @var{file-name} [replace] [nometa] 1799@deffn {command verb} import @var{file-name} [replace] [nometa]
1800@deffnx {command abbrev} i @var{file-name} [replace] [nometa] 1800@deffnx {command letter} i @var{file-name} [replace] [nometa]
1801Import data from a flat dump file @var{file-name} 1801Import data from a flat dump file @var{file-name}
1802(@pxref{Flat files}). If the word @samp{replace} is given 1802(@pxref{Flat files}). If the word @samp{replace} is given
1803as an argument, any records with the same keys as the already 1803as an argument, any records with the same keys as the already
@@ -1806,107 +1806,105 @@ restoring meta-information from the dump file.
1806@end deffn 1806@end deffn
1807 1807
1808@deffn {command verb} list 1808@deffn {command verb} list
1809@deffnx {command abbrev} l 1809@deffnx {command letter} l
1810List the contents of the database (@pxref{pager}). 1810List the contents of the database (@pxref{pager}).
1811@end deffn 1811@end deffn
1812 1812
1813@deffn {command verb} next [@var{key}] 1813@deffn {command verb} next [@var{key}]
1814@deffnx {command abbrev} n [@var{key}] 1814@deffnx {command letter} n [@var{key}]
1815Sequential access: fetch and display a next record. If @var{key} is 1815Sequential access: fetch and display the next record. If the @var{key} is
1816given, a record following one with this key will be fetched. 1816given, the record following the one with this key will be fetched.
1817Otherwise, the key supplied by the latest @code{1}, @code{2} or
1818@var{n} command will be used.
1819 1817
1820See also @code{first}, below. 1818See also @code{first}, below.
1821 1819
1822@xref{Sequential}, for more information on sequential access. 1820@xref{Sequential}, for more information on sequential access.
1823@end deffn 1821@end deffn
1824 1822
1823@deffn {command verb} prompt @var{text}
1824Changes the command prompt to the string @var{text}. The string can
1825contain @dfn{escape sequences}, the special entities consisting of the
1826@samp{%} character followed by another character. These sequences are
1827replaced in the generated prompt as follows:
1828
1829@multitable @columnfractions 0.4 0.5
1830@headitem Sequence @tab Expansion
1831@item %f @tab name of the db file
1832@item %% @tab %
1833@end multitable
1834@end deffn
1835
1825@deffn {command verb} quit 1836@deffn {command verb} quit
1826@deffnx {command abbrev} q 1837@deffnx {command letter} q
1827Close the database and quit the utility. 1838Close the database and quit the utility.
1828@end deffn 1839@end deffn
1829 1840
1830@deffn {command verb} store @var{key} @var{data} 1841@deffn {command verb} store @var{key} @var{data}
1831@deffnx {command abbrev} sto @var{key} @var{data}
1832@deffnx {command letter} s @var{key} @var{data} 1842@deffnx {command letter} s @var{key} @var{data}
1833Store the @var{data} with @var{key} in the database. If @var{key} 1843Store the @var{data} with @var{key} in the database. If @var{key}
1834already exists, its data will be replaced. 1844already exists, its data will be replaced.
1835@end deffn 1845@end deffn
1836 1846
1837@deffn {command verb} first 1847@deffn {command verb} first
1838@deffnx {command abbrev} fi
1839@deffnx {command letter} 1 1848@deffnx {command letter} 1
1840Fetch and display the first record in the database. Subsequent 1849Fetch and display the first record in the database. Subsequent
1841records can be fetched using @code{next} command (see above). 1850records can be fetched using the @code{next} command (see above).
1842@xref{Sequential}, for more information on sequential access. 1851@xref{Sequential}, for more information on sequential access.
1843@end deffn 1852@end deffn
1844 1853
1845@deffn {command verb} read @var{file} [replace] 1854@deffn {command verb} read @var{file} [replace]
1846@deffnx {command abbrev} rea @var{file} [replace]
1847@deffnx {command letter} < @var{file} [replace] 1855@deffnx {command letter} < @var{file} [replace]
1848Read entries from @var{file} and store them in the database. If the 1856Read entries from @var{file} and store them in the database. If the
1849word @samp{replace} is given as the second argument, any existing 1857@samp{replace} parameter is given, any existing records with matching
1850records with matching keys will be replaced. 1858keys will be replaced.
1851@end deffn 1859@end deffn
1852 1860
1853@deffn {command verb} reorganize 1861@deffn {command verb} reorganize
1854@deffnx {command abbrev} reo
1855@deffnx {command letter} r 1862@deffnx {command letter} r
1856Reorganize the database (@pxref{Reorganization}). 1863Reorganize the database (@pxref{Reorganization}).
1857@end deffn 1864@end deffn
1858 1865
1859@deffn {command verb} key-zero 1866@deffn {command verb} key-zero
1860@deffnx {command abbrev} k
1861@deffnx {command letter} z 1867@deffnx {command letter} z
1862Toggle key nul-termination. Use @code{status} to inspect the current 1868Toggle key nul-termination. Use @code{status} to inspect the current
1863state. @xref{nul-termination}. 1869state. @xref{nul-termination}.
1864@end deffn 1870@end deffn
1865 1871
1866@deffn {command verb} avail 1872@deffn {command verb} avail
1867@deffnx {command abbrev} a
1868@deffnx {command letter} A 1873@deffnx {command letter} A
1869Print the @dfn{avail list}. 1874Print the @dfn{avail list}.
1870@end deffn 1875@end deffn
1871 1876
1872@deffn {command verb} bucket 1877@deffn {command verb} bucket
1873@deffnx {command abbrev} b
1874@deffnx {command letter} B 1878@deffnx {command letter} B
1875Print the bucket number @var{num}. 1879Print the bucket number @var{num}.
1876@end deffn 1880@end deffn
1877 1881
1878@deffn {command verb} current 1882@deffn {command verb} current
1879@deffnx {command abbrev} cu
1880@deffnx {command letter} C 1883@deffnx {command letter} C
1881Print the current bucket. 1884Print the current bucket.
1882@end deffn 1885@end deffn
1883 1886
1884@deffn {command verb} dir 1887@deffn {command verb} dir
1885@deffnx {command abbrev} di
1886@deffnx {command letter} D 1888@deffnx {command letter} D
1887Print hash directory. 1889Print hash directory.
1888@end deffn 1890@end deffn
1889 1891
1890@deffn {command verb} header 1892@deffn {command verb} header
1891@deffnx {command abbrev} hea
1892@deffnx {command letter} F 1893@deffnx {command letter} F
1893Print file header. 1894Print file header.
1894@end deffn 1895@end deffn
1895 1896
1896@deffn {command verb} hash @var{key} 1897@deffn {command verb} hash @var{key}
1897@deffnx {command abbrev} ha @var{key}
1898@deffnx {command letter} H @var{key} 1898@deffnx {command letter} H @var{key}
1899Compute and display the hash value for the given @var{key}. 1899Compute and display the hash value for the given @var{key}.
1900@end deffn 1900@end deffn
1901 1901
1902@deffn {command verb} cache 1902@deffn {command verb} cache
1903@deffnx {command abbrev} ca
1904@deffnx {command letter} K 1903@deffnx {command letter} K
1905Print the bucket cache. 1904Print the bucket cache.
1906@end deffn 1905@end deffn
1907 1906
1908@deffn {command verb} status 1907@deffn {command verb} status
1909@deffnx {command abbrev} sta
1910@deffnx {command letter} S 1908@deffnx {command letter} S
1911Print current program status. The following example shows the 1909Print current program status. The following example shows the
1912information displayed: 1910information displayed:
@@ -1919,12 +1917,11 @@ Zero terminated data: yes
1919@end deffn 1917@end deffn
1920 1918
1921@deffn {command verb} version 1919@deffn {command verb} version
1922@deffnx {command abbrev} v 1920@deffnx {command letter} v
1923Print the version of @command{gdbm}. 1921Print the version of @command{gdbm}.
1924@end deffn 1922@end deffn
1925 1923
1926@deffn {command verb} data-zero 1924@deffn {command verb} data-zero
1927@deffnx {command abbrev} da
1928@deffnx {command letter} Z 1925@deffnx {command letter} Z
1929Toggle data nul-termination. Use @code{status} to examine the current 1926Toggle data nul-termination. Use @code{status} to examine the current
1930status. 1927status.
@@ -1933,7 +1930,6 @@ status.
1933@end deffn 1930@end deffn
1934 1931
1935@deffn {command verb} help 1932@deffn {command verb} help
1936@deffnx {command abbrev} hel
1937@deffnx {command letter} ? 1933@deffnx {command letter} ?
1938Print a concise command summary, showing each command letter and verb 1934Print a concise command summary, showing each command letter and verb
1939with its parameters and a short description of what it does. Optional 1935with its parameters and a short description of what it does. Optional

Return to:

Send suggestions and report system problems to the System administrator.