|
|
1.1 root 1: .\" Copyright (c) 1989 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" This code is derived from software contributed to Berkeley by
5: .\" Ken Arnold.
6: .\"
7: .\" Redistribution and use in source and binary forms are permitted provided
8: .\" that: (1) source distributions retain this entire copyright notice and
9: .\" comment, and (2) distributions including binaries display the following
10: .\" acknowledgement: ``This product includes software developed by the
11: .\" University of California, Berkeley and its contributors'' in the
12: .\" documentation or other materials provided with the distribution and in
13: .\" all advertising materials mentioning features or use of this software.
14: .\" Neither the name of the University nor the names of its contributors may
15: .\" be used to endorse or promote products derived from this software without
16: .\" specific prior written permission.
17: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20: .\"
21: .\" @(#)strfile.8 5.8 (Berkeley) 6/24/90
22: .\"
23: .TH STRFILE 8 "June 24, 1990"
24: .UC 4
25: .SH NAME
26: strfile, unstr \- create a random access file for storing strings
27: .SH SYNOPSIS
28: .B strfile [
29: .I \-iorsx
30: .B ] [
31: .I \-c char
32: .B ]
33: .I source_file
34: .B [
35: .I output_file
36: .B ]
37: .br
38: .B unstr
39: .I source_file
40: .SH DESCRIPTION
41: .I Strfile
42: reads a file containing groups of lines separated by a line containing
43: a single percent (``%'') sign and creates a data file which contains
44: a header structure and a table of file offsets for each group of lines.
45: This allows random access of the strings.
46: .PP
47: The output file, if not specified on the command line, is named
48: \fIsource_file\fB.out\fR.
49: .PP
50: The options are as follows:
51: .TP
52: .BI \-c \ char
53: Change the delimiting character from the percent sign to
54: .IR char .
55: .TP
56: .B \-i
57: Ignore case when ordering the strings.
58: .TP
59: .B \-o
60: Order the strings in alphabetical order.
61: The offset table will be sorted in the alphabetical order of the
62: groups of lines referenced.
63: Any initial non-alphanumeric characters are ignored.
64: This option causes the STR_ORDERED bit in the header
65: .I str_flags
66: field to be set.
67: .TP
68: .B \-r
69: Randomize access to the strings.
70: Entries in the offset table will be randomly ordered.
71: This option causes the STR_RANDOM bit in the header
72: .I str_flags
73: field to be set.
74: .TP
75: .B \-s
76: Run silently; don't give a summary message when finished.
77: .TP
78: .B \-x
79: Note that each alphabetic character in the groups of lines is rotated
80: 13 positions in a simple caesar cypher.
81: This option causes the STR_ROTATED bit in the header
82: .I str_flags
83: field to be set.
84: .PP
85: The format of the header is:
86: .in +5
87: .nf
88: #define VERSION 1
89: unsigned long str_version; /* version number */
90: unsigned long str_numstr; /* # of strings in the file */
91: unsigned long str_longlen; /* length of longest string */
92: unsigned long str_shortlen; /* length of shortest string */
93: #define STR_RANDOM 0x1 /* randomized pointers */
94: #define STR_ORDERED 0x2 /* ordered pointers */
95: #define STR_ROTATED 0x4 /* rot-13'd text */
96: unsigned long str_flags; /* bit field for flags */
97: char str_delim; /* delimiting character */
98: .fi
99: .PP
100: All fields are written in network byte order.
101: .PP
102: The purpose of
103: .I unstr
104: is to undo the work of
105: .IR strfile .
106: It prints out the strings contained in the file
107: .I source_file
108: in the order that they are listed in
109: the header file
110: .IB source_file .dat
111: to standard output.
112: It is possible to create sorted versions of input files by using
113: .B \-o
114: when
115: .I strfile
116: is run and then using
117: .I unstr
118: to dump them out in the table order.
119: .SH "SEE ALSO"
120: byteorder(3), fortune(6)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.