Category : Linux Files
Archive   : UTILA10S.ZIP
Filename : UTILA10S.TAR

 
Output of file : UTILA10S.TAR contained in archive : UTILA10S.ZIP
src/utila-1.0/ 700 0 0 0 5225351322 11162 5ustar rootrootsrc/utila-1.0/banner.c 600 0 0 222112 5225143235 12717 0ustar rootroot/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)banner.c 4.3 (Berkeley) 6/1/90";
#endif /* not lint */

/*
* banner - prints large signs
* banner [-w#] [-d] [-t] message ...
*/

#include

#define MAXMSG 1024
#define DWIDTH 132
#define NCHARS 128
#define NBYTES 9271

/* Pointers into data_table for each ASCII char */
int asc_ptr[NCHARS] = {
/* ^@ */ 0, 0, 0, 0, 0, 0, 0, 0,
/* ^H */ 0, 0, 0, 0, 0, 0, 0, 0,
/* ^P */ 0, 0, 0, 0, 0, 0, 0, 0,
/* ^X */ 0, 0, 0, 0, 0, 0, 0, 0,
/* */ 1, 3, 50, 81, 104, 281, 483, 590,
/* ( */ 621, 685, 749, 851, 862, 893, 898, 921,
/* 0 */1019, 1150, 1200, 1419, 1599, 1744, 1934, 2111,
/* 8 */2235, 2445, 2622, 2659, 0, 2708, 0, 2715,
/* @ */2857, 3072, 3273, 3403, 3560, 3662, 3730, 3785,
/* H */3965, 4000, 4015, 4115, 4281, 4314, 4432, 4548,
/* P */4709, 4790, 4999, 5188, 5397, 5448, 5576, 5710,
/* X */5892, 6106, 6257, 0, 0, 0, 0, 0,
/* ` */ 50, 6503, 6642, 6733, 6837, 6930, 7073, 7157,
/* h */7380, 7452, 7499, 7584, 7689, 7702, 7797, 7869,
/* p */7978, 8069, 8160, 8222, 8381, 8442, 8508, 8605,
/* x */8732, 8888, 9016, 0, 0, 0, 0, 0
};

/*
* Table of stuff to print. Format:
* 128+n -> print current line n times.
* 64+n -> this is last byte of char.
* else, put m chars at position n (where m
* is the next elt in array) and goto second
* next element in array.
*/
char data_table[NBYTES] = {
/* 0 1 2 3 4 5 6 7 8 9 */
/* 0 */ 129, 227, 130, 34, 6, 90, 19, 129, 32, 10,
/* 10 */ 74, 40, 129, 31, 12, 64, 53, 129, 30, 14,
/* 20 */ 54, 65, 129, 30, 14, 53, 67, 129, 30, 14,
/* 30 */ 54, 65, 129, 31, 12, 64, 53, 129, 32, 10,
/* 40 */ 74, 40, 129, 34, 6, 90, 19, 129, 194, 130,
/* 50 */ 99, 9, 129, 97, 14, 129, 96, 18, 129, 95,
/* 60 */ 22, 129, 95, 16, 117, 2, 129, 95, 14, 129,
/* 70 */ 96, 11, 129, 97, 9, 129, 99, 6, 129, 194,
/* 80 */ 129, 87, 4, 101, 4, 131, 82, 28, 131, 87,
/* 90 */ 4, 101, 4, 133, 82, 28, 131, 87, 4, 101,
/* 100 */ 4, 131, 193, 129, 39, 1, 84, 27, 129, 38,
/* 110 */ 3, 81, 32, 129, 37, 5, 79, 35, 129, 36,
/* 120 */ 5, 77, 38, 129, 35, 5, 76, 40, 129, 34,
/* 130 */ 5, 75, 21, 103, 14, 129, 33, 5, 74, 19,
/* 140 */ 107, 11, 129, 32, 5, 73, 17, 110, 9, 129,
/* 150 */ 32, 4, 73, 16, 112, 7, 129, 31, 4, 72,
/* 160 */ 15, 114, 6, 129, 31, 4, 72, 14, 115, 5,
/* 170 */ 129, 30, 4, 71, 15, 116, 5, 129, 27, 97,
/* 180 */ 131, 30, 4, 69, 14, 117, 4, 129, 30, 4,
/* 190 */ 68, 15, 117, 4, 132, 30, 4, 68, 14, 117,
/* 200 */ 4, 129, 27, 97, 131, 30, 5, 65, 15, 116,
/* 210 */ 5, 129, 31, 4, 65, 14, 116, 4, 129, 31,
/* 220 */ 6, 64, 15, 116, 4, 129, 32, 7, 62, 16,
/* 230 */ 115, 4, 129, 32, 9, 61, 17, 114, 5, 129,
/* 240 */ 33, 11, 58, 19, 113, 5, 129, 34, 14, 55,
/* 250 */ 21, 112, 5, 129, 35, 40, 111, 5, 129, 36,
/* 260 */ 38, 110, 5, 129, 37, 35, 109, 5, 129, 38,
/* 270 */ 32, 110, 3, 129, 40, 27, 111, 1, 129, 193,
/* 280 */ 129, 30, 4, 103, 9, 129, 30, 7, 100, 15,
/* 290 */ 129, 30, 10, 99, 17, 129, 33, 10, 97, 6,
/* 300 */ 112, 6, 129, 36, 10, 96, 5, 114, 5, 129,
/* 310 */ 39, 10, 96, 4, 115, 4, 129, 42, 10, 95,
/* 320 */ 4, 116, 4, 129, 45, 10, 95, 3, 117, 3,
/* 330 */ 129, 48, 10, 95, 3, 117, 3, 129, 51, 10,
/* 340 */ 95, 4, 116, 4, 129, 54, 10, 96, 4, 115,
/* 350 */ 4, 129, 57, 10, 96, 5, 114, 5, 129, 60,
/* 360 */ 10, 97, 6, 112, 6, 129, 63, 10, 99, 17,
/* 370 */ 129, 66, 10, 100, 15, 129, 69, 10, 103, 9,
/* 380 */ 129, 39, 9, 72, 10, 129, 36, 15, 75, 10,
/* 390 */ 129, 35, 17, 78, 10, 129, 33, 6, 48, 6,
/* 400 */ 81, 10, 129, 32, 5, 50, 5, 84, 10, 129,
/* 410 */ 32, 4, 51, 4, 87, 10, 129, 31, 4, 52,
/* 420 */ 4, 90, 10, 129, 31, 3, 53, 3, 93, 10,
/* 430 */ 129, 31, 3, 53, 3, 96, 10, 129, 31, 4,
/* 440 */ 52, 4, 99, 10, 129, 32, 4, 51, 4, 102,
/* 450 */ 10, 129, 32, 5, 50, 5, 105, 10, 129, 33,
/* 460 */ 6, 48, 6, 108, 10, 129, 35, 17, 111, 10,
/* 470 */ 129, 36, 15, 114, 7, 129, 40, 9, 118, 4,
/* 480 */ 129, 193, 129, 48, 18, 129, 43, 28, 129, 41,
/* 490 */ 32, 129, 39, 36, 129, 37, 40, 129, 35, 44,
/* 500 */ 129, 34, 46, 129, 33, 13, 68, 13, 129, 32,
/* 510 */ 9, 73, 9, 129, 32, 7, 75, 7, 129, 31,
/* 520 */ 6, 77, 6, 129, 31, 5, 78, 5, 129, 30,
/* 530 */ 5, 79, 5, 129, 20, 74, 132, 30, 4, 80,
/* 540 */ 4, 129, 31, 3, 79, 4, 129, 31, 4, 79,
/* 550 */ 4, 129, 32, 3, 78, 4, 129, 32, 4, 76,
/* 560 */ 6, 129, 33, 4, 74, 7, 129, 34, 4, 72,
/* 570 */ 8, 129, 35, 5, 72, 7, 129, 37, 5, 73,
/* 580 */ 4, 129, 39, 4, 74, 1, 129, 129, 193, 130,
/* 590 */ 111, 6, 129, 109, 10, 129, 108, 12, 129, 107,
/* 600 */ 14, 129, 97, 2, 105, 16, 129, 99, 22, 129,
/* 610 */ 102, 18, 129, 105, 14, 129, 108, 9, 129, 194,
/* 620 */ 130, 63, 25, 129, 57, 37, 129, 52, 47, 129,
/* 630 */ 48, 55, 129, 44, 63, 129, 41, 69, 129, 38,
/* 640 */ 75, 129, 36, 79, 129, 34, 83, 129, 33, 28,
/* 650 */ 90, 28, 129, 32, 23, 96, 23, 129, 32, 17,
/* 660 */ 102, 17, 129, 31, 13, 107, 13, 129, 30, 9,
/* 670 */ 112, 9, 129, 30, 5, 116, 5, 129, 30, 1,
/* 680 */ 120, 1, 129, 194, 130, 30, 1, 120, 1, 129,
/* 690 */ 30, 5, 116, 5, 129, 30, 9, 112, 9, 129,
/* 700 */ 31, 13, 107, 13, 129, 32, 17, 102, 17, 129,
/* 710 */ 32, 23, 96, 23, 129, 33, 28, 90, 28, 129,
/* 720 */ 34, 83, 129, 36, 79, 129, 38, 75, 129, 41,
/* 730 */ 69, 129, 44, 63, 129, 48, 55, 129, 52, 47,
/* 740 */ 129, 57, 37, 129, 63, 25, 129, 194, 129, 80,
/* 750 */ 4, 130, 80, 4, 129, 68, 2, 80, 4, 94,
/* 760 */ 2, 129, 66, 6, 80, 4, 92, 6, 129, 67,
/* 770 */ 7, 80, 4, 90, 7, 129, 69, 7, 80, 4,
/* 780 */ 88, 7, 129, 71, 6, 80, 4, 87, 6, 129,
/* 790 */ 72, 20, 129, 74, 16, 129, 76, 12, 129, 62,
/* 800 */ 40, 131, 76, 12, 129, 74, 16, 129, 72, 20,
/* 810 */ 129, 71, 6, 80, 4, 87, 6, 129, 69, 7,
/* 820 */ 80, 4, 88, 7, 129, 67, 7, 80, 4, 90,
/* 830 */ 7, 129, 66, 6, 80, 4, 92, 6, 129, 68,
/* 840 */ 2, 80, 4, 94, 2, 129, 80, 4, 130, 193,
/* 850 */ 129, 60, 4, 139, 41, 42, 131, 60, 4, 139,
/* 860 */ 193, 130, 34, 6, 129, 32, 10, 129, 31, 12,
/* 870 */ 129, 30, 14, 129, 20, 2, 28, 16, 129, 22,
/* 880 */ 22, 129, 24, 19, 129, 27, 15, 129, 31, 9,
/* 890 */ 129, 194, 129, 60, 4, 152, 193, 130, 34, 6,
/* 900 */ 129, 32, 10, 129, 31, 12, 129, 30, 14, 131,
/* 910 */ 31, 12, 129, 32, 10, 129, 34, 6, 129, 194,
/* 920 */ 129, 30, 4, 129, 30, 7, 129, 30, 10, 129,
/* 930 */ 33, 10, 129, 36, 10, 129, 39, 10, 129, 42,
/* 940 */ 10, 129, 45, 10, 129, 48, 10, 129, 51, 10,
/* 950 */ 129, 54, 10, 129, 57, 10, 129, 60, 10, 129,
/* 960 */ 63, 10, 129, 66, 10, 129, 69, 10, 129, 72,
/* 970 */ 10, 129, 75, 10, 129, 78, 10, 129, 81, 10,
/* 980 */ 129, 84, 10, 129, 87, 10, 129, 90, 10, 129,
/* 990 */ 93, 10, 129, 96, 10, 129, 99, 10, 129, 102,
/* 1000 */ 10, 129, 105, 10, 129, 108, 10, 129, 111, 10,
/* 1010 */ 129, 114, 7, 129, 117, 4, 129, 193, 129, 60,
/* 1020 */ 31, 129, 53, 45, 129, 49, 53, 129, 46, 59,
/* 1030 */ 129, 43, 65, 129, 41, 69, 129, 39, 73, 129,
/* 1040 */ 37, 77, 129, 36, 79, 129, 35, 15, 101, 15,
/* 1050 */ 129, 34, 11, 106, 11, 129, 33, 9, 109, 9,
/* 1060 */ 129, 32, 7, 112, 7, 129, 31, 6, 114, 6,
/* 1070 */ 129, 31, 5, 115, 5, 129, 30, 5, 116, 5,
/* 1080 */ 129, 30, 4, 117, 4, 132, 30, 5, 116, 5,
/* 1090 */ 129, 31, 5, 115, 5, 129, 31, 6, 114, 6,
/* 1100 */ 129, 32, 7, 112, 7, 129, 33, 9, 109, 9,
/* 1110 */ 129, 34, 11, 106, 11, 129, 35, 15, 101, 15,
/* 1120 */ 129, 36, 79, 129, 37, 77, 129, 39, 73, 129,
/* 1130 */ 41, 69, 129, 43, 65, 129, 46, 59, 129, 49,
/* 1140 */ 53, 129, 53, 45, 129, 60, 31, 129, 193, 129,
/* 1150 */ 30, 4, 129, 30, 4, 100, 1, 129, 30, 4,
/* 1160 */ 100, 3, 129, 30, 4, 100, 5, 129, 30, 76,
/* 1170 */ 129, 30, 78, 129, 30, 80, 129, 30, 82, 129,
/* 1180 */ 30, 83, 129, 30, 85, 129, 30, 87, 129, 30,
/* 1190 */ 89, 129, 30, 91, 129, 30, 4, 132, 193, 129,
/* 1200 */ 30, 3, 129, 30, 7, 129, 30, 10, 112, 1,
/* 1210 */ 129, 30, 13, 112, 2, 129, 30, 16, 112, 3,
/* 1220 */ 129, 30, 18, 111, 5, 129, 30, 21, 111, 6,
/* 1230 */ 129, 30, 23, 112, 6, 129, 30, 14, 47, 8,
/* 1240 */ 113, 6, 129, 30, 14, 49, 8, 114, 5, 129,
/* 1250 */ 30, 14, 51, 8, 115, 5, 129, 30, 14, 53,
/* 1260 */ 8, 116, 4, 129, 30, 14, 55, 8, 116, 5,
/* 1270 */ 129, 30, 14, 56, 9, 117, 4, 129, 30, 14,
/* 1280 */ 57, 9, 117, 4, 129, 30, 14, 58, 10, 117,
/* 1290 */ 4, 129, 30, 14, 59, 10, 117, 4, 129, 30,
/* 1300 */ 14, 60, 11, 117, 4, 129, 30, 14, 61, 11,
/* 1310 */ 116, 5, 129, 30, 14, 62, 11, 116, 5, 129,
/* 1320 */ 30, 14, 63, 12, 115, 6, 129, 30, 14, 64,
/* 1330 */ 13, 114, 7, 129, 30, 14, 65, 13, 113, 8,
/* 1340 */ 129, 30, 14, 65, 15, 111, 9, 129, 30, 14,
/* 1350 */ 66, 16, 109, 11, 129, 30, 14, 67, 17, 107,
/* 1360 */ 12, 129, 30, 14, 68, 20, 103, 16, 129, 30,
/* 1370 */ 14, 69, 49, 129, 30, 14, 70, 47, 129, 30,
/* 1380 */ 14, 71, 45, 129, 30, 14, 73, 42, 129, 30,
/* 1390 */ 15, 75, 38, 129, 33, 12, 77, 34, 129, 36,
/* 1400 */ 10, 79, 30, 129, 40, 6, 82, 23, 129, 44,
/* 1410 */ 3, 86, 15, 129, 47, 1, 129, 193, 129, 129,
/* 1420 */ 38, 3, 129, 37, 5, 111, 1, 129, 36, 7,
/* 1430 */ 111, 2, 129, 35, 9, 110, 5, 129, 34, 8,
/* 1440 */ 110, 6, 129, 33, 7, 109, 8, 129, 32, 7,
/* 1450 */ 110, 8, 129, 32, 6, 112, 7, 129, 31, 6,
/* 1460 */ 113, 6, 129, 31, 5, 114, 6, 129, 30, 5,
/* 1470 */ 115, 5, 129, 30, 5, 116, 4, 129, 30, 4,
/* 1480 */ 117, 4, 131, 30, 4, 117, 4, 129, 30, 4,
/* 1490 */ 79, 2, 117, 4, 129, 30, 5, 78, 4, 117,
/* 1500 */ 4, 129, 30, 5, 77, 6, 116, 5, 129, 30,
/* 1510 */ 6, 76, 8, 115, 6, 129, 30, 7, 75, 11,
/* 1520 */ 114, 6, 129, 30, 8, 73, 15, 112, 8, 129,
/* 1530 */ 31, 9, 71, 19, 110, 9, 129, 31, 11, 68,
/* 1540 */ 26, 107, 12, 129, 32, 13, 65, 14, 82, 36,
/* 1550 */ 129, 32, 16, 61, 17, 83, 34, 129, 33, 44,
/* 1560 */ 84, 32, 129, 34, 42, 85, 30, 129, 35, 40,
/* 1570 */ 87, 27, 129, 36, 38, 89, 23, 129, 38, 34,
/* 1580 */ 92, 17, 129, 40, 30, 95, 11, 129, 42, 26,
/* 1590 */ 129, 45, 20, 129, 49, 11, 129, 193, 129, 49,
/* 1600 */ 1, 129, 49, 4, 129, 49, 6, 129, 49, 8,
/* 1610 */ 129, 49, 10, 129, 49, 12, 129, 49, 14, 129,
/* 1620 */ 49, 17, 129, 49, 19, 129, 49, 21, 129, 49,
/* 1630 */ 23, 129, 49, 14, 65, 9, 129, 49, 14, 67,
/* 1640 */ 9, 129, 49, 14, 69, 9, 129, 49, 14, 71,
/* 1650 */ 10, 129, 49, 14, 74, 9, 129, 49, 14, 76,
/* 1660 */ 9, 129, 49, 14, 78, 9, 129, 49, 14, 80,
/* 1670 */ 9, 129, 49, 14, 82, 9, 129, 49, 14, 84,
/* 1680 */ 9, 129, 30, 4, 49, 14, 86, 10, 129, 30,
/* 1690 */ 4, 49, 14, 89, 9, 129, 30, 4, 49, 14,
/* 1700 */ 91, 9, 129, 30, 4, 49, 14, 93, 9, 129,
/* 1710 */ 30, 74, 129, 30, 76, 129, 30, 78, 129, 30,
/* 1720 */ 81, 129, 30, 83, 129, 30, 85, 129, 30, 87,
/* 1730 */ 129, 30, 89, 129, 30, 91, 129, 30, 4, 49,
/* 1740 */ 14, 132, 193, 129, 37, 1, 129, 36, 3, 77,
/* 1750 */ 3, 129, 35, 5, 78, 11, 129, 34, 7, 78,
/* 1760 */ 21, 129, 33, 7, 79, 29, 129, 32, 7, 79,
/* 1770 */ 38, 129, 32, 6, 80, 4, 92, 29, 129, 31,
/* 1780 */ 6, 80, 5, 102, 19, 129, 31, 5, 80, 6,
/* 1790 */ 107, 14, 129, 31, 4, 81, 5, 107, 14, 129,
/* 1800 */ 30, 5, 81, 6, 107, 14, 129, 30, 4, 81,
/* 1810 */ 6, 107, 14, 130, 30, 4, 81, 7, 107, 14,
/* 1820 */ 129, 30, 4, 80, 8, 107, 14, 130, 30, 5,
/* 1830 */ 80, 8, 107, 14, 129, 30, 5, 79, 9, 107,
/* 1840 */ 14, 129, 31, 5, 79, 9, 107, 14, 129, 31,
/* 1850 */ 6, 78, 10, 107, 14, 129, 32, 6, 76, 11,
/* 1860 */ 107, 14, 129, 32, 8, 74, 13, 107, 14, 129,
/* 1870 */ 33, 10, 71, 16, 107, 14, 129, 33, 15, 67,
/* 1880 */ 19, 107, 14, 129, 34, 51, 107, 14, 129, 35,
/* 1890 */ 49, 107, 14, 129, 36, 47, 107, 14, 129, 37,
/* 1900 */ 45, 107, 14, 129, 39, 41, 107, 14, 129, 41,
/* 1910 */ 37, 107, 14, 129, 44, 32, 107, 14, 129, 47,
/* 1920 */ 25, 111, 10, 129, 51, 16, 115, 6, 129, 119,
/* 1930 */ 2, 129, 193, 129, 56, 39, 129, 51, 49, 129,
/* 1940 */ 47, 57, 129, 44, 63, 129, 42, 67, 129, 40,
/* 1950 */ 71, 129, 38, 75, 129, 37, 77, 129, 35, 81,
/* 1960 */ 129, 34, 16, 74, 5, 101, 16, 129, 33, 11,
/* 1970 */ 76, 5, 107, 11, 129, 32, 9, 77, 5, 110,
/* 1980 */ 9, 129, 32, 7, 79, 4, 112, 7, 129, 31,
/* 1990 */ 6, 80, 4, 114, 6, 129, 31, 5, 81, 4,
/* 2000 */ 115, 5, 129, 30, 5, 82, 4, 116, 5, 129,
/* 2010 */ 30, 4, 82, 4, 116, 5, 129, 30, 4, 82,
/* 2020 */ 5, 117, 4, 131, 30, 5, 82, 5, 117, 4,
/* 2030 */ 129, 31, 5, 81, 6, 117, 4, 129, 31, 6,
/* 2040 */ 80, 7, 117, 4, 129, 32, 7, 79, 8, 117,
/* 2050 */ 4, 129, 32, 9, 77, 9, 116, 5, 129, 33,
/* 2060 */ 11, 75, 11, 116, 4, 129, 34, 16, 69, 16,
/* 2070 */ 115, 5, 129, 35, 49, 114, 5, 129, 37, 46,
/* 2080 */ 113, 5, 129, 38, 44, 112, 6, 129, 40, 41,
/* 2090 */ 112, 5, 129, 42, 37, 113, 3, 129, 44, 33,
/* 2100 */ 114, 1, 129, 47, 27, 129, 51, 17, 129, 193,
/* 2110 */ 129, 103, 2, 129, 103, 6, 129, 104, 9, 129,
/* 2120 */ 105, 12, 129, 106, 15, 129, 107, 14, 135, 30,
/* 2130 */ 10, 107, 14, 129, 30, 17, 107, 14, 129, 30,
/* 2140 */ 25, 107, 14, 129, 30, 31, 107, 14, 129, 30,
/* 2150 */ 37, 107, 14, 129, 30, 42, 107, 14, 129, 30,
/* 2160 */ 46, 107, 14, 129, 30, 50, 107, 14, 129, 30,
/* 2170 */ 54, 107, 14, 129, 30, 58, 107, 14, 129, 59,
/* 2180 */ 32, 107, 14, 129, 64, 30, 107, 14, 129, 74,
/* 2190 */ 23, 107, 14, 129, 81, 18, 107, 14, 129, 86,
/* 2200 */ 16, 107, 14, 129, 91, 14, 107, 14, 129, 96,
/* 2210 */ 25, 129, 100, 21, 129, 104, 17, 129, 107, 14,
/* 2220 */ 129, 111, 10, 129, 114, 7, 129, 117, 4, 129,
/* 2230 */ 120, 1, 129, 193, 129, 48, 13, 129, 44, 21,
/* 2240 */ 129, 42, 26, 129, 40, 30, 92, 12, 129, 38,
/* 2250 */ 34, 88, 20, 129, 36, 37, 86, 25, 129, 35,
/* 2260 */ 39, 84, 29, 129, 34, 13, 63, 12, 82, 33,
/* 2270 */ 129, 33, 11, 67, 9, 80, 36, 129, 32, 9,
/* 2280 */ 70, 7, 79, 38, 129, 31, 8, 72, 46, 129,
/* 2290 */ 30, 7, 74, 22, 108, 11, 129, 30, 6, 75,
/* 2300 */ 19, 111, 9, 129, 30, 5, 75, 17, 113, 7,
/* 2310 */ 129, 30, 5, 74, 16, 114, 6, 129, 30, 4,
/* 2320 */ 73, 16, 115, 6, 129, 30, 4, 72, 16, 116,
/* 2330 */ 5, 129, 30, 4, 72, 15, 117, 4, 129, 30,
/* 2340 */ 4, 71, 16, 117, 4, 129, 30, 5, 70, 16,
/* 2350 */ 117, 4, 129, 30, 5, 70, 15, 117, 4, 129,
/* 2360 */ 30, 6, 69, 15, 116, 5, 129, 30, 7, 68,
/* 2370 */ 17, 115, 5, 129, 30, 9, 67, 19, 114, 6,
/* 2380 */ 129, 30, 10, 65, 22, 113, 6, 129, 31, 12,
/* 2390 */ 63, 27, 110, 9, 129, 32, 14, 60, 21, 84,
/* 2400 */ 9, 106, 12, 129, 33, 47, 85, 32, 129, 34,
/* 2410 */ 45, 86, 30, 129, 35, 43, 88, 26, 129, 36,
/* 2420 */ 40, 90, 22, 129, 38, 36, 93, 17, 129, 40,
/* 2430 */ 32, 96, 10, 129, 42, 28, 129, 44, 23, 129,
/* 2440 */ 48, 15, 129, 193, 129, 83, 17, 129, 77, 27,
/* 2450 */ 129, 36, 1, 74, 33, 129, 35, 3, 72, 37,
/* 2460 */ 129, 34, 5, 70, 41, 129, 33, 6, 69, 44,
/* 2470 */ 129, 33, 5, 68, 46, 129, 32, 5, 67, 49,
/* 2480 */ 129, 31, 5, 66, 17, 101, 16, 129, 31, 5,
/* 2490 */ 66, 11, 108, 10, 129, 30, 4, 65, 9, 110,
/* 2500 */ 9, 129, 30, 4, 64, 8, 112, 7, 129, 30,
/* 2510 */ 4, 64, 7, 114, 6, 129, 30, 4, 64, 6,
/* 2520 */ 115, 5, 129, 30, 4, 64, 5, 116, 5, 129,
/* 2530 */ 30, 4, 64, 5, 117, 4, 131, 30, 4, 65,
/* 2540 */ 4, 117, 4, 129, 30, 5, 65, 4, 116, 5,
/* 2550 */ 129, 31, 5, 66, 4, 115, 5, 129, 31, 6,
/* 2560 */ 67, 4, 114, 6, 129, 32, 7, 68, 4, 112,
/* 2570 */ 7, 129, 32, 9, 69, 5, 110, 9, 129, 33,
/* 2580 */ 11, 70, 5, 107, 11, 129, 34, 16, 72, 5,
/* 2590 */ 101, 16, 129, 35, 81, 129, 37, 77, 129, 38,
/* 2600 */ 75, 129, 40, 71, 129, 42, 67, 129, 44, 63,
/* 2610 */ 129, 47, 57, 129, 51, 49, 129, 56, 39, 129,
/* 2620 */ 193, 130, 34, 6, 74, 6, 129, 32, 10, 72,
/* 2630 */ 10, 129, 31, 12, 71, 12, 129, 30, 14, 70,
/* 2640 */ 14, 131, 31, 12, 71, 12, 129, 32, 10, 72,
/* 2650 */ 10, 129, 34, 6, 74, 6, 129, 194, 130, 34,
/* 2660 */ 6, 74, 6, 129, 32, 10, 72, 10, 129, 31,
/* 2670 */ 12, 71, 12, 129, 30, 14, 70, 14, 129, 20,
/* 2680 */ 2, 28, 16, 70, 14, 129, 22, 22, 70, 14,
/* 2690 */ 129, 24, 19, 71, 12, 129, 27, 15, 72, 10,
/* 2700 */ 129, 31, 9, 74, 6, 129, 194, 129, 53, 4,
/* 2710 */ 63, 4, 152, 193, 130, 99, 7, 129, 97, 13,
/* 2720 */ 129, 96, 16, 129, 96, 18, 129, 96, 19, 129,
/* 2730 */ 97, 19, 129, 99, 6, 110, 7, 129, 112, 6,
/* 2740 */ 129, 114, 5, 129, 34, 6, 57, 5, 115, 4,
/* 2750 */ 129, 32, 10, 54, 12, 116, 4, 129, 31, 12,
/* 2760 */ 53, 16, 117, 3, 129, 30, 14, 52, 20, 117,
/* 2770 */ 4, 129, 30, 14, 52, 23, 117, 4, 129, 30,
/* 2780 */ 14, 52, 25, 117, 4, 129, 31, 12, 52, 27,
/* 2790 */ 117, 4, 129, 32, 10, 53, 10, 70, 11, 116,
/* 2800 */ 5, 129, 34, 6, 55, 5, 73, 10, 115, 6,
/* 2810 */ 129, 74, 11, 114, 7, 129, 75, 12, 112, 9,
/* 2820 */ 129, 76, 13, 110, 10, 129, 77, 16, 106, 14,
/* 2830 */ 129, 78, 41, 129, 80, 38, 129, 81, 36, 129,
/* 2840 */ 82, 34, 129, 84, 30, 129, 86, 26, 129, 88,
/* 2850 */ 22, 129, 92, 14, 129, 194, 129, 55, 15, 129,
/* 2860 */ 50, 25, 129, 47, 32, 129, 45, 13, 70, 12,
/* 2870 */ 129, 43, 9, 76, 10, 129, 42, 6, 79, 8,
/* 2880 */ 129, 41, 5, 81, 7, 129, 40, 4, 84, 6,
/* 2890 */ 129, 39, 4, 59, 12, 85, 6, 129, 38, 4,
/* 2900 */ 55, 19, 87, 5, 129, 37, 4, 53, 23, 88,
/* 2910 */ 4, 129, 36, 4, 51, 8, 71, 6, 89, 4,
/* 2920 */ 129, 36, 4, 51, 6, 73, 4, 89, 4, 129,
/* 2930 */ 36, 4, 50, 6, 74, 4, 90, 3, 129, 35,
/* 2940 */ 4, 50, 5, 75, 3, 90, 4, 129, 35, 4,
/* 2950 */ 50, 4, 75, 4, 90, 4, 131, 35, 4, 50,
/* 2960 */ 5, 75, 4, 90, 4, 129, 36, 4, 51, 5,
/* 2970 */ 75, 4, 90, 4, 129, 36, 4, 51, 6, 75,
/* 2980 */ 4, 90, 4, 129, 36, 4, 53, 26, 90, 4,
/* 2990 */ 129, 37, 4, 54, 25, 90, 4, 129, 37, 4,
/* 3000 */ 52, 27, 90, 3, 129, 38, 4, 52, 4, 89,
/* 3010 */ 4, 129, 39, 4, 51, 4, 88, 4, 129, 40,
/* 3020 */ 4, 50, 4, 87, 5, 129, 41, 4, 50, 4,
/* 3030 */ 86, 5, 129, 42, 4, 50, 4, 85, 5, 129,
/* 3040 */ 43, 3, 50, 4, 83, 6, 129, 44, 2, 51,
/* 3050 */ 5, 80, 7, 129, 46, 1, 52, 6, 76, 9,
/* 3060 */ 129, 54, 28, 129, 56, 23, 129, 60, 16, 129,
/* 3070 */ 193, 129, 30, 4, 132, 30, 5, 129, 30, 8,
/* 3080 */ 129, 30, 12, 129, 30, 16, 129, 30, 4, 37,
/* 3090 */ 12, 129, 30, 4, 41, 12, 129, 30, 4, 44,
/* 3100 */ 13, 129, 30, 4, 48, 13, 129, 52, 13, 129,
/* 3110 */ 56, 12, 129, 58, 14, 129, 58, 4, 64, 12,
/* 3120 */ 129, 58, 4, 68, 12, 129, 58, 4, 72, 12,
/* 3130 */ 129, 58, 4, 75, 13, 129, 58, 4, 79, 13,
/* 3140 */ 129, 58, 4, 83, 13, 129, 58, 4, 87, 13,
/* 3150 */ 129, 58, 4, 91, 12, 129, 58, 4, 95, 12,
/* 3160 */ 129, 58, 4, 96, 15, 129, 58, 4, 93, 22,
/* 3170 */ 129, 58, 4, 89, 30, 129, 58, 4, 85, 36,
/* 3180 */ 129, 58, 4, 81, 38, 129, 58, 4, 77, 38,
/* 3190 */ 129, 58, 4, 73, 38, 129, 58, 4, 70, 37,
/* 3200 */ 129, 58, 4, 66, 37, 129, 58, 41, 129, 58,
/* 3210 */ 37, 129, 54, 38, 129, 30, 4, 50, 38, 129,
/* 3220 */ 30, 4, 46, 38, 129, 30, 4, 42, 38, 129,
/* 3230 */ 30, 4, 38, 39, 129, 30, 43, 129, 30, 39,
/* 3240 */ 129, 30, 35, 129, 30, 31, 129, 30, 27, 129,
/* 3250 */ 30, 24, 129, 30, 20, 129, 30, 16, 129, 30,
/* 3260 */ 12, 129, 30, 8, 129, 30, 5, 129, 30, 4,
/* 3270 */ 132, 193, 129, 30, 4, 117, 4, 132, 30, 91,
/* 3280 */ 137, 30, 4, 80, 4, 117, 4, 138, 30, 4,
/* 3290 */ 80, 5, 116, 5, 129, 30, 5, 79, 6, 116,
/* 3300 */ 5, 130, 30, 6, 78, 8, 115, 6, 129, 31,
/* 3310 */ 6, 77, 9, 115, 6, 129, 31, 7, 76, 11,
/* 3320 */ 114, 6, 129, 31, 8, 75, 14, 112, 8, 129,
/* 3330 */ 32, 8, 74, 16, 111, 9, 129, 32, 9, 73,
/* 3340 */ 19, 109, 10, 129, 33, 10, 71, 24, 106, 13,
/* 3350 */ 129, 33, 13, 68, 12, 83, 35, 129, 34, 16,
/* 3360 */ 64, 15, 84, 33, 129, 35, 43, 85, 31, 129,
/* 3370 */ 36, 41, 86, 29, 129, 37, 39, 88, 25, 129,
/* 3380 */ 38, 37, 90, 21, 129, 40, 33, 93, 15, 129,
/* 3390 */ 42, 29, 96, 9, 129, 45, 24, 129, 49, 16,
/* 3400 */ 129, 193, 129, 63, 25, 129, 57, 37, 129, 53,
/* 3410 */ 45, 129, 50, 51, 129, 47, 57, 129, 45, 61,
/* 3420 */ 129, 43, 65, 129, 41, 69, 129, 39, 73, 129,
/* 3430 */ 38, 25, 92, 21, 129, 36, 21, 97, 18, 129,
/* 3440 */ 35, 18, 102, 14, 129, 34, 16, 106, 11, 129,
/* 3450 */ 33, 14, 108, 10, 129, 32, 12, 111, 8, 129,
/* 3460 */ 32, 10, 113, 6, 129, 31, 10, 114, 6, 129,
/* 3470 */ 31, 8, 115, 5, 129, 30, 8, 116, 5, 129,
/* 3480 */ 30, 7, 116, 5, 129, 30, 6, 117, 4, 130,
/* 3490 */ 30, 5, 117, 4, 131, 31, 4, 116, 5, 129,
/* 3500 */ 32, 4, 116, 4, 129, 32, 5, 115, 5, 129,
/* 3510 */ 33, 4, 114, 5, 129, 34, 4, 112, 6, 129,
/* 3520 */ 35, 4, 110, 7, 129, 37, 4, 107, 9, 129,
/* 3530 */ 39, 4, 103, 12, 129, 41, 4, 103, 18, 129,
/* 3540 */ 43, 4, 103, 18, 129, 45, 5, 103, 18, 129,
/* 3550 */ 48, 5, 103, 18, 129, 51, 1, 129, 193, 129,
/* 3560 */ 30, 4, 117, 4, 132, 30, 91, 137, 30, 4,
/* 3570 */ 117, 4, 135, 30, 5, 116, 5, 130, 30, 6,
/* 3580 */ 115, 6, 130, 31, 6, 114, 6, 129, 31, 7,
/* 3590 */ 113, 7, 129, 32, 7, 112, 7, 129, 32, 8,
/* 3600 */ 111, 8, 129, 33, 9, 109, 9, 129, 33, 12,
/* 3610 */ 106, 12, 129, 34, 13, 104, 13, 129, 35, 15,
/* 3620 */ 101, 15, 129, 36, 19, 96, 19, 129, 37, 24,
/* 3630 */ 90, 24, 129, 39, 73, 129, 40, 71, 129, 42,
/* 3640 */ 67, 129, 44, 63, 129, 46, 59, 129, 49, 53,
/* 3650 */ 129, 52, 47, 129, 56, 39, 129, 61, 29, 129,
/* 3660 */ 193, 129, 30, 4, 117, 4, 132, 30, 91, 137,
/* 3670 */ 30, 4, 80, 4, 117, 4, 140, 30, 4, 79,
/* 3680 */ 6, 117, 4, 129, 30, 4, 77, 10, 117, 4,
/* 3690 */ 129, 30, 4, 73, 18, 117, 4, 132, 30, 4,
/* 3700 */ 117, 4, 130, 30, 5, 116, 5, 130, 30, 7,
/* 3710 */ 114, 7, 129, 30, 8, 113, 8, 129, 30, 11,
/* 3720 */ 110, 11, 129, 30, 18, 103, 18, 132, 193, 129,
/* 3730 */ 30, 4, 117, 4, 132, 30, 91, 137, 30, 4,
/* 3740 */ 80, 4, 117, 4, 132, 80, 4, 117, 4, 136,
/* 3750 */ 79, 6, 117, 4, 129, 77, 10, 117, 4, 129,
/* 3760 */ 73, 18, 117, 4, 132, 117, 4, 130, 116, 5,
/* 3770 */ 130, 114, 7, 129, 113, 8, 129, 110, 11, 129,
/* 3780 */ 103, 18, 132, 193, 129, 63, 25, 129, 57, 37,
/* 3790 */ 129, 53, 45, 129, 50, 51, 129, 47, 57, 129,
/* 3800 */ 45, 61, 129, 43, 65, 129, 41, 69, 129, 39,
/* 3810 */ 73, 129, 38, 25, 92, 21, 129, 36, 21, 97,
/* 3820 */ 18, 129, 35, 18, 102, 14, 129, 34, 16, 106,
/* 3830 */ 11, 129, 33, 14, 108, 10, 129, 32, 12, 111,
/* 3840 */ 8, 129, 32, 10, 113, 6, 129, 31, 10, 114,
/* 3850 */ 6, 129, 31, 8, 115, 5, 129, 30, 8, 116,
/* 3860 */ 5, 129, 30, 7, 116, 5, 129, 30, 6, 117,
/* 3870 */ 4, 130, 30, 5, 117, 4, 131, 30, 5, 75,
/* 3880 */ 4, 116, 5, 129, 31, 5, 75, 4, 116, 4,
/* 3890 */ 129, 31, 6, 75, 4, 115, 5, 129, 32, 7,
/* 3900 */ 75, 4, 114, 5, 129, 32, 9, 75, 4, 112,
/* 3910 */ 6, 129, 33, 11, 75, 4, 110, 7, 129, 34,
/* 3920 */ 15, 75, 4, 107, 9, 129, 35, 44, 103, 12,
/* 3930 */ 129, 36, 43, 103, 18, 129, 38, 41, 103, 18,
/* 3940 */ 129, 39, 40, 103, 18, 129, 41, 38, 103, 18,
/* 3950 */ 129, 44, 35, 129, 48, 31, 129, 52, 27, 129,
/* 3960 */ 61, 18, 129, 193, 129, 30, 4, 117, 4, 132,
/* 3970 */ 30, 91, 137, 30, 4, 80, 4, 117, 4, 132,
/* 3980 */ 80, 4, 140, 30, 4, 80, 4, 117, 4, 132,
/* 3990 */ 30, 91, 137, 30, 4, 117, 4, 132, 193, 129,
/* 4000 */ 30, 4, 117, 4, 132, 30, 91, 137, 30, 4,
/* 4010 */ 117, 4, 132, 193, 129, 44, 7, 129, 40, 13,
/* 4020 */ 129, 37, 17, 129, 35, 20, 129, 34, 22, 129,
/* 4030 */ 33, 23, 129, 32, 24, 129, 32, 23, 129, 31,
/* 4040 */ 6, 41, 13, 129, 31, 5, 42, 11, 129, 30,
/* 4050 */ 5, 44, 7, 129, 30, 4, 132, 30, 5, 130,
/* 4060 */ 31, 5, 129, 31, 6, 117, 4, 129, 31, 8,
/* 4070 */ 117, 4, 129, 32, 9, 117, 4, 129, 33, 11,
/* 4080 */ 117, 4, 129, 34, 87, 129, 35, 86, 129, 36,
/* 4090 */ 85, 129, 37, 84, 129, 38, 83, 129, 40, 81,
/* 4100 */ 129, 42, 79, 129, 45, 76, 129, 50, 71, 129,
/* 4110 */ 117, 4, 132, 193, 129, 30, 4, 117, 4, 132,
/* 4120 */ 30, 91, 137, 30, 4, 76, 8, 117, 4, 129,
/* 4130 */ 30, 4, 73, 13, 117, 4, 129, 30, 4, 70,
/* 4140 */ 18, 117, 4, 129, 30, 4, 67, 23, 117, 4,
/* 4150 */ 129, 65, 26, 129, 62, 31, 129, 59, 35, 129,
/* 4160 */ 56, 29, 89, 7, 129, 53, 29, 91, 7, 129,
/* 4170 */ 50, 29, 93, 7, 129, 47, 29, 95, 6, 129,
/* 4180 */ 30, 4, 45, 29, 96, 7, 129, 30, 4, 42,
/* 4190 */ 29, 98, 7, 129, 30, 4, 39, 30, 100, 6,
/* 4200 */ 129, 30, 4, 36, 30, 101, 7, 129, 30, 33,
/* 4210 */ 103, 7, 117, 4, 129, 30, 30, 105, 6, 117,
/* 4220 */ 4, 129, 30, 27, 106, 7, 117, 4, 129, 30,
/* 4230 */ 25, 108, 7, 117, 4, 129, 30, 22, 110, 11,
/* 4240 */ 129, 30, 19, 111, 10, 129, 30, 16, 113, 8,
/* 4250 */ 129, 30, 13, 115, 6, 129, 30, 11, 116, 5,
/* 4260 */ 129, 30, 8, 117, 4, 129, 30, 5, 117, 4,
/* 4270 */ 129, 30, 4, 117, 4, 130, 30, 4, 130, 193,
/* 4280 */ 129, 30, 4, 117, 4, 132, 30, 91, 137, 30,
/* 4290 */ 4, 117, 4, 132, 30, 4, 144, 30, 5, 130,
/* 4300 */ 30, 7, 129, 30, 8, 129, 30, 11, 129, 30,
/* 4310 */ 18, 132, 193, 129, 30, 4, 117, 4, 132, 30,
/* 4320 */ 91, 132, 30, 4, 103, 18, 129, 30, 4, 97,
/* 4330 */ 24, 129, 30, 4, 92, 29, 129, 30, 4, 87,
/* 4340 */ 34, 129, 81, 40, 129, 76, 45, 129, 70, 49,
/* 4350 */ 129, 65, 49, 129, 60, 49, 129, 55, 49, 129,
/* 4360 */ 50, 48, 129, 44, 49, 129, 39, 48, 129, 33,
/* 4370 */ 49, 129, 30, 47, 129, 34, 37, 129, 40, 26,
/* 4380 */ 129, 46, 19, 129, 52, 19, 129, 58, 19, 129,
/* 4390 */ 64, 19, 129, 70, 19, 129, 76, 19, 129, 82,
/* 4400 */ 19, 129, 30, 4, 88, 18, 129, 30, 4, 94,
/* 4410 */ 18, 129, 30, 4, 100, 18, 129, 30, 4, 106,
/* 4420 */ 15, 129, 30, 91, 137, 30, 4, 117, 4, 132,
/* 4430 */ 193, 129, 30, 4, 117, 4, 132, 30, 91, 132,
/* 4440 */ 30, 4, 107, 14, 129, 30, 4, 104, 17, 129,
/* 4450 */ 30, 4, 101, 20, 129, 30, 4, 99, 22, 129,
/* 4460 */ 96, 25, 129, 93, 28, 129, 91, 28, 129, 88,
/* 4470 */ 29, 129, 85, 29, 129, 82, 29, 129, 79, 29,
/* 4480 */ 129, 76, 29, 129, 74, 29, 129, 71, 29, 129,
/* 4490 */ 68, 29, 129, 65, 29, 129, 62, 29, 129, 60,
/* 4500 */ 29, 129, 57, 29, 129, 54, 29, 129, 51, 29,
/* 4510 */ 129, 49, 28, 129, 46, 29, 129, 43, 29, 129,
/* 4520 */ 40, 29, 117, 4, 129, 37, 29, 117, 4, 129,
/* 4530 */ 35, 29, 117, 4, 129, 32, 29, 117, 4, 129,
/* 4540 */ 30, 91, 132, 117, 4, 132, 193, 129, 63, 25,
/* 4550 */ 129, 57, 37, 129, 53, 45, 129, 50, 51, 129,
/* 4560 */ 47, 57, 129, 45, 61, 129, 43, 65, 129, 41,
/* 4570 */ 69, 129, 39, 73, 129, 38, 21, 92, 21, 129,
/* 4580 */ 36, 18, 97, 18, 129, 35, 14, 102, 14, 129,
/* 4590 */ 34, 11, 106, 11, 129, 33, 10, 108, 10, 129,
/* 4600 */ 32, 8, 111, 8, 129, 32, 6, 113, 6, 129,
/* 4610 */ 31, 6, 114, 6, 129, 31, 5, 115, 5, 129,
/* 4620 */ 30, 5, 116, 5, 130, 30, 4, 117, 4, 132,
/* 4630 */ 30, 5, 116, 5, 130, 31, 5, 115, 5, 129,
/* 4640 */ 31, 6, 114, 6, 129, 32, 6, 113, 6, 129,
/* 4650 */ 32, 8, 111, 8, 129, 33, 10, 108, 10, 129,
/* 4660 */ 34, 11, 106, 11, 129, 35, 14, 102, 14, 129,
/* 4670 */ 36, 18, 97, 18, 129, 38, 21, 92, 21, 129,
/* 4680 */ 39, 73, 129, 41, 69, 129, 43, 65, 129, 45,
/* 4690 */ 61, 129, 47, 57, 129, 50, 51, 129, 53, 45,
/* 4700 */ 129, 57, 37, 129, 63, 25, 129, 193, 129, 30,
/* 4710 */ 4, 117, 4, 132, 30, 91, 137, 30, 4, 80,
/* 4720 */ 4, 117, 4, 132, 80, 4, 117, 4, 134, 80,
/* 4730 */ 5, 116, 5, 131, 80, 6, 115, 6, 130, 81,
/* 4740 */ 6, 114, 6, 129, 81, 8, 112, 8, 129, 81,
/* 4750 */ 9, 111, 9, 129, 82, 10, 109, 10, 129, 82,
/* 4760 */ 13, 106, 13, 129, 83, 35, 129, 84, 33, 129,
/* 4770 */ 85, 31, 129, 86, 29, 129, 88, 25, 129, 90,
/* 4780 */ 21, 129, 93, 15, 129, 96, 9, 129, 193, 129,
/* 4790 */ 63, 25, 129, 57, 37, 129, 53, 45, 129, 50,
/* 4800 */ 51, 129, 47, 57, 129, 45, 61, 129, 43, 65,
/* 4810 */ 129, 41, 69, 129, 39, 73, 129, 38, 21, 92,
/* 4820 */ 21, 129, 36, 18, 97, 18, 129, 35, 14, 102,
/* 4830 */ 14, 129, 34, 11, 106, 11, 129, 33, 10, 108,
/* 4840 */ 10, 129, 32, 8, 111, 8, 129, 32, 6, 113,
/* 4850 */ 6, 129, 31, 6, 114, 6, 129, 31, 5, 115,
/* 4860 */ 5, 129, 30, 5, 116, 5, 130, 30, 4, 39,
/* 4870 */ 2, 117, 4, 129, 30, 4, 40, 4, 117, 4,
/* 4880 */ 129, 30, 4, 41, 5, 117, 4, 129, 30, 4,
/* 4890 */ 41, 6, 117, 4, 129, 30, 5, 40, 8, 116,
/* 4900 */ 5, 129, 30, 5, 39, 10, 116, 5, 129, 31,
/* 4910 */ 5, 38, 11, 115, 5, 129, 31, 18, 114, 6,
/* 4920 */ 129, 32, 17, 113, 6, 129, 32, 16, 111, 8,
/* 4930 */ 129, 33, 15, 108, 10, 129, 33, 14, 106, 11,
/* 4940 */ 129, 32, 17, 102, 14, 129, 31, 23, 97, 18,
/* 4950 */ 129, 31, 28, 92, 21, 129, 30, 82, 129, 30,
/* 4960 */ 80, 129, 30, 11, 43, 65, 129, 30, 10, 45,
/* 4970 */ 61, 129, 31, 8, 47, 57, 129, 32, 6, 50,
/* 4980 */ 51, 129, 33, 5, 53, 45, 129, 35, 4, 57,
/* 4990 */ 37, 129, 38, 2, 63, 25, 129, 193, 129, 30,
/* 5000 */ 4, 117, 4, 132, 30, 91, 137, 30, 4, 76,
/* 5010 */ 8, 117, 4, 129, 30, 4, 73, 11, 117, 4,
/* 5020 */ 129, 30, 4, 70, 14, 117, 4, 129, 30, 4,
/* 5030 */ 67, 17, 117, 4, 129, 65, 19, 117, 4, 129,
/* 5040 */ 62, 22, 117, 4, 129, 59, 25, 117, 4, 129,
/* 5050 */ 56, 28, 117, 4, 129, 53, 31, 117, 4, 129,
/* 5060 */ 50, 34, 117, 4, 129, 47, 29, 80, 5, 116,
/* 5070 */ 5, 129, 30, 4, 45, 29, 80, 5, 116, 5,
/* 5080 */ 129, 30, 4, 42, 29, 80, 5, 116, 5, 129,
/* 5090 */ 30, 4, 39, 30, 80, 6, 115, 6, 129, 30,
/* 5100 */ 4, 36, 30, 80, 6, 115, 6, 129, 30, 33,
/* 5110 */ 81, 6, 114, 6, 129, 30, 30, 81, 8, 112,
/* 5120 */ 8, 129, 30, 27, 81, 9, 111, 9, 129, 30,
/* 5130 */ 25, 82, 10, 109, 10, 129, 30, 22, 82, 13,
/* 5140 */ 106, 13, 129, 30, 19, 83, 35, 129, 30, 16,
/* 5150 */ 84, 33, 129, 30, 13, 85, 31, 129, 30, 11,
/* 5160 */ 86, 29, 129, 30, 8, 88, 25, 129, 30, 5,
/* 5170 */ 90, 21, 129, 30, 4, 93, 15, 129, 30, 4,
/* 5180 */ 96, 9, 129, 30, 4, 130, 193, 129, 30, 18,
/* 5190 */ 130, 30, 18, 89, 15, 129, 30, 18, 85, 23,
/* 5200 */ 129, 34, 11, 83, 27, 129, 34, 9, 81, 31,
/* 5210 */ 129, 33, 8, 79, 35, 129, 33, 6, 78, 16,
/* 5220 */ 106, 9, 129, 32, 6, 77, 15, 109, 7, 129,
/* 5230 */ 32, 5, 76, 14, 111, 6, 129, 31, 5, 75,
/* 5240 */ 14, 113, 5, 129, 31, 4, 74, 15, 114, 5,
/* 5250 */ 129, 31, 4, 74, 14, 115, 4, 129, 30, 4,
/* 5260 */ 73, 15, 116, 4, 129, 30, 4, 73, 14, 116,
/* 5270 */ 4, 129, 30, 4, 73, 14, 117, 4, 129, 30,
/* 5280 */ 4, 72, 15, 117, 4, 130, 30, 4, 71, 15,
/* 5290 */ 117, 4, 130, 30, 4, 70, 15, 117, 4, 129,
/* 5300 */ 30, 5, 70, 15, 117, 4, 129, 30, 5, 69,
/* 5310 */ 15, 116, 5, 129, 30, 6, 68, 16, 115, 5,
/* 5320 */ 129, 31, 6, 67, 16, 114, 6, 129, 31, 7,
/* 5330 */ 66, 17, 113, 6, 129, 32, 7, 64, 18, 111,
/* 5340 */ 8, 129, 32, 8, 62, 19, 109, 9, 129, 33,
/* 5350 */ 9, 60, 20, 107, 10, 129, 34, 11, 57, 22,
/* 5360 */ 103, 13, 129, 35, 43, 103, 18, 129, 36, 41,
/* 5370 */ 103, 18, 129, 38, 38, 103, 18, 129, 39, 35,
/* 5380 */ 103, 18, 129, 41, 31, 129, 43, 27, 129, 46,
/* 5390 */ 22, 129, 49, 14, 129, 193, 129, 103, 18, 132,
/* 5400 */ 110, 11, 129, 113, 8, 129, 114, 7, 129, 116,
/* 5410 */ 5, 130, 117, 4, 132, 30, 4, 117, 4, 132,
/* 5420 */ 30, 91, 137, 30, 4, 117, 4, 132, 117, 4,
/* 5430 */ 132, 116, 5, 130, 114, 7, 129, 113, 8, 129,
/* 5440 */ 110, 11, 129, 103, 18, 132, 193, 129, 117, 4,
/* 5450 */ 132, 56, 65, 129, 50, 71, 129, 46, 75, 129,
/* 5460 */ 44, 77, 129, 42, 79, 129, 40, 81, 129, 38,
/* 5470 */ 83, 129, 36, 85, 129, 35, 86, 129, 34, 20,
/* 5480 */ 117, 4, 129, 33, 17, 117, 4, 129, 32, 15,
/* 5490 */ 117, 4, 129, 32, 13, 117, 4, 129, 31, 12,
/* 5500 */ 129, 31, 10, 129, 31, 9, 129, 30, 9, 129,
/* 5510 */ 30, 8, 130, 30, 7, 132, 31, 6, 130, 31,
/* 5520 */ 7, 129, 32, 6, 129, 32, 7, 129, 33, 7,
/* 5530 */ 129, 34, 7, 129, 35, 8, 129, 36, 9, 117,
/* 5540 */ 4, 129, 38, 9, 117, 4, 129, 40, 10, 117,
/* 5550 */ 4, 129, 42, 12, 117, 4, 129, 44, 77, 129,
/* 5560 */ 46, 75, 129, 50, 71, 129, 56, 43, 100, 21,
/* 5570 */ 129, 117, 4, 132, 193, 129, 117, 4, 132, 115,
/* 5580 */ 6, 129, 110, 11, 129, 105, 16, 129, 101, 20,
/* 5590 */ 129, 96, 25, 129, 92, 29, 129, 87, 34, 129,
/* 5600 */ 83, 38, 129, 78, 43, 129, 74, 47, 129, 70,
/* 5610 */ 42, 117, 4, 129, 65, 42, 117, 4, 129, 60,
/* 5620 */ 43, 117, 4, 129, 56, 42, 129, 51, 42, 129,
/* 5630 */ 46, 43, 129, 42, 43, 129, 37, 44, 129, 33,
/* 5640 */ 43, 129, 30, 42, 129, 33, 34, 129, 38, 25,
/* 5650 */ 129, 42, 16, 129, 47, 15, 129, 52, 15, 129,
/* 5660 */ 57, 15, 129, 61, 16, 129, 66, 16, 129, 71,
/* 5670 */ 16, 129, 76, 16, 129, 80, 16, 129, 85, 16,
/* 5680 */ 117, 4, 129, 90, 16, 117, 4, 129, 95, 16,
/* 5690 */ 117, 4, 129, 100, 21, 129, 105, 16, 129, 110,
/* 5700 */ 11, 129, 114, 7, 129, 117, 4, 132, 193, 129,
/* 5710 */ 117, 4, 132, 115, 6, 129, 110, 11, 129, 105,
/* 5720 */ 16, 129, 101, 20, 129, 96, 25, 129, 92, 29,
/* 5730 */ 129, 87, 34, 129, 83, 38, 129, 78, 43, 129,
/* 5740 */ 74, 47, 129, 70, 42, 117, 4, 129, 65, 42,
/* 5750 */ 117, 4, 129, 60, 43, 117, 4, 129, 56, 42,
/* 5760 */ 129, 51, 42, 129, 46, 43, 129, 42, 43, 129,
/* 5770 */ 37, 44, 129, 33, 43, 129, 30, 42, 129, 33,
/* 5780 */ 34, 129, 38, 25, 129, 42, 16, 129, 47, 15,
/* 5790 */ 129, 52, 15, 129, 57, 15, 129, 61, 16, 129,
/* 5800 */ 65, 17, 129, 60, 27, 129, 56, 36, 129, 51,
/* 5810 */ 42, 129, 46, 43, 129, 42, 43, 129, 37, 44,
/* 5820 */ 129, 33, 43, 129, 30, 42, 129, 33, 34, 129,
/* 5830 */ 38, 25, 129, 42, 16, 129, 47, 15, 129, 52,
/* 5840 */ 15, 129, 57, 15, 129, 61, 16, 129, 66, 16,
/* 5850 */ 129, 71, 16, 129, 76, 16, 129, 80, 16, 129,
/* 5860 */ 85, 16, 117, 4, 129, 90, 16, 117, 4, 129,
/* 5870 */ 95, 16, 117, 4, 129, 100, 21, 129, 105, 16,
/* 5880 */ 129, 110, 11, 129, 114, 7, 129, 117, 4, 132,
/* 5890 */ 193, 129, 30, 4, 117, 4, 132, 30, 4, 115,
/* 5900 */ 6, 129, 30, 4, 112, 9, 129, 30, 6, 109,
/* 5910 */ 12, 129, 30, 9, 106, 15, 129, 30, 11, 103,
/* 5920 */ 18, 129, 30, 14, 100, 21, 129, 30, 4, 38,
/* 5930 */ 9, 98, 23, 129, 30, 4, 40, 10, 95, 26,
/* 5940 */ 129, 30, 4, 43, 9, 92, 29, 129, 46, 9,
/* 5950 */ 89, 32, 129, 49, 8, 86, 28, 117, 4, 129,
/* 5960 */ 51, 9, 83, 28, 117, 4, 129, 54, 9, 80,
/* 5970 */ 28, 117, 4, 129, 57, 8, 77, 28, 117, 4,
/* 5980 */ 129, 59, 9, 74, 28, 129, 62, 37, 129, 64,
/* 5990 */ 33, 129, 66, 28, 129, 63, 28, 129, 60, 28,
/* 6000 */ 129, 57, 28, 129, 54, 33, 129, 51, 39, 129,
/* 6010 */ 48, 29, 83, 9, 129, 30, 4, 45, 29, 86,
/* 6020 */ 9, 129, 30, 4, 42, 29, 89, 9, 129, 30,
/* 6030 */ 4, 39, 29, 92, 8, 129, 30, 4, 36, 29,
/* 6040 */ 94, 9, 129, 30, 32, 97, 9, 129, 30, 29,
/* 6050 */ 100, 8, 117, 4, 129, 30, 26, 103, 8, 117,
/* 6060 */ 4, 129, 30, 23, 105, 9, 117, 4, 129, 30,
/* 6070 */ 20, 108, 13, 129, 30, 18, 111, 10, 129, 30,
/* 6080 */ 15, 113, 8, 129, 30, 12, 116, 5, 129, 30,
/* 6090 */ 9, 117, 4, 129, 30, 6, 117, 4, 129, 30,
/* 6100 */ 4, 117, 4, 132, 193, 129, 117, 4, 132, 114,
/* 6110 */ 7, 129, 111, 10, 129, 108, 13, 129, 105, 16,
/* 6120 */ 129, 102, 19, 129, 100, 21, 129, 96, 25, 129,
/* 6130 */ 93, 28, 129, 90, 31, 129, 87, 34, 129, 84,
/* 6140 */ 30, 117, 4, 129, 30, 4, 81, 30, 117, 4,
/* 6150 */ 129, 30, 4, 78, 30, 117, 4, 129, 30, 4,
/* 6160 */ 75, 30, 117, 4, 129, 30, 4, 72, 30, 129,
/* 6170 */ 30, 69, 129, 30, 66, 129, 30, 63, 129, 30,
/* 6180 */ 60, 129, 30, 57, 129, 30, 54, 129, 30, 51,
/* 6190 */ 129, 30, 48, 129, 30, 51, 129, 30, 4, 73,
/* 6200 */ 12, 129, 30, 4, 76, 12, 129, 30, 4, 80,
/* 6210 */ 12, 129, 30, 4, 83, 12, 129, 87, 12, 129,
/* 6220 */ 90, 12, 117, 4, 129, 94, 11, 117, 4, 129,
/* 6230 */ 97, 12, 117, 4, 129, 101, 12, 117, 4, 129,
/* 6240 */ 104, 17, 129, 108, 13, 129, 111, 10, 129, 115,
/* 6250 */ 6, 129, 117, 4, 134, 193, 129, 30, 1, 103,
/* 6260 */ 18, 129, 30, 4, 103, 18, 129, 30, 7, 103,
/* 6270 */ 18, 129, 30, 9, 103, 18, 129, 30, 12, 110,
/* 6280 */ 11, 129, 30, 15, 113, 8, 129, 30, 18, 114,
/* 6290 */ 7, 129, 30, 21, 116, 5, 129, 30, 24, 116,
/* 6300 */ 5, 129, 30, 27, 117, 4, 129, 30, 30, 117,
/* 6310 */ 4, 129, 30, 33, 117, 4, 129, 30, 4, 37,
/* 6320 */ 28, 117, 4, 129, 30, 4, 40, 28, 117, 4,
/* 6330 */ 129, 30, 4, 42, 29, 117, 4, 129, 30, 4,
/* 6340 */ 45, 29, 117, 4, 129, 30, 4, 48, 29, 117,
/* 6350 */ 4, 129, 30, 4, 51, 29, 117, 4, 129, 30,
/* 6360 */ 4, 54, 29, 117, 4, 129, 30, 4, 57, 29,
/* 6370 */ 117, 4, 129, 30, 4, 59, 30, 117, 4, 129,
/* 6380 */ 30, 4, 62, 30, 117, 4, 129, 30, 4, 65,
/* 6390 */ 30, 117, 4, 129, 30, 4, 68, 30, 117, 4,
/* 6400 */ 129, 30, 4, 71, 30, 117, 4, 129, 30, 4,
/* 6410 */ 74, 30, 117, 4, 129, 30, 4, 77, 30, 117,
/* 6420 */ 4, 129, 30, 4, 80, 30, 117, 4, 129, 30,
/* 6430 */ 4, 83, 30, 117, 4, 129, 30, 4, 86, 35,
/* 6440 */ 129, 30, 4, 89, 32, 129, 30, 4, 91, 30,
/* 6450 */ 129, 30, 4, 94, 27, 129, 30, 5, 97, 24,
/* 6460 */ 129, 30, 5, 100, 21, 129, 30, 7, 103, 18,
/* 6470 */ 129, 30, 8, 106, 15, 129, 30, 11, 109, 12,
/* 6480 */ 129, 30, 18, 112, 9, 129, 30, 18, 115, 6,
/* 6490 */ 129, 30, 18, 117, 4, 129, 30, 18, 120, 1,
/* 6500 */ 129, 193, 129, 42, 8, 129, 38, 16, 129, 36,
/* 6510 */ 20, 129, 34, 24, 71, 5, 129, 33, 26, 69,
/* 6520 */ 10, 129, 32, 28, 68, 13, 129, 31, 30, 68,
/* 6530 */ 14, 129, 31, 9, 52, 9, 68, 15, 129, 30,
/* 6540 */ 8, 54, 8, 69, 14, 129, 30, 7, 55, 7,
/* 6550 */ 71, 4, 78, 6, 129, 30, 6, 56, 6, 79,
/* 6560 */ 5, 129, 30, 6, 56, 6, 80, 4, 130, 31,
/* 6570 */ 5, 56, 5, 80, 4, 129, 31, 5, 56, 5,
/* 6580 */ 79, 5, 129, 32, 5, 55, 5, 78, 6, 129,
/* 6590 */ 33, 5, 54, 5, 77, 7, 129, 34, 6, 52,
/* 6600 */ 6, 74, 9, 129, 35, 48, 129, 33, 49, 129,
/* 6610 */ 32, 49, 129, 31, 49, 129, 30, 49, 129, 30,
/* 6620 */ 47, 129, 30, 45, 129, 30, 41, 129, 30, 6,
/* 6630 */ 129, 30, 4, 129, 30, 3, 129, 30, 2, 129,
/* 6640 */ 193, 129, 30, 4, 117, 4, 130, 31, 90, 136,
/* 6650 */ 37, 5, 72, 5, 129, 35, 5, 74, 5, 129,
/* 6660 */ 33, 5, 76, 5, 129, 32, 5, 77, 5, 129,
/* 6670 */ 31, 5, 78, 5, 129, 31, 4, 79, 4, 129,
/* 6680 */ 30, 5, 79, 5, 131, 30, 6, 78, 6, 129,
/* 6690 */ 30, 7, 77, 7, 129, 31, 8, 75, 8, 129,
/* 6700 */ 31, 11, 72, 11, 129, 32, 15, 67, 15, 129,
/* 6710 */ 33, 48, 129, 34, 46, 129, 35, 44, 129, 37,
/* 6720 */ 40, 129, 39, 36, 129, 42, 30, 129, 46, 22,
/* 6730 */ 129, 193, 129, 48, 18, 129, 43, 28, 129, 41,
/* 6740 */ 32, 129, 39, 36, 129, 37, 40, 129, 35, 44,
/* 6750 */ 129, 34, 46, 129, 33, 13, 68, 13, 129, 32,
/* 6760 */ 9, 73, 9, 129, 32, 7, 75, 7, 129, 31,
/* 6770 */ 6, 77, 6, 129, 31, 5, 78, 5, 129, 30,
/* 6780 */ 5, 79, 5, 129, 30, 4, 80, 4, 133, 31,
/* 6790 */ 3, 79, 4, 129, 31, 4, 79, 4, 129, 32,
/* 6800 */ 3, 78, 4, 129, 32, 4, 76, 6, 129, 33,
/* 6810 */ 4, 74, 7, 129, 34, 4, 72, 8, 129, 35,
/* 6820 */ 5, 72, 7, 129, 37, 5, 73, 4, 129, 39,
/* 6830 */ 4, 74, 1, 129, 129, 193, 129, 46, 22, 129,
/* 6840 */ 42, 30, 129, 39, 36, 129, 37, 40, 129, 35,
/* 6850 */ 44, 129, 34, 46, 129, 33, 48, 129, 32, 15,
/* 6860 */ 67, 15, 129, 31, 11, 72, 11, 129, 31, 8,
/* 6870 */ 75, 8, 129, 30, 7, 77, 7, 129, 30, 6,
/* 6880 */ 78, 6, 129, 30, 5, 79, 5, 131, 31, 4,
/* 6890 */ 79, 4, 129, 31, 5, 78, 5, 129, 32, 5,
/* 6900 */ 77, 5, 129, 33, 5, 76, 5, 129, 35, 5,
/* 6910 */ 74, 5, 117, 4, 129, 37, 5, 72, 5, 117,
/* 6920 */ 4, 129, 30, 91, 136, 30, 4, 130, 193, 129,
/* 6930 */ 48, 18, 129, 43, 28, 129, 41, 32, 129, 39,
/* 6940 */ 36, 129, 37, 40, 129, 35, 44, 129, 34, 46,
/* 6950 */ 129, 33, 13, 55, 4, 68, 13, 129, 32, 9,
/* 6960 */ 55, 4, 73, 9, 129, 32, 7, 55, 4, 75,
/* 6970 */ 7, 129, 31, 6, 55, 4, 77, 6, 129, 31,
/* 6980 */ 5, 55, 4, 78, 5, 129, 30, 5, 55, 4,
/* 6990 */ 79, 5, 129, 30, 4, 55, 4, 80, 4, 132,
/* 7000 */ 30, 4, 55, 4, 79, 5, 129, 31, 3, 55,
/* 7010 */ 4, 78, 5, 129, 31, 4, 55, 4, 77, 6,
/* 7020 */ 129, 32, 3, 55, 4, 75, 7, 129, 32, 4,
/* 7030 */ 55, 4, 73, 9, 129, 33, 4, 55, 4, 68,
/* 7040 */ 13, 129, 34, 4, 55, 25, 129, 35, 5, 55,
/* 7050 */ 24, 129, 37, 5, 55, 22, 129, 39, 4, 55,
/* 7060 */ 20, 129, 55, 18, 129, 55, 16, 129, 55, 11,
/* 7070 */ 129, 193, 129, 80, 4, 129, 30, 4, 80, 4,
/* 7080 */ 130, 30, 78, 129, 30, 82, 129, 30, 85, 129,
/* 7090 */ 30, 87, 129, 30, 88, 129, 30, 89, 129, 30,
/* 7100 */ 90, 130, 30, 4, 80, 4, 115, 6, 129, 30,
/* 7110 */ 4, 80, 4, 117, 4, 129, 80, 4, 105, 6,
/* 7120 */ 117, 4, 129, 80, 4, 103, 10, 116, 5, 129,
/* 7130 */ 80, 4, 102, 19, 129, 80, 4, 101, 19, 129,
/* 7140 */ 101, 19, 129, 101, 18, 129, 102, 16, 129, 103,
/* 7150 */ 12, 129, 105, 6, 129, 193, 129, 12, 10, 59,
/* 7160 */ 11, 129, 9, 16, 55, 19, 129, 7, 20, 53,
/* 7170 */ 23, 129, 6, 7, 23, 5, 32, 6, 51, 27,
/* 7180 */ 129, 4, 7, 25, 16, 50, 29, 129, 3, 6,
/* 7190 */ 27, 16, 49, 31, 129, 2, 6, 28, 16, 48,
/* 7200 */ 33, 129, 1, 6, 27, 18, 47, 35, 129, 1,
/* 7210 */ 6, 27, 31, 71, 12, 129, 1, 5, 26, 15,
/* 7220 */ 44, 10, 75, 8, 129, 1, 5, 25, 14, 45,
/* 7230 */ 7, 77, 7, 129, 1, 5, 25, 13, 45, 5,
/* 7240 */ 79, 5, 129, 1, 5, 24, 14, 45, 4, 80,
/* 7250 */ 4, 129, 1, 5, 24, 13, 45, 4, 80, 4,
/* 7260 */ 129, 1, 5, 23, 14, 45, 4, 80, 4, 129,
/* 7270 */ 1, 5, 23, 13, 45, 4, 80, 4, 129, 1,
/* 7280 */ 6, 22, 13, 45, 5, 79, 5, 129, 1, 6,
/* 7290 */ 21, 14, 45, 7, 77, 7, 129, 1, 7, 21,
/* 7300 */ 13, 46, 8, 75, 8, 129, 1, 8, 20, 13,
/* 7310 */ 46, 12, 71, 12, 129, 1, 10, 18, 15, 47,
/* 7320 */ 35, 129, 2, 30, 48, 33, 129, 3, 29, 49,
/* 7330 */ 32, 129, 4, 27, 50, 31, 129, 5, 25, 51,
/* 7340 */ 27, 80, 2, 86, 4, 129, 7, 21, 53, 23,
/* 7350 */ 80, 3, 85, 6, 129, 9, 17, 55, 19, 80,
/* 7360 */ 12, 129, 12, 12, 59, 11, 81, 11, 129, 82,
/* 7370 */ 10, 129, 84, 7, 129, 86, 4, 129, 193, 129,
/* 7380 */ 30, 4, 117, 4, 130, 30, 91, 136, 30, 4,
/* 7390 */ 72, 5, 129, 30, 4, 74, 5, 129, 75, 5,
/* 7400 */ 129, 76, 5, 129, 76, 6, 129, 77, 6, 130,
/* 7410 */ 77, 7, 130, 76, 8, 129, 30, 4, 75, 9,
/* 7420 */ 129, 30, 4, 72, 12, 129, 30, 54, 129, 30,
/* 7430 */ 53, 130, 30, 52, 129, 30, 51, 129, 30, 49,
/* 7440 */ 129, 30, 46, 129, 30, 42, 129, 30, 4, 130,
/* 7450 */ 193, 129, 30, 4, 80, 4, 129, 30, 4, 80,
/* 7460 */ 4, 100, 6, 129, 30, 54, 98, 10, 129, 30,
/* 7470 */ 54, 97, 12, 129, 30, 54, 96, 14, 131, 30,
/* 7480 */ 54, 97, 12, 129, 30, 54, 98, 10, 129, 30,
/* 7490 */ 54, 100, 6, 129, 30, 4, 130, 193, 129, 7,
/* 7500 */ 6, 129, 4, 11, 129, 3, 13, 129, 2, 14,
/* 7510 */ 129, 1, 15, 130, 1, 3, 6, 9, 129, 1,
/* 7520 */ 3, 7, 6, 129, 1, 3, 130, 1, 4, 129,
/* 7530 */ 1, 5, 80, 4, 129, 1, 7, 80, 4, 100,
/* 7540 */ 6, 129, 2, 82, 98, 10, 129, 3, 81, 97,
/* 7550 */ 12, 129, 4, 80, 96, 14, 129, 5, 79, 96,
/* 7560 */ 14, 129, 7, 77, 96, 14, 129, 10, 74, 97,
/* 7570 */ 12, 129, 14, 70, 98, 10, 129, 19, 65, 100,
/* 7580 */ 6, 129, 193, 129, 30, 4, 117, 4, 130, 30,
/* 7590 */ 91, 136, 30, 4, 57, 9, 129, 30, 4, 55,
/* 7600 */ 12, 129, 52, 17, 129, 50, 20, 129, 48, 24,
/* 7610 */ 129, 46, 27, 129, 44, 21, 69, 6, 129, 41,
/* 7620 */ 22, 70, 6, 80, 4, 129, 30, 4, 39, 21,
/* 7630 */ 72, 6, 80, 4, 129, 30, 4, 36, 22, 73,
/* 7640 */ 11, 129, 30, 26, 75, 9, 129, 30, 23, 76,
/* 7650 */ 8, 129, 30, 21, 78, 6, 129, 30, 19, 79,
/* 7660 */ 5, 129, 30, 16, 80, 4, 129, 30, 14, 80,
/* 7670 */ 4, 129, 30, 12, 129, 30, 10, 129, 30, 7,
/* 7680 */ 129, 30, 5, 129, 30, 4, 130, 193, 129, 30,
/* 7690 */ 4, 117, 4, 130, 30, 91, 136, 30, 4, 130,
/* 7700 */ 193, 129, 30, 4, 80, 4, 130, 30, 54, 136,
/* 7710 */ 30, 4, 72, 5, 129, 30, 4, 74, 5, 129,
/* 7720 */ 75, 5, 129, 76, 5, 129, 30, 4, 75, 7,
/* 7730 */ 129, 30, 4, 74, 9, 129, 30, 54, 132, 30,
/* 7740 */ 53, 129, 30, 52, 129, 30, 51, 129, 30, 48,
/* 7750 */ 129, 30, 4, 72, 5, 129, 30, 4, 74, 5,
/* 7760 */ 129, 75, 5, 129, 76, 5, 129, 30, 4, 75,
/* 7770 */ 7, 129, 30, 4, 74, 9, 129, 30, 54, 132,
/* 7780 */ 30, 53, 129, 30, 52, 129, 30, 51, 129, 30,
/* 7790 */ 48, 129, 30, 4, 130, 193, 129, 30, 4, 80,
/* 7800 */ 4, 130, 30, 54, 136, 30, 4, 72, 5, 129,
/* 7810 */ 30, 4, 74, 5, 129, 75, 5, 129, 76, 5,
/* 7820 */ 129, 76, 6, 129, 77, 6, 130, 77, 7, 130,
/* 7830 */ 76, 8, 129, 30, 4, 75, 9, 129, 30, 4,
/* 7840 */ 72, 12, 129, 30, 54, 129, 30, 53, 130, 30,
/* 7850 */ 52, 129, 30, 51, 129, 30, 49, 129, 30, 46,
/* 7860 */ 129, 30, 42, 129, 30, 4, 130, 193, 129, 48,
/* 7870 */ 18, 129, 43, 28, 129, 41, 32, 129, 39, 36,
/* 7880 */ 129, 37, 40, 129, 35, 44, 129, 34, 46, 129,
/* 7890 */ 33, 13, 68, 13, 129, 32, 9, 73, 9, 129,
/* 7900 */ 32, 7, 75, 7, 129, 31, 6, 77, 6, 129,
/* 7910 */ 31, 5, 78, 5, 129, 30, 5, 79, 5, 129,
/* 7920 */ 30, 4, 80, 4, 132, 30, 5, 79, 5, 130,
/* 7930 */ 31, 5, 78, 5, 129, 31, 6, 77, 6, 129,
/* 7940 */ 32, 7, 75, 7, 129, 32, 9, 73, 9, 129,
/* 7950 */ 33, 13, 68, 13, 129, 34, 46, 129, 35, 44,
/* 7960 */ 129, 37, 40, 129, 39, 36, 129, 41, 32, 129,
/* 7970 */ 43, 28, 129, 48, 18, 129, 193, 129, 1, 3,
/* 7980 */ 80, 4, 130, 1, 83, 137, 37, 5, 72, 5,
/* 7990 */ 129, 35, 5, 74, 5, 129, 33, 5, 76, 5,
/* 8000 */ 129, 32, 5, 77, 5, 129, 31, 5, 78, 5,
/* 8010 */ 129, 31, 4, 79, 4, 129, 30, 5, 79, 5,
/* 8020 */ 131, 30, 6, 78, 6, 129, 30, 7, 77, 7,
/* 8030 */ 129, 31, 8, 75, 8, 129, 31, 11, 72, 11,
/* 8040 */ 129, 32, 15, 67, 15, 129, 33, 48, 129, 34,
/* 8050 */ 46, 129, 35, 44, 129, 37, 40, 129, 39, 36,
/* 8060 */ 129, 42, 30, 129, 46, 22, 129, 193, 129, 46,
/* 8070 */ 22, 129, 42, 30, 129, 39, 36, 129, 37, 40,
/* 8080 */ 129, 35, 44, 129, 34, 46, 129, 33, 48, 129,
/* 8090 */ 32, 15, 67, 15, 129, 31, 11, 72, 11, 129,
/* 8100 */ 31, 8, 75, 8, 129, 30, 7, 77, 7, 129,
/* 8110 */ 30, 6, 78, 6, 129, 30, 5, 79, 5, 131,
/* 8120 */ 31, 4, 79, 4, 129, 31, 5, 78, 5, 129,
/* 8130 */ 32, 5, 77, 5, 129, 33, 5, 76, 5, 129,
/* 8140 */ 35, 5, 74, 5, 129, 37, 5, 72, 5, 129,
/* 8150 */ 1, 83, 136, 1, 3, 80, 4, 130, 193, 129,
/* 8160 */ 30, 4, 80, 4, 130, 30, 54, 136, 30, 4,
/* 8170 */ 68, 6, 129, 30, 4, 70, 6, 129, 71, 7,
/* 8180 */ 129, 72, 7, 129, 73, 7, 129, 74, 7, 129,
/* 8190 */ 74, 8, 129, 75, 8, 130, 69, 15, 129, 67,
/* 8200 */ 17, 129, 66, 18, 129, 65, 19, 130, 65, 18,
/* 8210 */ 130, 66, 16, 129, 67, 13, 129, 69, 8, 129,
/* 8220 */ 193, 129, 30, 13, 64, 8, 129, 30, 13, 61,
/* 8230 */ 14, 129, 30, 13, 59, 18, 129, 30, 13, 57,
/* 8240 */ 22, 129, 33, 8, 56, 24, 129, 32, 7, 55,
/* 8250 */ 26, 129, 32, 6, 54, 28, 129, 31, 6, 53,
/* 8260 */ 16, 77, 6, 129, 31, 5, 53, 14, 79, 4,
/* 8270 */ 129, 30, 5, 52, 14, 80, 4, 129, 30, 5,
/* 8280 */ 52, 13, 80, 4, 129, 30, 4, 52, 13, 80,
/* 8290 */ 4, 129, 30, 4, 52, 12, 80, 4, 129, 30,
/* 8300 */ 4, 51, 13, 80, 4, 130, 30, 4, 50, 13,
/* 8310 */ 79, 5, 129, 30, 4, 50, 13, 78, 5, 129,
/* 8320 */ 30, 5, 49, 14, 77, 6, 129, 31, 4, 49,
/* 8330 */ 13, 76, 6, 129, 31, 5, 48, 14, 75, 7,
/* 8340 */ 129, 32, 5, 47, 14, 73, 8, 129, 32, 6,
/* 8350 */ 45, 16, 71, 13, 129, 33, 27, 71, 13, 129,
/* 8360 */ 34, 26, 71, 13, 129, 35, 24, 71, 13, 129,
/* 8370 */ 37, 20, 129, 39, 16, 129, 43, 9, 129, 193,
/* 8380 */ 129, 80, 4, 131, 41, 56, 129, 37, 60, 129,
/* 8390 */ 35, 62, 129, 33, 64, 129, 32, 65, 129, 31,
/* 8400 */ 66, 129, 30, 67, 130, 30, 11, 80, 4, 129,
/* 8410 */ 30, 9, 80, 4, 129, 30, 8, 80, 4, 129,
/* 8420 */ 31, 7, 80, 4, 129, 31, 6, 129, 32, 5,
/* 8430 */ 129, 33, 5, 129, 35, 4, 129, 38, 3, 129,
/* 8440 */ 193, 129, 80, 4, 130, 42, 42, 129, 38, 46,
/* 8450 */ 129, 35, 49, 129, 33, 51, 129, 32, 52, 129,
/* 8460 */ 31, 53, 130, 30, 54, 129, 30, 12, 129, 30,
/* 8470 */ 9, 129, 30, 8, 129, 30, 7, 130, 31, 6,
/* 8480 */ 130, 32, 6, 129, 33, 5, 129, 34, 5, 129,
/* 8490 */ 35, 5, 80, 4, 129, 37, 5, 80, 4, 129,
/* 8500 */ 30, 54, 136, 30, 4, 130, 193, 129, 80, 4,
/* 8510 */ 130, 77, 7, 129, 74, 10, 129, 70, 14, 129,
/* 8520 */ 66, 18, 129, 62, 22, 129, 59, 25, 129, 55,
/* 8530 */ 29, 129, 51, 33, 129, 47, 37, 129, 44, 32,
/* 8540 */ 80, 4, 129, 40, 32, 80, 4, 129, 36, 32,
/* 8550 */ 129, 32, 33, 129, 30, 31, 129, 33, 24, 129,
/* 8560 */ 36, 17, 129, 40, 12, 129, 44, 12, 129, 48,
/* 8570 */ 12, 129, 51, 13, 129, 55, 13, 129, 59, 13,
/* 8580 */ 80, 4, 129, 63, 13, 80, 4, 129, 67, 17,
/* 8590 */ 129, 71, 13, 129, 74, 10, 129, 78, 6, 129,
/* 8600 */ 80, 4, 131, 193, 129, 80, 4, 130, 77, 7,
/* 8610 */ 129, 74, 10, 129, 70, 14, 129, 66, 18, 129,
/* 8620 */ 62, 22, 129, 59, 25, 129, 55, 29, 129, 51,
/* 8630 */ 33, 129, 47, 37, 129, 44, 32, 80, 4, 129,
/* 8640 */ 40, 32, 80, 4, 129, 36, 32, 129, 32, 33,
/* 8650 */ 129, 30, 31, 129, 33, 24, 129, 36, 17, 129,
/* 8660 */ 40, 12, 129, 44, 12, 129, 47, 13, 129, 44,
/* 8670 */ 20, 129, 40, 28, 129, 36, 31, 129, 32, 32,
/* 8680 */ 129, 30, 30, 129, 33, 24, 129, 36, 17, 129,
/* 8690 */ 40, 12, 129, 44, 12, 129, 48, 12, 129, 51,
/* 8700 */ 13, 129, 55, 13, 129, 59, 13, 80, 4, 129,
/* 8710 */ 63, 13, 80, 4, 129, 67, 17, 129, 71, 13,
/* 8720 */ 129, 74, 10, 129, 78, 6, 129, 80, 4, 131,
/* 8730 */ 193, 129, 30, 4, 80, 4, 130, 30, 4, 79,
/* 8740 */ 5, 129, 30, 5, 77, 7, 129, 30, 6, 74,
/* 8750 */ 10, 129, 30, 8, 72, 12, 129, 30, 11, 69,
/* 8760 */ 15, 129, 30, 13, 67, 17, 129, 30, 4, 37,
/* 8770 */ 8, 64, 20, 129, 30, 4, 39, 8, 62, 22,
/* 8780 */ 129, 41, 8, 59, 25, 129, 43, 8, 57, 27,
/* 8790 */ 129, 45, 8, 55, 22, 80, 4, 129, 47, 27,
/* 8800 */ 80, 4, 129, 49, 23, 129, 47, 22, 129, 44,
/* 8810 */ 23, 129, 42, 22, 129, 30, 4, 39, 27, 129,
/* 8820 */ 30, 4, 37, 31, 129, 30, 27, 62, 8, 129,
/* 8830 */ 30, 25, 64, 8, 129, 30, 22, 66, 8, 80,
/* 8840 */ 4, 129, 30, 20, 68, 8, 80, 4, 129, 30,
/* 8850 */ 17, 70, 8, 80, 4, 129, 30, 15, 73, 11,
/* 8860 */ 129, 30, 12, 75, 9, 129, 30, 10, 77, 7,
/* 8870 */ 129, 30, 7, 79, 5, 129, 30, 5, 80, 4,
/* 8880 */ 129, 30, 4, 80, 4, 130, 193, 129, 4, 5,
/* 8890 */ 80, 4, 129, 2, 9, 80, 4, 129, 1, 11,
/* 8900 */ 77, 7, 129, 1, 12, 74, 10, 129, 1, 12,
/* 8910 */ 70, 14, 129, 1, 12, 66, 18, 129, 1, 11,
/* 8920 */ 62, 22, 129, 2, 9, 59, 25, 129, 4, 11,
/* 8930 */ 55, 29, 129, 7, 12, 51, 33, 129, 10, 12,
/* 8940 */ 47, 37, 129, 14, 12, 44, 32, 80, 4, 129,
/* 8950 */ 17, 13, 40, 32, 80, 4, 129, 21, 13, 36,
/* 8960 */ 32, 129, 25, 40, 129, 29, 32, 129, 33, 24,
/* 8970 */ 129, 36, 17, 129, 40, 12, 129, 44, 12, 129,
/* 8980 */ 48, 12, 129, 51, 13, 129, 55, 13, 129, 59,
/* 8990 */ 13, 80, 4, 129, 63, 13, 80, 4, 129, 67,
/* 9000 */ 17, 129, 71, 13, 129, 74, 10, 129, 78, 6,
/* 9010 */ 129, 80, 4, 131, 193, 129, 30, 1, 71, 13,
/* 9020 */ 129, 30, 3, 71, 13, 129, 30, 6, 71, 13,
/* 9030 */ 129, 30, 9, 75, 9, 129, 30, 11, 77, 7,
/* 9040 */ 129, 30, 14, 79, 5, 129, 30, 17, 79, 5,
/* 9050 */ 129, 30, 19, 80, 4, 129, 30, 22, 80, 4,
/* 9060 */ 129, 30, 25, 80, 4, 129, 30, 27, 80, 4,
/* 9070 */ 129, 30, 4, 36, 24, 80, 4, 129, 30, 4,
/* 9080 */ 38, 25, 80, 4, 129, 30, 4, 41, 24, 80,
/* 9090 */ 4, 129, 30, 4, 44, 24, 80, 4, 129, 30,
/* 9100 */ 4, 46, 25, 80, 4, 129, 30, 4, 49, 25,
/* 9110 */ 80, 4, 129, 30, 4, 52, 24, 80, 4, 129,
/* 9120 */ 30, 4, 54, 30, 129, 30, 4, 57, 27, 129,
/* 9130 */ 30, 4, 59, 25, 129, 30, 4, 62, 22, 129,
/* 9140 */ 30, 4, 65, 19, 129, 30, 5, 67, 17, 129,
/* 9150 */ 30, 5, 70, 14, 129, 30, 7, 73, 11, 129,
/* 9160 */ 30, 9, 76, 8, 129, 30, 13, 78, 6, 129,
/* 9170 */ 30, 13, 81, 3, 129, 30, 13, 129, 193, 2,
/* 9180 */ 9, 59, 25, 129, 4, 11, 55, 29, 129, 7,
/* 9190 */ 12, 51, 33, 129, 10, 12, 47, 37, 129, 14,
/* 9200 */ 12, 44, 32, 80, 4, 129, 17, 13, 40, 32,
/* 9210 */ 80, 4, 129, 21, 13, 36, 32, 129, 25, 40,
/* 9220 */ 129, 29, 32, 129, 33, 24, 129, 36, 17, 129,
/* 9230 */ 40, 12, 129, 44, 12, 129, 48, 12, 129, 51,
/* 9240 */ 13, 129, 55, 13, 129, 59, 13, 80, 4, 129,
/* 9250 */ 63, 13, 80, 4, 129, 67, 17, 129, 71, 13,
/* 9260 */ 129, 74, 10, 129, 78, 6, 129, 80, 4, 131,
/* 9270 */ 193
};

int i,j;
int width = DWIDTH; /* -w option: scrunch letters to 80 columns */
int debug;
int trace;
char line[DWIDTH];
char print[DWIDTH];
char message[MAXMSG];
int nchars;
int linen;
int x,y;
int term;
int pc;
int max;

main(argc, argv)
int argc;
char **argv;
{
extern char *optarg;
extern int optind;
int ch;
char *strcpy(), *strcat();

while ((ch = getopt(argc, argv, "w:td")) != EOF)
switch((char)ch) {
case 'w':
width = atoi(optarg);
if (width <= 0)
width = 80;
break;
case 'd':
debug = 1;
break;
case 't':
trace = 1;
break;
case '?':
default:
fprintf(stderr, "usage: banner [-w width]\n");
exit(1);
}
argc -= optind;
argv += optind;

for (i=0; i j = i * 132 / width;
print[j] = 1;
}

#ifdef notdef
{
#define dir(f) "/e1/mrh/ucb/lib/f"
#define INDTBL dir(ban.dat.indtbl)
#define OBJECT dir(ban.dat.object)
FILE *fd;

fd = fopen(INDTBL, "r");
for (i=0; i fscanf(fd, "%d", &asc_ptr[i]);
}
fclose(fd);

fd = fopen(OBJECT, "r");
fread(data_table, 1, NBYTES, fd);
fclose(fd);
}
#endif

/* Have now read in the data. Next get the message to be printed. */
if (*argv) {
strcpy(message, *argv);
while (*++argv) {
strcat(message, " ");
strcat(message, *argv);
}
nchars = strlen(message);
} else {
fprintf(stderr,"Message: ");
(void)fgets(message, sizeof(message), stdin);
nchars = strlen(message);
message[nchars--] = '\0'; /* get rid of newline */
}

/* some debugging print statements */
if (debug) {
printf("int asc_ptr[128] = {\n");
for (i=0; i<128; i++) {
printf("%4d, ",asc_ptr[i]);
if ((i+1) % 8 == 0)
printf("\n");
}
printf("};\nchar data_table[NBYTES] = {\n");
printf(" /* ");
for (i=0; i<10; i++) printf(" %3d ",i);
printf(" */\n");
for (i=0; i printf("/* %4d */ ",i);
for (j=i; j x = data_table[j] & 0377;
printf(" %3d, ",x);
}
putchar('\n');
}
printf("};\n");
}

/* check message to make sure it's legal */
j = 0;
for (i=0; i if (asc_ptr[message[i]] == 0) {
printf("The character '%c' is not in my character set.\n",message[i]);
j++;
}
if (j) exit(1);

if (trace)
printf("Message '%s' is OK\n",message);
/* Now have message. Print it one character at a time. */

for (i=0; i if (trace)
printf("Char #%d: %c\n", i, message[i]);
for (j=0; j pc = asc_ptr[message[i]];
term = 0;
max = 0;
linen = 0;
while ( !term ) {
if (pc<0 || pc > NBYTES) {
printf("bad pc: %d\n",pc);
exit(1);
}
x = data_table[pc] & 0377;
if (trace)
printf("pc=%d, term=%d, max=%d, linen=%d, x=%d\n",pc,term,max,linen,x);
if (x >= 128) {
if (x>192) term++;
x = x & 63;
while (x--) {
if (print[linen++]) {
for (j=0; j<=max; j++)
if (print[j])
putchar(line[j]);
putchar('\n');
}
}
for (j=0; j pc++;
}
else {
y = data_table[pc+1];
/* compensate for narrow teminals */
#ifdef notdef
x = (x*width + (DWIDTH/2)) / DWIDTH;
y = (y*width + (DWIDTH/2)) / DWIDTH;
#endif
max = x+y;
while (x < max) line[x++] = '#';
pc += 2;
if (trace)
printf("x=%d, y=%d, max=%d\n",x,y,max);
}
}
}

exit(0);
}
src/utila-1.0/cal.1 600 0 0 6052 5225143235 12072 0ustar rootroot.\" Copyright (c) 1989, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Kim Letkeman.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)cal.1 6.10 (Berkeley) 6/17/91
.\"
.Dd June 17, 1991
.Dt CAL 1
.Os
.Sh NAME
.Nm cal
.Nd displays a calendar
.Sh SYNOPSIS
.Nm cal
.Op Fl jy
.Op Ar month Op Ar year
.Sh DESCRIPTION
.Nm Cal
displays a simple calendar.
If arguments are not specified,
the current month is displayed.
The options are as follows:
.Bl -tag -width Ds
.It Fl j
Display julian dates (days one-based, numbered from January 1).
.It Fl y
Display a calendar for the current year.
.El
.Pp
A single parameter specifies the year (1 - 9999) to be displayed;
note the year must be fully specified:
.Dq Li cal 89
will
.Em not
display a calendar for 1989.
Two parameters denote the month (1 - 12) and year.
If no parameters are specified, the current month's calendar is
displayed.
.Pp
A year starts on Jan 1.
.Pp
The Gregorian Reformation is assumed to have occurred in 1752 on the 3rd
of September.
By this time, most countries had recognized the reformation (although a
few did not recognize it until the early 1900's.)
Ten days following that date were eliminated by the reformation, so the
calendar for that month is a bit unusual.
.Sh HISTORY
A
.Nm
command appeared in Version 6 AT&T UNIX.
src/utila-1.0/cal.c 600 0 0 25676 5225143235 12211 0ustar rootroot/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kim Letkeman.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)cal.c 5.2 (Berkeley) 4/19/91";
#endif /* not lint */

#include
#include
#include
#include

#define THURSDAY 4 /* for reformation */
#define SATURDAY 6 /* 1 Jan 1 was a Saturday */

#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
#define NUMBER_MISSING_DAYS 11 /* 11 day correction */

#define MAXDAYS 42 /* max slots in a month array */
#define SPACE -1 /* used in day array */

static int days_in_month[2][13] = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
};

int sep1752[MAXDAYS] = {
SPACE, SPACE, 1, 2, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
}, j_sep1752[MAXDAYS] = {
SPACE, SPACE, 245, 246, 258, 259, 260,
261, 262, 263, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 274,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
}, empty[MAXDAYS] = {
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
};

char *month_names[12] = {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December",
};

char *day_headings = " S M Tu W Th F S";
char *j_day_headings = " S M Tu W Th F S";

/* leap year -- account for gregorian reformation in 1752 */
#define leap_year(yr) \
((yr) <= 1752 ? !((yr) % 4) : \
!((yr) % 4) && ((yr) % 100) || !((yr) % 400))

/* number of centuries since 1700, not inclusive */
#define centuries_since_1700(yr) \
((yr) > 1700 ? (yr) / 100 - 17 : 0)

/* number of centuries since 1700 whose modulo of 400 is 0 */
#define quad_centuries_since_1700(yr) \
((yr) > 1600 ? ((yr) - 1600) / 400 : 0)

/* number of leap years between year 1 and this year, not inclusive */
#define leap_years_since_year_1(yr) \
((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr))

int julian;

main(argc, argv)
int argc;
char **argv;
{
extern char *optarg;
extern int optind;
struct tm *local_time;
time_t now, time();
int ch, month, year, yflag;

yflag = 0;
while ((ch = getopt(argc, argv, "jy")) != EOF)
switch(ch) {
case 'j':
julian = 1;
break;
case 'y':
yflag = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;

month = 0;
switch(argc) {
case 2:
if ((month = atoi(*argv++)) <= 0 || month > 12) {
(void)fprintf(stderr,
"cal: illegal month value: use 0-12\n");
exit(1);
}
/* FALLTHROUGH */
case 1:
if ((year = atoi(*argv)) <= 0 || year > 9999) {
(void)fprintf(stderr,
"cal: illegal year value: use 0-9999\n");
exit(1);
}
break;
case 0:
(void)time(&now);
local_time = localtime(&now);
year = local_time->tm_year + 1900;
if (!yflag)
month = local_time->tm_mon + 1;
break;
default:
usage();
}

if (month)
monthly(month, year);
else if (julian)
j_yearly(year);
else
yearly(year);
exit(0);
}

#define DAY_LEN 3 /* 3 spaces per day */
#define J_DAY_LEN 4 /* 4 spaces per day */
#define WEEK_LEN 20 /* 7 * 3 - one space at the end */
#define J_WEEK_LEN 27 /* 7 * 4 - one space at the end */
#define HEAD_SEP 2 /* spaces between day headings */
#define J_HEAD_SEP 2

monthly(month, year)
int month, year;
{
register int col, row;
register char *p;
int len, days[MAXDAYS];
char lineout[30];

day_array(month, year, days);
len = sprintf(lineout, "%s %d", month_names[month - 1], year);
(void)printf("%*s%s\n%s\n",
((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "",
lineout, julian ? j_day_headings : day_headings);
for (row = 0; row < 6; row++) {
for (col = 0, p = lineout; col < 7; col++,
p += julian ? J_DAY_LEN : DAY_LEN)
ascii_day(p, days[row * 7 + col]);
trim_trailing_spaces(lineout);
(void)printf("%s\n", lineout);
}
}

j_yearly(year)
int year;
{
register int col, *dp, i, month, row, which_cal;
register char *p;
int days[12][MAXDAYS];
char lineout[80];

(void)sprintf(lineout, "%d", year);
center(lineout, J_WEEK_LEN * 2 + J_HEAD_SEP, 0);
(void)printf("\n\n");
for (i = 0; i < 12; i++)
day_array(i + 1, year, days[i]);
(void)memset(lineout, ' ', sizeof(lineout) - 1);
lineout[sizeof(lineout) - 1] = '\0';
for (month = 0; month < 12; month += 2) {
center(month_names[month], J_WEEK_LEN, J_HEAD_SEP);
center(month_names[month + 1], J_WEEK_LEN, 0);
(void)printf("\n%s%*s%s\n", j_day_headings, J_HEAD_SEP, "",
j_day_headings);
for (row = 0; row < 6; row++) {
for (which_cal = 0; which_cal < 2; which_cal++) {
p = lineout + which_cal * (J_WEEK_LEN + 2);
dp = &days[month + which_cal][row * 7];
for (col = 0; col < 7; col++, p += J_DAY_LEN)
ascii_day(p, *dp++);
}
trim_trailing_spaces(lineout);
(void)printf("%s\n", lineout);
}
}
(void)printf("\n");
}

yearly(year)
int year;
{
register int col, *dp, i, month, row, which_cal;
register char *p;
int days[12][MAXDAYS];
char lineout[80];

(void)sprintf(lineout, "%d", year);
center(lineout, WEEK_LEN * 3 + HEAD_SEP * 2, 0);
(void)printf("\n\n");
for (i = 0; i < 12; i++)
day_array(i + 1, year, days[i]);
(void)memset(lineout, ' ', sizeof(lineout) - 1);
lineout[sizeof(lineout) - 1] = '\0';
for (month = 0; month < 12; month += 3) {
center(month_names[month], WEEK_LEN, HEAD_SEP);
center(month_names[month + 1], WEEK_LEN, HEAD_SEP);
center(month_names[month + 2], WEEK_LEN, 0);
(void)printf("\n%s%*s%s%*s%s\n", day_headings, HEAD_SEP,
"", day_headings, HEAD_SEP, "", day_headings);
for (row = 0; row < 6; row++) {
for (which_cal = 0; which_cal < 3; which_cal++) {
p = lineout + which_cal * (WEEK_LEN + 2);
dp = &days[month + which_cal][row * 7];
for (col = 0; col < 7; col++, p += DAY_LEN)
ascii_day(p, *dp++);
}
trim_trailing_spaces(lineout);
(void)printf("%s\n", lineout);
}
}
(void)printf("\n");
}

/*
* day_array --
* Fill in an array of 42 integers with a calendar. Assume for a moment
* that you took the (maximum) 6 rows in a calendar and stretched them
* out end to end. You would have 42 numbers or spaces. This routine
* builds that array for any month from Jan. 1 through Dec. 9999.
*/
day_array(month, year, days)
register int *days;
int month, year;
{
register int i, day, dw, dm;

if (month == 9 && year == 1752) {
bcopy(julian ? j_sep1752 : sep1752,
days, MAXDAYS * sizeof(int));
return;
}
bcopy(empty, days, MAXDAYS * sizeof(int));
dm = days_in_month[leap_year(year)][month];
dw = day_in_week(1, month, year);
day = julian ? day_in_year(1, month, year) : 1;
while (dm--)
days[dw++] = day++;
}

/*
* day_in_year --
* return the 1 based day number within the year
*/
day_in_year(day, month, year)
register int day, month;
int year;
{
register int i, leap;

leap = leap_year(year);
for (i = 1; i < month; i++)
day += days_in_month[leap][i];
return(day);
}

/*
* day_in_week
* return the 0 based day number for any date from 1 Jan. 1 to
* 31 Dec. 9999. Assumes the Gregorian reformation eliminates
* 3 Sep. 1752 through 13 Sep. 1752. Returns Thursday for all
* missing days.
*/
day_in_week(day, month, year)
int day, month, year;
{
long temp;

temp = (long)(year - 1) * 365 + leap_years_since_year_1(year - 1)
+ day_in_year(day, month, year);
if (temp < FIRST_MISSING_DAY)
return((temp - 1 + SATURDAY) % 7);
if (temp >= (FIRST_MISSING_DAY + NUMBER_MISSING_DAYS))
return(((temp - 1 + SATURDAY) - NUMBER_MISSING_DAYS) % 7);
return(THURSDAY);
}

ascii_day(p, day)
register char *p;
register int day;
{
register int display, val;
static char *aday[] = {
"",
" 1", " 2", " 3", " 4", " 5", " 6", " 7",
" 8", " 9", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21",
"22", "23", "24", "25", "26", "27", "28",
"29", "30", "31",
};

if (day == SPACE) {
memset(p, ' ', julian ? J_DAY_LEN : DAY_LEN);
return;
}
if (julian) {
if (val = day / 100) {
day %= 100;
*p++ = val + '0';
display = 1;
} else {
*p++ = ' ';
display = 0;
}
val = day / 10;
if (val || display)
*p++ = val + '0';
else
*p++ = ' ';
*p++ = day % 10 + '0';
} else {
*p++ = aday[day][0];
*p++ = aday[day][1];
}
*p = ' ';
}

trim_trailing_spaces(s)
register char *s;
{
register char *p;

for (p = s; *p; ++p);
while (p > s && isspace(*--p));
if (p > s)
++p;
*p = '\0';
}

center(str, len, separate)
char *str;
register int len;
int separate;
{
len -= strlen(str);
(void)printf("%*s%s%*s", len / 2, "", str, len / 2 + len % 2, "");
if (separate)
(void)printf("%*s", separate, "");
}

usage()
{
(void)fprintf(stderr, "usage: cal [-jy] [[month] year]\n");
exit(1);
}
src/utila-1.0/col.1 600 0 0 7766 5225143422 12123 0ustar rootroot.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Michael Rendell.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)col.1 6.8 (Berkeley) 6/17/91
.\"
.Dd June 17, 1991
.Dt COL 1
.Os
.Sh NAME
.Nm col
.Nd filter reverse line feeds from input
.Sh SYNOPSIS
.Nm col
.Op Fl bfx
.Op Fl l Ar num
.Sh DESCRIPTION
.Nm Col
filters out reverse (and half reverse) line feeds so the output is
in the correct order with only forward and half forward line
feeds, and replaces white-space characters with tabs where possible.
This can be useful in processing the output of
.Xr nroff 1
and
.Xr tbl 1 .
.Pp
.Nm Col
reads from standard input and writes to standard output.
.Pp
The options are as follows:
.Bl -tag -width "-lnum"
.It Fl b
Do not output any backspaces, printing only the last character
written to each column position.
.It Fl f
Forward half line feeds are permitted (``fine'' mode).
Normally characters printed on a half line boundary are printed
on the following line.
.It Fl x
Output multiple spaces instead of tabs.
.It Fl l Ns Ar num
Buffer at least
.Ar num
lines in memory.
By default, 128 lines are buffered.
.El
.Pp
The control sequences for carriage motion that
.Nm col
understands and their decimal values are listed in the following
table:
.Pp
.Bl -tag -width "carriage return" -compact
.It ESC\-7
reverse line feed (escape then 7)
.It ESC\-8
half reverse line feed (escape then 8)
.It ESC\-9
half forward line feed (escape then 9)
.It backspace
moves back one column (8); ignored in the first column
.It carriage return
(13)
.It newline
forward line feed (10); also does carriage return
.It shift in
shift to normal character set (15)
.It shift out
shift to alternate character set (14)
.It space
moves forward one column (32)
.It tab
moves forward to next tab stop (9)
.It vertical tab
reverse line feed (11)
.El
.Pp
All unrecognized control characters and escape sequences are
discarded.
.Pp
.Nm Col
keeps track of the character set as characters are read and makes
sure the character set is correct when they are output.
.Pp
If the input attempts to back up to the last flushed line,
.Nm col
will display a warning message.
.Sh SEE ALSO
.Xr expand 1 ,
.Xr nroff 1 ,
.Xr tbl 1
.Sh HISTORY
A
.Nm col
command
appeared in Version 6 AT&T UNIX.
src/utila-1.0/README.cal 600 0 0 4330 5225143265 12667 0ustar rootrootThe cal(1) date routines were written from scratch, basically from first
principles. The algorithm for calculating the day of week from any
Gregorian date was "reverse engineered". This was necessary as most of
the documented algorithms have to do with date calculations for other
calendars (e.g. julian) and are only accurate when converted to gregorian
within a narrow range of dates.

1 Jan 1 is a Saturday because that's what cal says and I couldn't change
that even if I was dumb enough to try. From this we can easily calculate
the day of week for any date. The algorithm for a zero based day of week:

calculate the number of days in all prior years (year-1)*365
add the number of leap years (days?) since year 1
(not including this year as that is covered later)
add the day number within the year
this compensates for the non-inclusive leap year
calculation
if the day in question occurs before the gregorian reformation
(3 sep 1752 for our purposes), then simply return
(value so far - 1 + SATURDAY's value of 6) modulo 7.
if the day in question occurs during the reformation (3 sep 1752
to 13 sep 1752 inclusive) return THURSDAY. This is my
idea of what happened then. It does not matter much as
this program never tries to find day of week for any day
that is not the first of a month.
otherwise, after the reformation, use the same formula as the
days before with the additional step of subtracting the
number of days (11) that were adjusted out of the calendar
just before taking the modulo.

It must be noted that the number of leap years calculation is sensitive
to the date for which the leap year is being calculated. A year that occurs
before the reformation is determined to be a leap year if its modulo of
4 equals zero. But after the reformation, a year is only a leap year if
its modulo of 4 equals zero and its modulo of 100 does not. Of course,
there is an exception for these century years. If the modulo of 400 equals
zero, then the year is a leap year anyway. This is, in fact, what the
gregorian reformation was all about (a bit of error in the old algorithm
that caused the calendar to be inaccurate.)

Once we have the day in year for the first of the month in question, the
rest is trivial.
src/utila-1.0/display.c 600 0 0 20364 5225146421 13104 0ustar rootroot/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
static char sccsid[] = "@(#)display.c 5.11 (Berkeley) 3/9/91";
#endif /* not lint */

#include
#include
#include
#include
#include
#include
#include
#include
#include "hexdump.h"

#ifdef linux
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif

enum _vflag vflag = FIRST;

static off_t address; /* address/offset in stream */
static off_t eaddress; /* end address */
static off_t savaddress; /* saved address/offset in stream */

#define PRINT { \
switch(pr->flags) { \
case F_ADDRESS: \
(void)printf(pr->fmt, address); \
break; \
case F_BPAD: \
(void)printf(pr->fmt, ""); \
break; \
case F_C: \
conv_c(pr, bp); \
break; \
case F_CHAR: \
(void)printf(pr->fmt, *bp); \
break; \
case F_DBL: { \
double dval; \
float fval; \
switch(pr->bcnt) { \
case 4: \
bcopy((char *)bp, (char *)&fval, sizeof(fval)); \
(void)printf(pr->fmt, fval); \
break; \
case 8: \
bcopy((char *)bp, (char *)&dval, sizeof(dval)); \
(void)printf(pr->fmt, dval); \
break; \
} \
break; \
} \
case F_INT: { \
int ival; \
short sval; \
switch(pr->bcnt) { \
case 1: \
(void)printf(pr->fmt, (int)*bp); \
break; \
case 2: \
bcopy((char *)bp, (char *)&sval, sizeof(sval)); \
(void)printf(pr->fmt, (int)sval); \
break; \
case 4: \
bcopy((char *)bp, (char *)&ival, sizeof(ival)); \
(void)printf(pr->fmt, ival); \
break; \
} \
break; \
} \
case F_P: \
(void)printf(pr->fmt, isprint(*bp) ? *bp : '.'); \
break; \
case F_STR: \
(void)printf(pr->fmt, (char *)bp); \
break; \
case F_TEXT: \
(void)printf(pr->fmt); \
break; \
case F_U: \
conv_u(pr, bp); \
break; \
case F_UINT: { \
u_int ival; \
u_short sval; \
switch(pr->bcnt) { \
case 1: \
(void)printf(pr->fmt, (u_int)*bp); \
break; \
case 2: \
bcopy((char *)bp, (char *)&sval, sizeof(sval)); \
(void)printf(pr->fmt, (u_int)sval); \
break; \
case 4: \
bcopy((char *)bp, (char *)&ival, sizeof(ival)); \
(void)printf(pr->fmt, ival); \
break; \
} \
break; \
} \
} \
}

display()
{
extern FU *endfu;
register FS *fs;
register FU *fu;
register PR *pr;
register int cnt;
register u_char *bp;
off_t saveaddress;
u_char savech, *savebp, *get();

while (bp = get())
for (fs = fshead, savebp = bp, saveaddress = address; fs;
fs = fs->nextfs, bp = savebp, address = saveaddress)
for (fu = fs->nextfu; fu; fu = fu->nextfu) {
if (fu->flags&F_IGNORE)
break;
for (cnt = fu->reps; cnt; --cnt)
for (pr = fu->nextpr; pr; address += pr->bcnt,
bp += pr->bcnt, pr = pr->nextpr) {
if (eaddress && address >= eaddress &&
!(pr->flags&(F_TEXT|F_BPAD)))
bpad(pr);
if (cnt == 1 && pr->nospace) {
savech = *pr->nospace;
*pr->nospace = '\0';
}
PRINT;
if (cnt == 1 && pr->nospace)
*pr->nospace = savech;
}
}
if (endfu) {
/*
* if eaddress not set, error or file size was multiple of
* blocksize, and no partial block ever found.
*/
if (!eaddress) {
if (!address)
return;
eaddress = address;
}
for (pr = endfu->nextpr; pr; pr = pr->nextpr)
switch(pr->flags) {
case F_ADDRESS:
(void)printf(pr->fmt, eaddress);
break;
case F_TEXT:
(void)printf(pr->fmt);
break;
}
}
}

bpad(pr)
PR *pr;
{
static char *spec = " -0+#";
register char *p1, *p2;

/*
* remove all conversion flags; '-' is the only one valid
* with %s, and it's not useful here.
*/
pr->flags = F_BPAD;
*pr->cchar = 's';
for (p1 = pr->fmt; *p1 != '%'; ++p1);
for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
while (*p2++ = *p1++);
}

static char **_argv;

u_char *
get()
{
extern enum _vflag vflag;
extern int length;
static int ateof = 1;
static u_char *curp, *savp;
register int n;
int need, nread;
u_char *tmpp;

if (!curp) {
curp = (u_char *)emalloc(blocksize);
savp = (u_char *)emalloc(blocksize);
} else {
tmpp = curp;
curp = savp;
savp = tmpp;
address = savaddress += blocksize;
}
for (need = blocksize, nread = 0;;) {
/*
* if read the right number of bytes, or at EOF for one file,
* and no other files are available, zero-pad the rest of the
* block and set the end flag.
*/
if (!length || ateof && !next((char **)NULL)) {
if (need == blocksize)
return((u_char *)NULL);
if (vflag != ALL && !bcmp(curp, savp, nread)) {
if (vflag != DUP)
(void)printf("*\n");
return((u_char *)NULL);
}
bzero((char *)curp + nread, need);
eaddress = address + nread;
return(curp);
}
n = fread((char *)curp + nread, sizeof(u_char),
length == -1 ? need : MIN(length, need), stdin);
if (!n) {
if (ferror(stdin))
(void)fprintf(stderr, "hexdump: %s: %s\n",
_argv[-1], strerror(errno));
ateof = 1;
continue;
}
ateof = 0;
if (length != -1)
length -= n;
if (!(need -= n)) {
if (vflag == ALL || vflag == FIRST ||
bcmp(curp, savp, blocksize)) {
if (vflag == DUP || vflag == FIRST)
vflag = WAIT;
return(curp);
}
if (vflag == WAIT)
(void)printf("*\n");
vflag = DUP;
address = savaddress += blocksize;
need = blocksize;
nread = 0;
}
else
nread += n;
}
}

extern off_t skip; /* bytes to skip */

next(argv)
char **argv;
{
extern int errno, exitval;
static int done;
int statok;

if (argv) {
_argv = argv;
return(1);
}
for (;;) {
if (*_argv) {
if (!(freopen(*_argv, "r", stdin))) {
(void)fprintf(stderr, "hexdump: %s: %s\n",
*_argv, strerror(errno));
exitval = 1;
++_argv;
continue;
}
statok = done = 1;
} else {
if (done++)
return(0);
statok = 0;
}
if (skip)
doskip(statok ? *_argv : "stdin", statok);
if (*_argv)
++_argv;
if (!skip)
return(1);
}
/* NOTREACHED */
}

doskip(fname, statok)
char *fname;
int statok;
{
extern int errno;
struct stat sbuf;

if (statok) {
if (fstat(fileno(stdin), &sbuf)) {
(void)fprintf(stderr, "hexdump: %s: %s.\n",
fname, strerror(errno));
exit(1);
}
if (skip >= sbuf.st_size) {
skip -= sbuf.st_size;
address += sbuf.st_size;
return;
}
}
if (fseek(stdin, skip, SEEK_SET)) {
(void)fprintf(stderr, "hexdump: %s: %s.\n",
fname, strerror(errno));
exit(1);
}
savaddress = address += skip;
skip = 0;
}

char *
emalloc(size)
int size;
{
char *p;

if (!(p = malloc((u_int)size)))
nomem();
bzero(p, size);
return(p);
}

nomem()
{
extern int errno;

(void)fprintf(stderr, "hexdump: %s.\n", strerror(errno));
exit(1);
}
src/utila-1.0/false.1 600 0 0 4713 5225143422 12425 0ustar rootroot.\" Copyright (c) 1983, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)false.1 6.6 (Berkeley) 7/24/91
.\"
.Dd July 24, 1991
.Dt FALSE 1
.Os BSD 4.2
.Sh NAME
.Nm false
.Nd Return false value.
.Sh SYNOPSIS
.Nm false
.Sh DESCRIPTION
.Nm False
is usually used in a Bourne shell script.
It tests for the appropriate status "false" before running
(or failing to run) a list of commands.
.Pp
The
.Nm false
utility always exits with a value other than zero.
.Sh SEE ALSO
.Xr csh 1 ,
.Xr sh 1 ,
.Xr true 1
.Sh STANDARDS
The
.Nm false
utility is expected to be
.St -p1003.2
compatible.
src/utila-1.0/hexdump.c 600 0 0 5455 5225143236 13076 0ustar rootroot/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)hexdump.c 5.5 (Berkeley) 6/1/90";
#endif /* not lint */

#include
#include
#include "hexdump.h"

FS *fshead; /* head of format strings */
int blocksize; /* data block size */
int exitval; /* final exit value */
int length = -1; /* max bytes to read */

main(argc, argv)
int argc;
char **argv;
{
extern int errno;
register FS *tfs;
char *p, *rindex();

if (!(p = rindex(argv[0], 'o')) || strcmp(p, "od"))
newsyntax(argc, &argv);
else
oldsyntax(argc, &argv);

/* figure out the data block size */
for (blocksize = 0, tfs = fshead; tfs; tfs = tfs->nextfs) {
tfs->bcnt = size(tfs);
if (blocksize < tfs->bcnt)
blocksize = tfs->bcnt;
}
/* rewrite the rules, do syntax checking */
for (tfs = fshead; tfs; tfs = tfs->nextfs)
rewrite(tfs);

(void)next(argv);
display();
exit(exitval);
}
src/utila-1.0/hexdump.h 600 0 0 6203 5225143236 13073 0ustar rootroot/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*
* @(#)hexdump.h 5.4 (Berkeley) 6/1/90
*/

typedef struct _pr {
struct _pr *nextpr; /* next print unit */
#define F_ADDRESS 0x001 /* print offset */
#define F_BPAD 0x002 /* blank pad */
#define F_C 0x004 /* %_c */
#define F_CHAR 0x008 /* %c */
#define F_DBL 0x010 /* %[EefGf] */
#define F_INT 0x020 /* %[di] */
#define F_P 0x040 /* %_p */
#define F_STR 0x080 /* %s */
#define F_U 0x100 /* %_u */
#define F_UINT 0x200 /* %[ouXx] */
#define F_TEXT 0x400 /* no conversions */
u_int flags; /* flag values */
int bcnt; /* byte count */
char *cchar; /* conversion character */
char *fmt; /* printf format */
char *nospace; /* no whitespace version */
} PR;

typedef struct _fu {
struct _fu *nextfu; /* next format unit */
struct _pr *nextpr; /* next print unit */
#define F_IGNORE 0x01 /* %_A */
#define F_SETREP 0x02 /* rep count set, not default */
u_int flags; /* flag values */
int reps; /* repetition count */
int bcnt; /* byte count */
char *fmt; /* format string */
} FU;

typedef struct _fs { /* format strings */
struct _fs *nextfs; /* linked list of format strings */
struct _fu *nextfu; /* linked list of format units */
int bcnt;
} FS;

extern FS *fshead; /* head of format strings list */
extern int blocksize; /* data block size */
enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */
char *emalloc();
src/utila-1.0/hexsyntax.c 600 0 0 7044 5225143236 13453 0ustar rootroot/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
static char sccsid[] = "@(#)hexsyntax.c 5.2 (Berkeley) 5/8/90";
#endif /* not lint */

#include
#include
#include "hexdump.h"

off_t skip; /* bytes to skip */

newsyntax(argc, argvp)
int argc;
char ***argvp;
{
extern enum _vflag vflag;
extern FS *fshead;
extern char *optarg;
extern int length, optind;
int ch;
char *p, **argv;

argv = *argvp;
while ((ch = getopt(argc, argv, "bcde:f:n:os:vx")) != EOF)
switch (ch) {
case 'b':
add("\"%07.7_Ax\n\"");
add("\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"");
break;
case 'c':
add("\"%07.7_Ax\n\"");
add("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"");
break;
case 'd':
add("\"%07.7_Ax\n\"");
add("\"%07.7_ax \" 8/2 \" %05u \" \"\\n\"");
break;
case 'e':
add(optarg);
break;
case 'f':
addfile(optarg);
break;
case 'n':
if ((length = atoi(optarg)) < 0) {
(void)fprintf(stderr,
"hexdump: bad length value.\n");
exit(1);
}
break;
case 'o':
add("\"%07.7_Ax\n\"");
add("\"%07.7_ax \" 8/2 \" %06o \" \"\\n\"");
break;
case 's':
if ((skip = strtol(optarg, &p, 0)) < 0) {
(void)fprintf(stderr,
"hexdump: bad skip value.\n");
exit(1);
}
switch(*p) {
case 'b':
skip *= 512;
break;
case 'k':
skip *= 1024;
break;
case 'm':
skip *= 1048576;
break;
}
break;
case 'v':
vflag = ALL;
break;
case 'x':
add("\"%07.7_Ax\n\"");
add("\"%07.7_ax \" 8/2 \" %04x \" \"\\n\"");
break;
case '?':
usage();
exit(1);
}

if (!fshead) {
add("\"%07.7_Ax\n\"");
add("\"%07.7_ax \" 8/2 \"%04x \" \"\\n\"");
}

*argvp += optind;
}

usage()
{
(void)fprintf(stderr,
"hexdump: [-bcdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n");
exit(1);
}
src/utila-1.0/od.1 600 0 0 4715 5225143236 11742 0ustar rootroot.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)od.1 5.7 (Berkeley) 7/22/91
.\"
.Dd %Q
.Os
.Dt OD 1
.Sh NAME
.Nm od
.Nd octal, decimal, hex, ascii dump
.Sh SYNOPSIS
.Nm od
.Op Fl aBbcDdeFfHhIiLlOovXx
.Sm off
.Oo
.Op Cm \&+
.Li offset
.Op Cm \&.
.Op Cm Bb
.Oc
.Ar file
.Sh DESCRIPTION
.Nm Od
has been deprecated in favor of
.Xr hexdump 1 .
.Pp
.Xr Hexdump ,
if called as
.Nm od ,
provides compatibility for the options listed above.
.Pp
It does not provide compatibility for the
.Fl s
option (see
.Xr strings 1 )
or the
.Fl P ,
.Fl p ,
or
.Fl w
options, nor is compatibility provided for the ``label'' component
of the offset syntax.
.Sh SEE ALSO
.Xr hexdump 1 ,
.Xr strings 1
.Sh BUGS
Quite a few.
src/utila-1.0/odsyntax.c 600 0 0 14150 5225143236 13305 0ustar rootroot/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
static char sccsid[] = "@(#)odsyntax.c 5.4 (Berkeley) 3/8/91";
#endif /* not lint */

#include
#include
#include
#include "hexdump.h"

int deprecated;

oldsyntax(argc, argvp)
int argc;
char ***argvp;
{
extern enum _vflag vflag;
extern FS *fshead;
extern char *optarg;
extern int length, optind;
int ch;
char **argv;
static void odprecede();

deprecated = 1;
argv = *argvp;
while ((ch = getopt(argc, argv, "aBbcDdeFfHhIiLlOoPpswvXx")) != EOF)
switch (ch) {
case 'a':
odprecede();
add("16/1 \"%3_u \" \"\\n\"");
break;
case 'B':
case 'o':
odprecede();
add("8/2 \" %06o \" \"\\n\"");
break;
case 'b':
odprecede();
add("16/1 \"%03o \" \"\\n\"");
break;
case 'c':
odprecede();
add("16/1 \"%3_c \" \"\\n\"");
break;
case 'd':
odprecede();
add("8/2 \" %05u \" \"\\n\"");
break;
case 'D':
odprecede();
add("4/4 \" %010u \" \"\\n\"");
break;
case 'e': /* undocumented in od */
case 'F':
odprecede();
add("2/8 \" %21.14e \" \"\\n\"");
break;

case 'f':
odprecede();
add("4/4 \" %14.7e \" \"\\n\"");
break;
case 'H':
case 'X':
odprecede();
add("4/4 \" %08x \" \"\\n\"");
break;
case 'h':
case 'x':
odprecede();
add("8/2 \" %04x \" \"\\n\"");
break;
case 'I':
case 'L':
case 'l':
odprecede();
add("4/4 \" %11d \" \"\\n\"");
break;
case 'i':
odprecede();
add("8/2 \" %6d \" \"\\n\"");
break;
case 'O':
odprecede();
add("4/4 \" %011o \" \"\\n\"");
break;
case 'v':
vflag = ALL;
break;
case 'P':
case 'p':
case 's':
case 'w':
case '?':
default:
(void)fprintf(stderr,
"od: od(1) has been deprecated for hexdump(1).\n");
if (ch != '?')
(void)fprintf(stderr,
"od: hexdump(1) compatibility doesn't support the -%c option%s\n",
ch, ch == 's' ? "; see strings(1)." : ".");
usage();
}

if (!fshead) {
add("\"%07.7_Ao\n\"");
add("\"%07.7_ao \" 8/2 \"%06o \" \"\\n\"");
}

argc -= optind;
*argvp += optind;

odoffset(argc, argvp);
}

#define ishexdigit(c) \
(c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F')

odoffset(argc, argvp)
int argc;
char ***argvp;
{
extern off_t skip;
register char *num, *p;
int base;
char *end;

/*
* The offset syntax of od(1) was genuinely bizarre. First, if
* it started with a plus it had to be an offset. Otherwise, if
* there were at least two arguments, a number or lower-case 'x'
* followed by a number makes it an offset. By default it was
* octal; if it started with 'x' or '0x' it was hex. If it ended
* in a '.', it was decimal. If a 'b' or 'B' was appended, it
* multiplied the number by 512 or 1024 byte units. There was
* no way to assign a block count to a hex offset.
*
* We assumes it's a file if the offset is bad.
*/
p = **argvp;
if (*p != '+' && (argc < 2 ||
(!isdigit(p[0]) && (p[0] != 'x' || !ishexdigit(p[1])))))
return;

base = 0;
/*
* skip over leading '+', 'x[0-9a-fA-f]' or '0x', and
* set base.
*/
if (p[0] == '+')
++p;
if (p[0] == 'x' && ishexdigit(p[1])) {
++p;
base = 16;
} else if (p[0] == '0' && p[1] == 'x') {
p += 2;
base = 16;
}

/* skip over the number */
if (base == 16)
for (num = p; ishexdigit(*p); ++p);
else
for (num = p; isdigit(*p); ++p);

/* check for no number */
if (num == p)
return;

/* if terminates with a '.', base is decimal */
if (*p == '.') {
if (base)
return;
base = 10;
}

skip = strtol(num, &end, base ? base : 8);

/* if end isn't the same as p, we got a non-octal digit */
if (end != p)
skip = 0;
else {
if (*p) {
if (*p == 'b')
skip *= 512;
else if (*p == 'B')
skip *= 1024;
++p;
}
if (*p)
skip = 0;
else {
++*argvp;
/*
* If the offset uses a non-octal base, the base of
* the offset is changed as well. This isn't pretty,
* but it's easy.
*/
#define TYPE_OFFSET 7
if (base == 16) {
fshead->nextfu->fmt[TYPE_OFFSET] = 'x';
fshead->nextfs->nextfu->fmt[TYPE_OFFSET] = 'x';
} else if (base == 10) {
fshead->nextfu->fmt[TYPE_OFFSET] = 'd';
fshead->nextfs->nextfu->fmt[TYPE_OFFSET] = 'd';
}
}
}
}

static void
odprecede()
{
static int first = 1;

if (first) {
first = 0;
add("\"%07.7_Ao\n\"");
add("\"%07.7_ao \"");
} else
add("\" \"");
}
src/utila-1.0/parse.c 600 0 0 25773 5225143236 12563 0ustar rootroot/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
static char sccsid[] = "@(#)parse.c 5.6 (Berkeley) 3/9/91";
#endif /* not lint */

#include
#include
#include
#include
#include
#include
#include "hexdump.h"

FU *endfu; /* format at end-of-data */

addfile(name)
char *name;
{
register char *p;
FILE *fp;
int ch;
char buf[2048 + 1];

if (!(fp = fopen(name, "r"))) {
(void)fprintf(stderr, "hexdump: can't read %s.\n", name);
exit(1);
}
while (fgets(buf, sizeof(buf), fp)) {
if (!(p = index(buf, '\n'))) {
(void)fprintf(stderr, "hexdump: line too long.\n");
while ((ch = getchar()) != '\n' && ch != EOF);
continue;
}
*p = '\0';
for (p = buf; *p && isspace(*p); ++p);
if (!*p || *p == '#')
continue;
add(p);
}
(void)fclose(fp);
}

add(fmt)
char *fmt;
{
register char *p;
static FS **nextfs;
FS *tfs;
FU *tfu, **nextfu;
char *savep, *emalloc();

/* start new linked list of format units */
/* NOSTRICT */
tfs = (FS *)emalloc(sizeof(FS));
if (!fshead)
fshead = tfs;
else
*nextfs = tfs;
nextfs = &tfs->nextfs;
nextfu = &tfs->nextfu;

/* take the format string and break it up into format units */
for (p = fmt;;) {
/* skip leading white space */
for (; isspace(*p); ++p);
if (!*p)
break;

/* allocate a new format unit and link it in */
/* NOSTRICT */
tfu = (FU *)emalloc(sizeof(FU));
*nextfu = tfu;
nextfu = &tfu->nextfu;
tfu->reps = 1;

/* if leading digit, repetition count */
if (isdigit(*p)) {
for (savep = p; isdigit(*p); ++p);
if (!isspace(*p) && *p != '/')
badfmt(fmt);
/* may overwrite either white space or slash */
tfu->reps = atoi(savep);
tfu->flags = F_SETREP;
/* skip trailing white space */
for (++p; isspace(*p); ++p);
}

/* skip slash and trailing white space */
if (*p == '/')
while (isspace(*++p));

/* byte count */
if (isdigit(*p)) {
for (savep = p; isdigit(*p); ++p);
if (!isspace(*p))
badfmt(fmt);
tfu->bcnt = atoi(savep);
/* skip trailing white space */
for (++p; isspace(*p); ++p);
}

/* format */
if (*p != '"')
badfmt(fmt);
for (savep = ++p; *p != '"';)
if (*p++ == 0)
badfmt(fmt);
if (!(tfu->fmt = malloc(p - savep + 1)))
nomem();
(void) strncpy(tfu->fmt, savep, p - savep);
tfu->fmt[p - savep] = '\0';
escape(tfu->fmt);
p++;
}
}

static char *spec = ".#-+ 0123456789";
size(fs)
FS *fs;
{
register FU *fu;
register int bcnt, cursize;
register char *fmt;
int prec;

/* figure out the data block size needed for each format unit */
for (cursize = 0, fu = fs->nextfu; fu; fu = fu->nextfu) {
if (fu->bcnt) {
cursize += fu->bcnt * fu->reps;
continue;
}
for (bcnt = prec = 0, fmt = fu->fmt; *fmt; ++fmt) {
if (*fmt != '%')
continue;
/*
* skip any special chars -- save precision in
* case it's a %s format.
*/
while (index(spec + 1, *++fmt));
if (*fmt == '.' && isdigit(*++fmt)) {
prec = atoi(fmt);
while (isdigit(*++fmt));
}
switch(*fmt) {
case 'c':
bcnt += 1;
break;
case 'd': case 'i': case 'o': case 'u':
case 'x': case 'X':
bcnt += 4;
break;
case 'e': case 'E': case 'f': case 'g': case 'G':
bcnt += 8;
break;
case 's':
bcnt += prec;
break;
case '_':
switch(*++fmt) {
case 'c': case 'p': case 'u':
bcnt += 1;
break;
}
}
}
cursize += bcnt * fu->reps;
}
return(cursize);
}

rewrite(fs)
FS *fs;
{
enum { NOTOKAY, USEBCNT, USEPREC } sokay;
register PR *pr, **nextpr;
register FU *fu;
register char *p1, *p2;
char savech, *fmtp;
int nconv, prec;

for (fu = fs->nextfu; fu; fu = fu->nextfu) {
/*
* break each format unit into print units; each
* conversion character gets its own.
*/
for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
/* NOSTRICT */
pr = (PR *)emalloc(sizeof(PR));
if (!fu->nextpr)
fu->nextpr = pr;
else
*nextpr = pr;

/* skip preceding text and up to the next % sign */
for (p1 = fmtp; *p1 && *p1 != '%'; ++p1);

/* only text in the string */
if (!*p1) {
pr->fmt = fmtp;
pr->flags = F_TEXT;
break;
}

/*
* get precision for %s -- if have a byte count, don't
* need it.
*/
if (fu->bcnt) {
sokay = USEBCNT;
/* skip to conversion character */
for (++p1; index(spec, *p1); ++p1);
} else {
/* skip any special chars, field width */
while (index(spec + 1, *++p1));
if (*p1 == '.' && isdigit(*++p1)) {
sokay = USEPREC;
prec = atoi(p1);
while (isdigit(*++p1));
}
else
sokay = NOTOKAY;
}

p2 = p1 + 1; /* set end pointer */

/*
* figure out the byte count for each conversion;
* rewrite the format as necessary, set up blank-
* padding for end of data.
*/
switch(*p1) {
case 'c':
pr->flags = F_CHAR;
switch(fu->bcnt) {
case 0: case 1:
pr->bcnt = 1;
break;
default:
p1[1] = '\0';
badcnt(p1);
}
break;
case 'd': case 'i':
pr->flags = F_INT;
goto sw1;
case 'l':
++p2;
switch(p1[1]) {
case 'd': case 'i':
++p1;
pr->flags = F_INT;
goto sw1;
case 'o': case 'u': case 'x': case 'X':
++p1;
pr->flags = F_UINT;
goto sw1;
default:
p1[2] = '\0';
badconv(p1);
}
/* NOTREACHED */
case 'o': case 'u': case 'x': case 'X':
pr->flags = F_UINT;
sw1: switch(fu->bcnt) {
case 0: case 4:
pr->bcnt = 4;
break;
case 1:
pr->bcnt = 1;
break;
case 2:
pr->bcnt = 2;
break;
default:
p1[1] = '\0';
badcnt(p1);
}
break;
case 'e': case 'E': case 'f': case 'g': case 'G':
pr->flags = F_DBL;
switch(fu->bcnt) {
case 0: case 8:
pr->bcnt = 8;
break;
case 4:
pr->bcnt = 4;
break;
default:
p1[1] = '\0';
badcnt(p1);
}
break;
case 's':
pr->flags = F_STR;
switch(sokay) {
case NOTOKAY:
badsfmt();
case USEBCNT:
pr->bcnt = fu->bcnt;
break;
case USEPREC:
pr->bcnt = prec;
break;
}
break;
case '_':
++p2;
switch(p1[1]) {
case 'A':
endfu = fu;
fu->flags |= F_IGNORE;
/* FALLTHROUGH */
case 'a':
pr->flags = F_ADDRESS;
++p2;
switch(p1[2]) {
case 'd': case 'o': case'x':
*p1 = p1[2];
break;
default:
p1[3] = '\0';
badconv(p1);
}
break;
case 'c':
pr->flags = F_C;
/* *p1 = 'c'; set in conv_c */
goto sw2;
case 'p':
pr->flags = F_P;
*p1 = 'c';
goto sw2;
case 'u':
pr->flags = F_U;
/* *p1 = 'c'; set in conv_u */
sw2: switch(fu->bcnt) {
case 0: case 1:
pr->bcnt = 1;
break;
default:
p1[2] = '\0';
badcnt(p1);
}
break;
default:
p1[2] = '\0';
badconv(p1);
}
break;
default:
p1[1] = '\0';
badconv(p1);
}

/*
* copy to PR format string, set conversion character
* pointer, update original.
*/
savech = *p2;
p1[1] = '\0';
if (!(pr->fmt = strdup(fmtp)))
nomem();
*p2 = savech;
pr->cchar = pr->fmt + (p1 - fmtp);
fmtp = p2;

/* only one conversion character if byte count */
if (!(pr->flags&F_ADDRESS) && fu->bcnt && nconv++) {
(void)fprintf(stderr,
"hexdump: byte count with multiple conversion characters.\n");
exit(1);
}
}
/*
* if format unit byte count not specified, figure it out
* so can adjust rep count later.
*/
if (!fu->bcnt)
for (pr = fu->nextpr; pr; pr = pr->nextpr)
fu->bcnt += pr->bcnt;
}
/*
* if the format string interprets any data at all, and it's
* not the same as the blocksize, and its last format unit
* interprets any data at all, and has no iteration count,
* repeat it as necessary.
*
* if, rep count is greater than 1, no trailing whitespace
* gets output from the last iteration of the format unit.
*/
for (fu = fs->nextfu;; fu = fu->nextfu) {
if (!fu->nextfu && fs->bcnt < blocksize &&
!(fu->flags&F_SETREP) && fu->bcnt)
fu->reps += (blocksize - fs->bcnt) / fu->bcnt;
if (fu->reps > 1) {
for (pr = fu->nextpr;; pr = pr->nextpr)
if (!pr->nextpr)
break;
for (p1 = pr->fmt, p2 = NULL; *p1; ++p1)
p2 = isspace(*p1) ? p1 : NULL;
if (p2)
pr->nospace = p2;
}
if (!fu->nextfu)
break;
}
}


escape(p1)
register char *p1;
{
register char *p2;

/* alphabetic escape sequences have to be done in place */
for (p2 = p1;; ++p1, ++p2) {
if (!*p1) {
*p2 = *p1;
break;
}
if (*p1 == '\\')
switch(*++p1) {
case 'a':
/* *p2 = '\a'; */
*p2 = '\007';
break;
case 'b':
*p2 = '\b';
break;
case 'f':
*p2 = '\f';
break;
case 'n':
*p2 = '\n';
break;
case 'r':
*p2 = '\r';
break;
case 't':
*p2 = '\t';
break;
case 'v':
*p2 = '\v';
break;
default:
*p2 = *p1;
break;
}
}
}

badcnt(s)
char *s;
{
(void)fprintf(stderr,
"hexdump: bad byte count for conversion character %s.\n", s);
exit(1);
}

badsfmt()
{
(void)fprintf(stderr,
"hexdump: %%s requires a precision or a byte count.\n");
exit(1);
}

badfmt(fmt)
char *fmt;
{
(void)fprintf(stderr, "hexdump: bad format {%s}\n", fmt);
exit(1);
}

badconv(ch)
char *ch;
{
(void)fprintf(stderr, "hexdump: bad conversion character %%%s.\n", ch);
exit(1);
}
src/utila-1.0/true.1 600 0 0 4723 5225143422 12313 0ustar rootroot.\" Copyright (c) 1983, 1985, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)true.1 6.4 (Berkeley) 6/27/91
.\"
.Dd June 27, 1991
.Dt TRUE 1
.Os
.Sh NAME
.Nm true
.Nd Return true value.
.Sh SYNOPSIS
.Nm true
.Sh DESCRIPTION
.Nm True
is normally used in a Bourne shell script.
.Nm True
tests for the appropriate status "false" before running
(or failing to run) a list of commands.
.Sh SEE ALSO
.Xr csh 1 ,
.Xr sh 1 ,
.Xr false 1
.Sh DIAGNOSTICS
The
.Nm true
utility always returns with exit code zero.
.Sh STANDARDS
The
.Nm true
function is expected to be POSIX 1003.2 compatible.
src/utila-1.0/README.col 600 0 0 4236 5225143444 12711 0ustar rootroot# @(#)README 5.1 (Berkeley) 5/22/90

col - filter out reverse line feeds.

Options are:
-b do not print any backspaces (last character written is printed)
-f allow half line feeds in output, by default characters between
lines are pushed to the line below
-x do not compress spaces into tabs.
-l num keep (at least) num lines in memory, 128 are kept by default

In the 32V source code to col(1) the default behavior was to NOT compress
spaces into tabs. There was a -h option which caused it to compress spaces
into tabs. There was no -x flag.

The 32V documentation, however, was consistent with the SVID (actually, V7
at the time) and documented a -x flag (as defined above) while making no
mention of a -h flag. Just before 4.3BSD went out, CSRG updated the manual
page to reflect the way the code worked. Suspecting that this was probably
the wrong way to go, this version adopts the SVID defaults, and no longer
documents the -h option.

The S5 -p flag is not supported because it isn't clear what it does (looks
like a kludge introduced for a particular printer).

Known differences between AT&T's col and this one (# is delimiter):
Input AT&T col this col
#\nabc\E7def\n# # def\nabc\r# # def\nabc\n#
#a# ## #a\n#
- last line always ends with at least one \n (or \E9)
#1234567 8\n# #1234567\t8\n# #1234567 8\n#
- single space not expanded to tab
-f #a\E8b\n# #ab\n# # b\E9\ra\n#
- can back up past first line (as far as you want) so you
*can* have a super script on the first line
#\E9_\ba\E8\nb\n# #\n_\bb\ba\n# #\n_\ba\bb\n#
- always print last character written to a position,
AT&T col claims to do this but doesn't.

If a character is to be placed on a line that has been flushed, a warning
is produced (the AT&T col is silent). The -l flag (not in AT&T col) can
be used to increase the number of lines buffered to avoid the problem.

General algorithm: a limited number of lines are buffered in a linked
list. When a printable character is read, it is put in the buffer of
the current line along with the column it's supposed to be in. When
a line is flushed, the characters in the line are sorted according to
column and then printed.
src/utila-1.0/col.c 600 0 0 30027 5225143422 12207 0ustar rootroot/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Michael Rendell of the Memorial University of Newfoundland.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1990 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)col.c 5.3 (Berkeley) 2/2/91";
#endif /* not lint */

#include
#include
#include
#include

#define BS '\b' /* backspace */
#define TAB '\t' /* tab */
#define SPACE ' ' /* space */
#define NL '\n' /* newline */
#define CR '\r' /* carriage return */
#define ESC '\033' /* escape */
#define SI '\017' /* shift in to normal character set */
#define SO '\016' /* shift out to alternate character set */
#define VT '\013' /* vertical tab (aka reverse line feed) */
#define RLF '\007' /* ESC-07 reverse line feed */
#define RHLF '\010' /* ESC-010 reverse half-line feed */
#define FHLF '\011' /* ESC-011 forward half-line feed */

/* build up at least this many lines before flushing them out */
#define BUFFER_MARGIN 32

typedef char CSET;

typedef struct char_str {
#define CS_NORMAL 1
#define CS_ALTERNATE 2
short c_column; /* column character is in */
CSET c_set; /* character set (currently only 2) */
char c_char; /* character in question */
} CHAR;

typedef struct line_str LINE;
struct line_str {
CHAR *l_line; /* characters on the line */
LINE *l_prev; /* previous line */
LINE *l_next; /* next line */
int l_lsize; /* allocated sizeof l_line */
int l_line_len; /* strlen(l_line) */
int l_needs_sort; /* set if chars went in out of order */
int l_max_col; /* max column in the line */
};

LINE *alloc_line();
void *xmalloc();

CSET last_set; /* char_set of last char printed */
LINE *lines;
int compress_spaces; /* if doing space -> tab conversion */
int fine; /* if `fine' resolution (half lines) */
int max_bufd_lines; /* max # lines to keep in memory */
int nblank_lines; /* # blanks after last flushed line */
int no_backspaces; /* if not to output any backspaces */

#define PUTC(ch) \
if (putchar(ch) == EOF) \
wrerr();

main(argc, argv)
int argc;
char **argv;
{
extern int optind;
extern char *optarg;
register int ch;
CHAR *c;
CSET cur_set; /* current character set */
LINE *l; /* current line */
int extra_lines; /* # of lines above first line */
int cur_col; /* current column */
int cur_line; /* line number of current position */
int max_line; /* max value of cur_line */
int this_line; /* line l points to */
int nflushd_lines; /* number of lines that were flushed */
int adjust, opt, warned;

max_bufd_lines = 128;
compress_spaces = 1; /* compress spaces into tabs */
while ((opt = getopt(argc, argv, "bfhl:x")) != EOF)
switch (opt) {
case 'b': /* do not output backspaces */
no_backspaces = 1;
break;
case 'f': /* allow half forward line feeds */
fine = 1;
break;
case 'h': /* compress spaces into tabs */
compress_spaces = 1;
break;
case 'l': /* buffered line count */
if ((max_bufd_lines = atoi(optarg)) <= 0) {
(void)fprintf(stderr,
"col: bad -l argument %s.\n", optarg);
exit(1);
}
break;
case 'x': /* do not compress spaces into tabs */
compress_spaces = 0;
break;
case '?':
default:
usage();
}

if (optind != argc)
usage();

/* this value is in half lines */
max_bufd_lines *= 2;

adjust = cur_col = extra_lines = warned = 0;
cur_line = max_line = nflushd_lines = this_line = 0;
cur_set = last_set = CS_NORMAL;
lines = l = alloc_line();

while ((ch = getchar()) != EOF) {
if (!isgraph(ch)) {
switch (ch) {
case BS: /* can't go back further */
if (cur_col == 0)
continue;
--cur_col;
continue;
case CR:
cur_col = 0;
continue;
case ESC: /* just ignore EOF */
switch(getchar()) {
case RLF:
cur_line -= 2;
break;
case RHLF:
cur_line--;
break;
case FHLF:
cur_line++;
if (cur_line > max_line)
max_line = cur_line;
}
continue;
case NL:
cur_line += 2;
if (cur_line > max_line)
max_line = cur_line;
cur_col = 0;
continue;
case SPACE:
++cur_col;
continue;
case SI:
cur_set = CS_NORMAL;
continue;
case SO:
cur_set = CS_ALTERNATE;
continue;
case TAB: /* adjust column */
cur_col |= 7;
++cur_col;
continue;
case VT:
cur_line -= 2;
continue;
}
continue;
}

/* Must stuff ch in a line - are we at the right one? */
if (cur_line != this_line - adjust) {
LINE *lnew;
int nmove;

adjust = 0;
nmove = cur_line - this_line;
if (!fine) {
/* round up to next line */
if (cur_line & 1) {
adjust = 1;
nmove++;
}
}
if (nmove < 0) {
for (; nmove < 0 && l->l_prev; nmove++)
l = l->l_prev;
if (nmove) {
if (nflushd_lines == 0) {
/*
* Allow backup past first
* line if nothing has been
* flushed yet.
*/
for (; nmove < 0; nmove++) {
lnew = alloc_line();
l->l_prev = lnew;
lnew->l_next = l;
l = lines = lnew;
extra_lines++;
}
} else {
if (!warned++)
warn(cur_line);
cur_line -= nmove;
}
}
} else {
/* may need to allocate here */
for (; nmove > 0 && l->l_next; nmove--)
l = l->l_next;
for (; nmove > 0; nmove--) {
lnew = alloc_line();
lnew->l_prev = l;
l->l_next = lnew;
l = lnew;
}
}
this_line = cur_line + adjust;
nmove = this_line - nflushd_lines;
if (nmove >= max_bufd_lines + BUFFER_MARGIN) {
nflushd_lines += nmove - max_bufd_lines;
flush_lines(nmove - max_bufd_lines);
}
}
/* grow line's buffer? */
if (l->l_line_len + 1 >= l->l_lsize) {
int need;

need = l->l_lsize ? l->l_lsize * 2 : 90;
l->l_line = (CHAR *)xmalloc((void *) l->l_line,
(unsigned) need * sizeof(CHAR));
l->l_lsize = need;
}
c = &l->l_line[l->l_line_len++];
c->c_char = ch;
c->c_set = cur_set;
c->c_column = cur_col;
/*
* If things are put in out of order, they will need sorting
* when it is flushed.
*/
if (cur_col < l->l_max_col)
l->l_needs_sort = 1;
else
l->l_max_col = cur_col;
cur_col++;
}
/* goto the last line that had a character on it */
for (; l->l_next; l = l->l_next)
this_line++;
flush_lines(this_line - nflushd_lines + extra_lines + 1);

/* make sure we leave things in a sane state */
if (last_set != CS_NORMAL)
PUTC('\017');

/* flush out the last few blank lines */
nblank_lines = max_line - this_line;
if (max_line & 1)
nblank_lines++;
else if (!nblank_lines)
/* missing a \n on the last line? */
nblank_lines = 2;
flush_blanks();
exit(0);
}

flush_lines(nflush)
int nflush;
{
LINE *l;

while (--nflush >= 0) {
l = lines;
lines = l->l_next;
if (l->l_line) {
flush_blanks();
flush_line(l);
}
nblank_lines++;
if (l->l_line)
(void)free((void *)l->l_line);
free_line(l);
}
if (lines)
lines->l_prev = NULL;
}

/*
* Print a number of newline/half newlines. If fine flag is set, nblank_lines
* is the number of half line feeds, otherwise it is the number of whole line
* feeds.
*/
flush_blanks()
{
int half, i, nb;

half = 0;
nb = nblank_lines;
if (nb & 1) {
if (fine)
half = 1;
else
nb++;
}
nb /= 2;
for (i = nb; --i >= 0;)
PUTC('\n');
if (half) {
PUTC('\033');
PUTC('9');
if (!nb)
PUTC('\r');
}
nblank_lines = 0;
}

/*
* Write a line to stdout taking care of space to tab conversion (-h flag)
* and character set shifts.
*/
flush_line(l)
LINE *l;
{
CHAR *c, *endc;
int nchars, last_col, this_col;

last_col = 0;
nchars = l->l_line_len;

if (l->l_needs_sort) {
static CHAR *sorted;
static int count_size, *count, i, save, sorted_size, tot;

/*
* Do an O(n) sort on l->l_line by column being careful to
* preserve the order of characters in the same column.
*/
if (l->l_lsize > sorted_size) {
sorted_size = l->l_lsize;
sorted = (CHAR *)xmalloc((void *)sorted,
(unsigned)sizeof(CHAR) * sorted_size);
}
if (l->l_max_col >= count_size) {
count_size = l->l_max_col + 1;
count = (int *)xmalloc((void *)count,
(unsigned)sizeof(int) * count_size);
}
bzero((char *)count, sizeof(int) * l->l_max_col + 1);
for (i = nchars, c = l->l_line; --i >= 0; c++)
count[c->c_column]++;

/*
* calculate running total (shifted down by 1) to use as
* indices into new line.
*/
for (tot = 0, i = 0; i <= l->l_max_col; i++) {
save = count[i];
count[i] = tot;
tot += save;
}

for (i = nchars, c = l->l_line; --i >= 0; c++)
sorted[count[c->c_column]++] = *c;
c = sorted;
} else
c = l->l_line;
while (nchars > 0) {
this_col = c->c_column;
endc = c;
do {
++endc;
} while (--nchars > 0 && this_col == endc->c_column);

/* if -b only print last character */
if (no_backspaces)
c = endc - 1;

if (this_col > last_col) {
int nspace = this_col - last_col;

if (compress_spaces && nspace > 1) {
int ntabs;

ntabs = this_col / 8 - last_col / 8;
nspace -= ntabs * 8;
while (--ntabs >= 0)
PUTC('\t');
}
while (--nspace >= 0)
PUTC(' ');
last_col = this_col;
}
last_col++;

for (;;) {
if (c->c_set != last_set) {
switch (c->c_set) {
case CS_NORMAL:
PUTC('\017');
break;
case CS_ALTERNATE:
PUTC('\016');
}
last_set = c->c_set;
}
PUTC(c->c_char);
if (++c >= endc)
break;
PUTC('\b');
}
}
}

#define NALLOC 64

static LINE *line_freelist;

LINE *
alloc_line()
{
LINE *l;
int i;

if (!line_freelist) {
l = (LINE *)xmalloc((void *)NULL, sizeof(LINE) * NALLOC);
line_freelist = l;
for (i = 1; i < NALLOC; i++, l++)
l->l_next = l + 1;
l->l_next = NULL;
}
l = line_freelist;
line_freelist = l->l_next;

bzero(l, sizeof(LINE));
return(l);
}

free_line(l)
LINE *l;
{
l->l_next = line_freelist;
line_freelist = l;
}

void *
xmalloc(p, size)
void *p;
size_t size;
{
if (!(p = (void *)realloc(p, size))) {
(void)fprintf(stderr, "col: %s.\n", strerror(ENOMEM));
exit(1);
}
return(p);
}

usage()
{
(void)fprintf(stderr, "usage: col [-bfx] [-l nline]\n");
exit(1);
}

wrerr()
{
(void)fprintf(stderr, "col: write error.\n");
exit(1);
}

warn(line)
int line;
{
(void)fprintf(stderr,
"col: warning: can't back up %s.\n", line < 0 ?
"past first line" : "-- line already flushed");
}
src/utila-1.0/colcrt.1 600 0 0 7120 5225143422 12614 0ustar rootroot.\" Copyright (c) 1980, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)colcrt.1 6.7 (Berkeley) 3/14/91
.\"
.Dd March 14, 1991
.Dt COLCRT 1
.Os BSD 3
.Sh NAME
.Nm colcrt
.Nd filter nroff output for CRT previewing
.Sh SYNOPSIS
.Nm colcrt
.Op Fl
.Op Fl \&2
.Op Ar
.Sh DESCRIPTION
.Nm Colcrt
provides virtual half-line and reverse line feed sequences
for terminals without such capability, and on which overstriking
is destructive.
Half-line characters and underlining (changed to dashing `\-')
are placed on new lines in between the normal output lines.
.Pp
Available options:
.Bl -tag -width Ds
.It Fl
Suppress all underlining.
It is especially useful for previewing
.Em allboxed
tables from
.Xr tbl 1 .
.It Fl 2
Causes all half-lines to be printed, effectively double spacing the output.
Normally, a minimal space output format is used which will suppress empty
lines.
The program never suppresses two consecutive empty lines, however.
The
.Fl 2
option is useful for sending output to the line printer when the output
contains superscripts and subscripts which would otherwise be invisible.
.El
.Sh EXAMPLES
A typical use of
.Nm colcrt
would be
.Bd -literal
tbl exum2.n \&| nroff \-ms \&| colcrt \- \&| more
.Ed
.Sh SEE ALSO
.Xr nroff 1 ,
.Xr troff 1 ,
.Xr col 1 ,
.Xr more 1 ,
.Xr ul 1
.Sh BUGS
Should fold underlines onto blanks even with the
.Ql Fl
option so that
a true underline character would show; if we did this, however,
.Nm colcrt
wouldn't get rid of
.Ar cu Ns 'd
underlining
completely.
.Pp
Can't back up more than 102 lines.
.Pp
General overstriking is lost;
as a special case
.Ql \&|
overstruck with
.Ql \-
or underline becomes
.Ql \&+ .
.Pp
Lines are trimmed to 132 characters.
.Pp
Some provision should be made for processing superscripts and subscripts
in documents which are already double-spaced.
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3.0 .
src/utila-1.0/colcrt.c 600 0 0 12752 5225143422 12725 0ustar rootroot/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)colcrt.c 5.4 (Berkeley) 6/1/90";
#endif /* not lint */

#include
/*
* colcrt - replaces col for crts with new nroff esp. when using tbl.
* Bill Joy UCB July 14, 1977
*
* This filter uses a screen buffer, 267 half-lines by 132 columns.
* It interprets the up and down sequences generated by the new
* nroff when used with tbl and by \u \d and \r.
* General overstriking doesn't work correctly.
* Underlining is split onto multiple lines, etc.
*
* Option - suppresses all underlining.
* Option -2 forces printing of all half lines.
*/

char page[267][132];

int outline = 1;
int outcol;

char suppresul;
char printall;

char *progname;
FILE *f;

main(argc, argv)
int argc;
char *argv[];
{
register c;
register char *cp, *dp;

argc--;
progname = *argv++;
while (argc > 0 && argv[0][0] == '-') {
switch (argv[0][1]) {
case 0:
suppresul = 1;
break;
case '2':
printall = 1;
break;
default:
printf("usage: %s [ - ] [ -2 ] [ file ... ]\n", progname);
fflush(stdout);
exit(1);
}
argc--;
argv++;
}
do {
if (argc > 0) {
close(0);
if (!(f = fopen(argv[0], "r"))) {
fflush(stdout);
perror(argv[0]);
exit (1);
}
argc--;
argv++;
}
for (;;) {
c = getc(stdin);
if (c == -1) {
pflush(outline);
fflush(stdout);
break;
}
switch (c) {
case '\n':
if (outline >= 265)
pflush(62);
outline += 2;
outcol = 0;
continue;
case '\016':
case '\017':
continue;
case 033:
c = getc(stdin);
switch (c) {
case '9':
if (outline >= 266)
pflush(62);
outline++;
continue;
case '8':
if (outline >= 1)
outline--;
continue;
case '7':
outline -= 2;
if (outline < 0)
outline = 0;
continue;
default:
continue;
}
case '\b':
if (outcol)
outcol--;
continue;
case '\t':
outcol += 8;
outcol &= ~7;
outcol--;
c = ' ';
default:
if (outcol >= 132) {
outcol++;
continue;
}
cp = &page[outline][outcol];
outcol++;
if (c == '_') {
if (suppresul)
continue;
cp += 132;
c = '-';
}
if (*cp == 0) {
*cp = c;
dp = cp - outcol;
for (cp--; cp >= dp && *cp == 0; cp--)
*cp = ' ';
} else
if (plus(c, *cp) || plus(*cp, c))
*cp = '+';
else if (*cp == ' ' || *cp == 0)
*cp = c;
continue;
}
}
} while (argc > 0);
fflush(stdout);
exit(0);
}

plus(c, d)
char c, d;
{

return (c == '|' && d == '-' || d == '_');
}

int first;

pflush(ol)
int ol;
{
register int i, j;
register char *cp;
char lastomit;
int l;

l = ol;
lastomit = 0;
if (l > 266)
l = 266;
else
l |= 1;
for (i = first | 1; i < l; i++) {
move(i, i - 1);
move(i, i + 1);
}
for (i = first; i < l; i++) {
cp = page[i];
if (printall == 0 && lastomit == 0 && *cp == 0) {
lastomit = 1;
continue;
}
lastomit = 0;
printf("%s\n", cp);
}
bcopy(page[ol], page, (267 - ol) * 132);
bzero(page[267- ol], ol * 132);
outline -= ol;
outcol = 0;
first = 1;
}

move(l, m)
int l, m;
{
register char *cp, *dp;

for (cp = page[l], dp = page[m]; *cp; cp++, dp++) {
switch (*cp) {
case '|':
if (*dp != ' ' && *dp != '|' && *dp != 0)
return;
break;
case ' ':
break;
default:
return;
}
}
if (*cp == 0) {
for (cp = page[l], dp = page[m]; *cp; cp++, dp++)
if (*cp == '|')
*dp = '|';
else if (*dp == 0)
*dp = ' ';
page[l][0] = 0;
}
}
src/utila-1.0/colrm.1 600 0 0 4772 5225143422 12454 0ustar rootroot.\" Copyright (c) 1980, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)colrm.1 6.6 (Berkeley) 3/14/91
.\"
.Dd March 14, 1991
.Dt COLRM 1
.Os BSD 3
.Sh NAME
.Nm colrm
.Nd remove columns from a file
.Sh SYNOPSIS
.Nm colrm
.Op Ar startcol Op Ar endcol
.Sh DESCRIPTION
.Nm Colrm
removes selected columns from a file. Input is taken from standard input.
Output is sent to standard output.
.Pp
If called with one parameter the columns
of each line will be removed starting with the specified column.
If called with two parameters the columns from the first column
to the last column will be removed.
.Pp
Column numbering starts with column 1.
.Sh SEE ALSO
.Xr awk 1 ,
.Xr column 1 ,
.Xr expand 1 ,
.Xr paste 1
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3.0 .
src/utila-1.0/colrm.c 600 0 0 6250 5225143422 12527 0ustar rootroot/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)colrm.c 5.4 (Berkeley) 6/1/90";
#endif /* not lint */

#include
/*
COLRM removes unwanted columns from a file
Jeff Schriebman UC Berkeley 11-74
*/


main(argc,argv)
char **argv;
{
register c, ct, first, last;

first = 0;
last = 0;
if (argc > 1)
first = getn(*++argv);
if (argc > 2)
last = getn(*++argv);

start:
ct = 0;
loop1:
c = getc(stdin);
if (feof(stdin))
goto fin;
if (c == '\t')
ct = (ct + 8) & ~7;
else if (c == '\b')
ct = ct ? ct - 1 : 0;
else
ct++;
if (c == '\n') {
putc(c, stdout);
goto start;
}
if (!first || ct < first) {
putc(c, stdout);
goto loop1;
}

/* Loop getting rid of characters */
while (!last || ct < last) {
c = getc(stdin);
if (feof(stdin))
goto fin;
if (c == '\n') {
putc(c, stdout);
goto start;
}
if (c == '\t')
ct = (ct + 8) & ~7;
else if (c == '\b')
ct = ct ? ct - 1 : 0;
else
ct++;
}

/* Output last of the line */
for (;;) {
c = getc(stdin);
if (feof(stdin))
break;
putc(c, stdout);
if (c == '\n')
goto start;
}
fin:
fflush(stdout);
exit(0);
}

getn(ap)
char *ap;
{
register int n,c;
register char *p;

p = ap;
n = 0;
while ((c = *p++) >= '0' && c <= '9')
n = n*10 + c - '0';
return(n);
}
src/utila-1.0/column.1 600 0 0 6241 5225143422 12626 0ustar rootroot.\" Copyright (c) 1989, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)column.1 5.8 (Berkeley) 3/14/91
.\"
.Dd March 14, 1991
.Os
.Dt COLUMN 1
.Sh NAME
.Nm column
.Nd columnate lists
.Sh SYNOPSIS
.Nm column
.Op Fl c Ns Ar columns
.Op Fl s Ns Ar sep
.Op Fl tx
.Op Ar
.Sh DESCRIPTION
The
.Nm column
utility formats its input into multiple columns.
Rows are filled before columns.
Input is taken from
.Ar file
operands, or, by default, from the standard input.
Empty lines are ignored.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl c
Output is formatted for a display
.Ar columns
wide.
.It Fl s
Specify a set of characters to be used to delimit columns for the
.Fl t
option.
.It Fl t
Determine the number of columns the input contains and create a table.
Columns are delimited with whitespace, by default, or with the characters
supplied using the
.Fl s
option.
Useful for pretty-printing displays.
.It Fl x
Fill columns before filling rows.
.El
.Pp
.Nm Column
exits 0 on success, >0 if an error occurred.
.Sh ENVIRONMENT
.Bl -tag -width COLUMNS
.It Ev COLUMNS
The environment variable
.Ev COLUMNS
is used to determine the size of
the screen if no other information is available.
.El
.Sh EXAMPLES
.Dl (printf \&"PERM LINKS OWNER SIZE MONTH DAY HH:MM/YEAR NAME\en\&"\ \&;
.Dl ls -l \&| sed 1d) \&| column -t
.Sh SEE ALSO
.Xr colrm 1 ,
.Xr ls 1 ,
.Xr paste 1 ,
.Xr sort 1
.Sh HISTORY
The
.Nm
command appeared in
.Bx 4.3 Reno .
src/utila-1.0/column.c 600 0 0 16211 5225143422 12726 0ustar rootroot/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)column.c 5.7 (Berkeley) 2/24/91";
#endif /* not lint */

#include
#include
#include
#include
#include

int termwidth = 80; /* default terminal width */

int entries; /* number of records */
int eval; /* exit value */
int maxlength; /* longest record */
char **list; /* array of pointers to records */
char *separator = "\t "; /* field separator for table option */

main(argc, argv)
int argc;
char **argv;
{
extern char *optarg;
extern int errno, optind;
struct winsize win;
FILE *fp;
int ch, tflag, xflag;
char *p, *getenv();

if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) {
if (p = getenv("COLUMNS"))
termwidth = atoi(p);
} else
termwidth = win.ws_col;

xflag = 0;
while ((ch = getopt(argc, argv, "c:s:tx")) != EOF)
switch(ch) {
case 'c':
termwidth = atoi(optarg);
break;
case 's':
separator = optarg;
break;
case 't':
tflag = 1;
break;
case 'x':
xflag = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;

if (!*argv)
input(stdin);
else for (; *argv; ++argv)
if (fp = fopen(*argv, "r")) {
input(fp);
(void)fclose(fp);
} else {
(void)fprintf(stderr, "column: %s: %s\n", *argv,
strerror(errno));
eval = 1;
}

if (!entries)
exit(eval);

if (tflag)
maketbl();
else if (maxlength >= termwidth)
print();
else if (xflag)
c_columnate();
else
r_columnate();
exit(eval);
}

#define TAB 8
c_columnate()
{
register int chcnt, col, cnt, numcols;
int endcol;
char **lp;

maxlength = (maxlength + TAB) & ~(TAB - 1);
numcols = termwidth / maxlength;
endcol = maxlength;
for (chcnt = col = 0, lp = list;; ++lp) {
chcnt += printf("%s", *lp);
if (!--entries)
break;
if (++col == numcols) {
chcnt = col = 0;
endcol = maxlength;
putchar('\n');
} else {
while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) {
(void)putchar('\t');
chcnt = cnt;
}
endcol += maxlength;
}
}
if (chcnt)
putchar('\n');
}

r_columnate()
{
register int base, chcnt, cnt, col;
int endcol, numcols, numrows, row;

maxlength = (maxlength + TAB) & ~(TAB - 1);
numcols = termwidth / maxlength;
numrows = entries / numcols;
if (entries % numcols)
++numrows;

for (row = 0; row < numrows; ++row) {
endcol = maxlength;
for (base = row, chcnt = col = 0; col < numcols; ++col) {
chcnt += printf("%s", list[base]);
if ((base += numrows) >= entries)
break;
while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) {
(void)putchar('\t');
chcnt = cnt;
}
endcol += maxlength;
}
putchar('\n');
}
}

print()
{
register int cnt;
register char **lp;

for (cnt = entries, lp = list; cnt--; ++lp)
(void)printf("%s\n", *lp);
}

typedef struct _tbl {
char **list;
int cols, *len;
} TBL;
#define DEFCOLS 25

maketbl()
{
register TBL *t;
register int coloff, cnt;
register char *p, **lp;
int *lens, maxcols;
TBL *tbl;
char **cols, *emalloc(), *realloc();

t = tbl = (TBL *)emalloc(entries * sizeof(TBL));
cols = (char **)emalloc((maxcols = DEFCOLS) * sizeof(char *));
lens = (int *)emalloc(maxcols * sizeof(int));
for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) {
for (coloff = 0, p = *lp; cols[coloff] = strtok(p, separator);
p = NULL)
if (++coloff == maxcols) {
if (!(cols = (char **)realloc((char *)cols,
(u_int)maxcols + DEFCOLS * sizeof(char *))) ||
!(lens = (int *)realloc((char *)lens,
(u_int)maxcols + DEFCOLS * sizeof(int))))
nomem();
bzero((char *)lens + maxcols * sizeof(int),
DEFCOLS * sizeof(int));
maxcols += DEFCOLS;
}
t->list = (char **)emalloc(coloff * sizeof(char *));
t->len = (int *)emalloc(coloff * sizeof(int));
for (t->cols = coloff; --coloff >= 0;) {
t->list[coloff] = cols[coloff];
t->len[coloff] = strlen(cols[coloff]);
if (t->len[coloff] > lens[coloff])
lens[coloff] = t->len[coloff];
}
}
for (cnt = 0, t = tbl; cnt < entries; ++cnt, ++t) {
for (coloff = 0; coloff < t->cols - 1; ++coloff)
(void)printf("%s%*s", t->list[coloff],
lens[coloff] - t->len[coloff] + 2, " ");
(void)printf("%s\n", t->list[coloff]);
}
}

#define DEFNUM 1000
#define MAXLINELEN (2048 + 1)

input(fp)
register FILE *fp;
{
static int maxentry;
register int len;
register char *p;
char buf[MAXLINELEN], *emalloc(), *realloc();

if (!list)
list = (char **)emalloc((maxentry = DEFNUM) * sizeof(char *));
while (fgets(buf, MAXLINELEN, fp)) {
for (p = buf; *p && isspace(*p); ++p);
if (!*p)
continue;
if (!(p = index(p, '\n'))) {
(void)fprintf(stderr, "column: line too long.\n");
eval = 1;
continue;
}
*p = '\0';
len = p - buf;
if (maxlength < len)
maxlength = len;
if (entries == maxentry) {
maxentry += DEFNUM;
if (!(list =
(char **)realloc((char *)list,
(u_int)maxentry * sizeof(char *))))
nomem();
}
list[entries++] = strdup(buf);
}
}

char *
emalloc(size)
int size;
{
char *p, *malloc();

/* NOSTRICT */
if (!(p = malloc((u_int)size)))
nomem();
bzero(p, size);
return(p);
}

nomem()
{
(void)fprintf(stderr, "column: out of memory.\n");
exit(1);
}

usage()
{
(void)fprintf(stderr,
"usage: column [-tx] [-c columns] [file ...]\n");
exit(1);
}
src/utila-1.0/conv.c 600 0 0 6762 5225143236 12373 0ustar rootroot/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
static char sccsid[] = "@(#)conv.c 5.4 (Berkeley) 6/1/90";
#endif /* not lint */

#include
#include
#include "hexdump.h"

conv_c(pr, p)
PR *pr;
u_char *p;
{
extern int deprecated;
char buf[10], *str;

switch(*p) {
case '\0':
str = "\\0";
goto strpr;
/* case '\a': */
case '\007':
if (deprecated) /* od didn't know about \a */
break;
str = "\\a";
goto strpr;
case '\b':
str = "\\b";
goto strpr;
case '\f':
str = "\\f";
goto strpr;
case '\n':
str = "\\n";
goto strpr;
case '\r':
str = "\\r";
goto strpr;
case '\t':
str = "\\t";
goto strpr;
case '\v':
if (deprecated)
break;
str = "\\v";
goto strpr;
default:
break;
}
if (isprint(*p)) {
*pr->cchar = 'c';
(void)printf(pr->fmt, *p);
} else {
(void)sprintf(str = buf, "%03o", (int)*p);
strpr: *pr->cchar = 's';
(void)printf(pr->fmt, str);
}
}

conv_u(pr, p)
PR *pr;
u_char *p;
{
extern int deprecated;
static char *list[] = {
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
"bs", "ht", "lf", "vt", "ff", "cr", "so", "si",
"dle", "dcl", "dc2", "dc3", "dc4", "nak", "syn", "etb",
"can", "em", "sub", "esc", "fs", "gs", "rs", "us",
};

/* od used nl, not lf */
if (*p <= 0x1f) {
*pr->cchar = 's';
if (deprecated && *p == 0x0a)
(void)printf(pr->fmt, "nl");
else
(void)printf(pr->fmt, list[*p]);
} else if (*p == 0x7f) {
*pr->cchar = 's';
(void)printf(pr->fmt, "del");
} else if (deprecated && *p == 0x20) { /* od replace space with sp */
*pr->cchar = 's';
(void)printf(pr->fmt, " sp");
} else if (isprint(*p)) {
*pr->cchar = 'c';
(void)printf(pr->fmt, *p);
} else {
*pr->cchar = 'x';
(void)printf(pr->fmt, (int)*p);
}
}
src/utila-1.0/false.c 600 0 0 4060 5225143422 12502 0ustar rootroot/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)false.c 5.2 (Berkeley) 6/1/90";
#endif /* not lint */

main()
{
exit(1);
}
src/utila-1.0/hexdump.1 600 0 0 24400 5225143236 13023 0ustar rootroot.\" Copyright (c) 1989, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)hexdump.1 5.12 (Berkeley) 7/27/91
.\"
.Dd July 27, 1991
.Dt HEXDUMP 1
.Os
.Sh NAME
.Nm hexdump
.Nd ascii, decimal, hexadecimal, octal dump
.Sh SYNOPSIS
.Nm hexdump
.Op Fl bcdovx
.Op Fl e Ar format_string
.Op Fl f Ar format_file
.Op Fl n Ar length
.Bk -words
.Op Fl s Ar skip
.Ek
.Ar file ...
.Sh DESCRIPTION
The hexdump utility is a filter which displays the specified files, or
the standard input, if no files are specified, in a user specified
format.
.Pp
The options are as follows:
.Bl -tag -width Fl
.It Fl b
.Em One-byte octal display .
Display the input offset in hexadecimal, followed by sixteen
space-separated, three column, zero-filled, bytes of input data,
in octal, per line.
.It Fl c
.Em One-byte character display .
Display the input offset in hexadecimal, followed by sixteen
space-separated, three column, space-filled, characters of input
data per line.
.It Fl d
.Em Two-byte decimal display.
Display the input offset in hexadecimal, followed by eight
space-separated, five column, zero-filled, two-byte units
of input data, in unsigned decimal, per line.
.It Fl e Ar format_string
Specify a format string to be used for displaying data.
.It Fl f Ar format_file
Specify a file that contains one or more newline separated format strings.
Empty lines and lines whose first non-blank character is a hash mark
.Pf ( Cm \&# )
are ignored.
.It Fl n Ar length
Interpret only
.Ar length
bytes of input.
.It Fl o
.Em Two-byte octal display.
Display the input offset in hexadecimal, followed by eight
space-separated, six column, zero-filled, two byte quantities of
input data, in octal, per line.
.It Fl s Ar offset
Skip
.Ar offset
bytes from the beginning of the input.
By default,
.Ar offset
is interpreted as a decimal number.
With a leading
.Cm 0x
or
.Cm 0X ,
.Ar offset
is interpreted as a hexadecimal number,
otherwise, with a leading
.Cm 0 ,
.Ar offset
is interpreted as an octal number.
Appending the character
.Cm b ,
.Cm k ,
or
.Cm m
to
.Ar offset
causes it to be interpreted as a multiple of
.Li 512 ,
.Li 1024 ,
or
.Li 1048576 ,
respectively.
.It Fl v
The
.Fl v
option causes hexdump to display all input data.
Without the
.Fl v
option, any number of groups of output lines, which would be
identical to the immediately preceding group of output lines (except
for the input offsets), are replaced with a line comprised of a
single asterisk.
.It Fl x
.Em Two-byte hexadecimal display.
Display the input offset in hexadecimal, followed by eight, space
separated, four column, zero-filled, two-byte quantities of input
data, in hexadecimal, per line.
.El
.Pp
For each input file,
.Nm hexdump
sequentially copies the input to standard output, transforming the
data according to the format strings specified by the
.Fl e
and
.Fl f
options, in the order that they were specified.
.Ss Formats
A format string contains any number of format units, separated by
whitespace.
A format unit contains up to three items: an iteration count, a byte
count, and a format.
.Pp
The iteration count is an optional positive integer, which defaults to
one.
Each format is applied iteration count times.
.Pp
The byte count is an optional positive integer.
If specified it defines the number of bytes to be interpreted by
each iteration of the format.
.Pp
If an iteration count and/or a byte count is specified, a single slash
must be placed after the iteration count and/or before the byte count
to disambiguate them.
Any whitespace before or after the slash is ignored.
.Pp
The format is required and must be surrounded by double quote
(" ") marks.
It is interpreted as a fprintf-style format string (see
.Xr fprintf 3 ) ,
with the
following exceptions:
.Bl -bullet -offset indent
.It
An asterisk (*) may not be used as a field width or precision.
.It
A byte count or field precision
.Em is
required for each ``s'' conversion
character (unlike the
.Xr fprintf 3
default which prints the entire string if the precision is unspecified).
.It
The conversion characters ``h'', ``n'', and ``p'' are not
supported.
.It
The single character escape sequences
described in the C standard are supported:
.Bd -ragged -offset indent -compact
.Bl -column
.It NUL \e0
.It \ea
.It \eb
.It \ef
.It \en
.It \er
.It \et
.It \ev
.El
.Ed
.El
.Pp
Hexdump also supports the the following additional conversion strings:
.Bl -tag -width Fl
.It Cm \&_a Ns Op Cm dox
Display the input offset, cumulative across input files, of the
next byte to be displayed.
The appended characters
.Cm d ,
.Cm o ,
and
.Cm x
specify the display base
as decimal, octal or hexadecimal respectively.
.It Cm \&_A Ns Op Cm dox
Identical to the
.Cm \&_a
conversion string except that it is only performed
once, when all of the input data has been processed.
.It Cm \&_c
Output characters in the default character set.
Nonprinting characters are displayed in three character, zero-padded
octal, except for those representable by standard escape notation
(see above),
which are displayed as two character strings.
.It Cm _p
Output characters in the default character set.
Nonprinting characters are displayed as a single
.Dq Cm \&. .
.It Cm _u
Output US ASCII characters, with the exception that control characters are
displayed using the following, lower-case, names.
Characters greater than 0xff, hexadecimal, are displayed as hexadecimal
strings.
.Bl -column \&000_nu \&001_so \&002_st \&003_et \&004_eo
.It \&000\ nul\t001\ soh\t002\ stx\t003\ etx\t004\ eot\t005\ enq
.It \&006\ ack\t007\ bel\t008\ bs\t009\ ht\t00A\ lf\t00B\ vt
.It \&00C\ ff\t00D\ cr\t00E\ so\t00F\ si\t010\ dle\t011\ dc1
.It \&012\ dc2\t013\ dc3\t014\ dc4\t015\ nak\t016\ syn\t017\ etb
.It \&018\ can\t019\ em\t01A\ sub\t01B\ esc\t01C\ fs\t01D\ gs
.It \&01E\ rs\t01F\ us\t0FF\ del
.El
.El
.Pp
The default and supported byte counts for the conversion characters
are as follows:
.Bl -tag -width "Xc,_Xc,_Xc,_Xc,_Xc,_Xc" -offset indent
.It Li \&%_c , \&%_p , \&%_u , \&%c
One byte counts only.
.It Xo
.Li \&%d , \&%i , \&%o ,
.Li \&%u , \&%X , \&%x
.Xc
Four byte default, one and two byte counts supported.
.It Xo
.Li \&%E , \&%e , \&%f ,
.Li \&%G , \&%g
.Xc
Eight byte default, four byte counts supported.
.El
.Pp
The amount of data interpreted by each format string is the sum of the
data required by each format unit, which is the iteration count times the
byte count, or the iteration count times the number of bytes required by
the format if the byte count is not specified.
.Pp
The input is manipulated in ``blocks'', where a block is defined as the
largest amount of data specified by any format string.
Format strings interpreting less than an input block's worth of data,
whose last format unit both interprets some number of bytes and does
not have a specified iteration count, have the the interation count
incremented until the entire input block has been processed or there
is not enough data remaining in the block to satisfy the format string.
.Pp
If, either as a result of user specification or hexdump modifying
the iteration count as described above, an iteration count is
greater than one, no trailing whitespace characters are output
during the last iteration.
.Pp
It is an error to specify a byte count as well as multiple conversion
characters or strings unless all but one of the conversion characters
or strings is
.Cm \&_a
or
.Cm \&_A .
.Pp
If, as a result of the specification of the
.Fl n
option or end-of-file being reached, input data only partially
satisfies a format string, the input block is zero-padded sufficiently
to display all available data (i.e. any format units overlapping the
end of data will display some number of the zero bytes).
.Pp
Further output by such format strings is replaced by an equivalent
number of spaces.
An equivalent number of spaces is defined as the number of spaces
output by an
.Cm s
conversion character with the same field width
and precision as the original conversion character or conversion
string but with any
.Dq Li \&+ ,
.Dq \&\ \& ,
.Dq Li \&#
conversion flag characters
removed, and referencing a NULL string.
.Pp
If no format strings are specified, the default display is equivalent
to specifying the
.Fl x
option.
.Pp
.Nm hexdump
exits 0 on success and >0 if an error occurred.
.Sh EXAMPLES
Display the input in perusal format:
.Bd -literal -offset indent
"%06.6_ao " 12/1 "%3_u "
"\et\et" "%_p "
"\en"
.Ed
.Pp
Implement the \-x option:
.Bd -literal -offset indent
"%07.7_Ax\en"
"%07.7_ax " 8/2 "%04x " "\en"
.Ed
.Sh SEE ALSO
.Xr adb 1
.Sh STANDARDS
The
.Nm hexdump
utility is expected to be
.St -p1003.2
compatible.
src/utila-1.0/true.c 600 0 0 4057 5225143422 12375 0ustar rootroot/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)true.c 5.2 (Berkeley) 6/1/90";
#endif /* not lint */

main()
{
exit(0);
}
src/utila-1.0/ul.1 600 0 0 7156 5225143422 11757 0ustar rootroot.\" Copyright (c) 1980, 1991 Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)ul.1 6.3 (Berkeley) 4/23/91
.\"
.Dd April 23, 1991
.Dt UL 1
.Os BSD 4
.Sh NAME
.Nm ul
.Nd do underlining
.Sh SYNOPSIS
.Nm ul
.Op Fl i
.Op Fl t Ar terminal
.Op Ar name Ar ...
.Sh DESCRIPTION
.Nm Ul
reads the named files (or standard input if none are given)
and translates occurrences of underscores to the sequence
which indicates underlining for the terminal in use, as specified
by the environment variable
.Ev TERM .
The file
.Pa /etc/termcap
is read to determine the appropriate sequences for underlining.
If the terminal is incapable of underlining, but is capable of
a standout mode then that is used instead.
If the terminal can overstrike,
or handles underlining automatically,
.Nm ul
degenerates to
.Xr cat 1 .
If the terminal cannot underline, underlining is ignored.
.Pp
The following options are available:
.Bl -tag -width Ds
.It Fl i
Underlining is indicated by a separate line containing appropriate
dashes `\-'; this is useful when you want to look at the underlining
which is present in an
.Xr nroff
output stream on a crt-terminal.
.It Fl t Ar terminal
Overrides the terminal type specified in the environment with
.Ar terminal .
.El
.Sh ENVIRONMENT
The following environment variable is used:
.Bl -tag -width TERM
.It Ev TERM
The
.Ev TERM
variable is used to relate a tty device
with its device capability description (see
.Xr termcap 5 ) .
.Ev TERM
is set at login time, either by the default terminal type
specified in
.Pa /etc/ttys
or as set during the login process by the user in their
.Pa login
file (see
.Xr setenv 1 ) .
.El
.Sh SEE ALSO
.Xr man 1 ,
.Xr nroff 1 ,
.Xr colcrt 1
.Sh BUGS
.Xr Nroff
usually outputs a series of backspaces and underlines intermixed
with the text to indicate underlining. No attempt is made to optimize
the backward motion.
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3.0 .
src/utila-1.0/ul.c 600 0 0 24273 5225143422 12060 0ustar rootroot/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)ul.c 5.7 (Berkeley) 2/2/91";
#endif /* not lint */

#include

#define IESC '\033'
#define SO '\016'
#define SI '\017'
#define HFWD '9'
#define HREV '8'
#define FREV '7'
#define MAXBUF 512

#define NORMAL 000
#define ALTSET 001 /* Reverse */
#define SUPERSC 002 /* Dim */
#define SUBSC 004 /* Dim | Ul */
#define UNDERL 010 /* Ul */
#define BOLD 020 /* Bold */

int must_use_uc, must_overstrike;
char *CURS_UP, *CURS_RIGHT, *CURS_LEFT,
*ENTER_STANDOUT, *EXIT_STANDOUT, *ENTER_UNDERLINE, *EXIT_UNDERLINE,
*ENTER_DIM, *ENTER_BOLD, *ENTER_REVERSE, *UNDER_CHAR, *EXIT_ATTRIBUTES;

struct CHAR {
char c_mode;
char c_char;
} ;

struct CHAR obuf[MAXBUF];
int col, maxcol;
int mode;
int halfpos;
int upln;
int iflag;

int outchar();
#define PRINT(s) if (s == NULL) /* void */; else tputs(s, 1, outchar)

main(argc, argv)
int argc;
char **argv;
{
extern int optind;
extern char *optarg;
int c;
char *termtype;
FILE *f;
char termcap[1024];
char *getenv(), *strcpy();

termtype = getenv("TERM");
if (termtype == NULL || (argv[0][0] == 'c' && !isatty(1)))
termtype = "lpr";
while ((c=getopt(argc, argv, "it:T:")) != EOF)
switch(c) {

case 't':
case 'T': /* for nroff compatibility */
termtype = optarg;
break;
case 'i':
iflag = 1;
break;

default:
fprintf(stderr,
"usage: %s [ -i ] [ -tTerm ] file...\n",
argv[0]);
exit(1);
}

switch(tgetent(termcap, termtype)) {

case 1:
break;

default:
fprintf(stderr,"trouble reading termcap");
/* fall through to ... */

case 0:
/* No such terminal type - assume dumb */
(void)strcpy(termcap, "dumb:os:col#80:cr=^M:sf=^J:am:");
break;
}
initcap();
if ( (tgetflag("os") && ENTER_BOLD==NULL ) ||
(tgetflag("ul") && ENTER_UNDERLINE==NULL && UNDER_CHAR==NULL))
must_overstrike = 1;
initbuf();
if (optind == argc)
filter(stdin);
else for (; optind f = fopen(argv[optind],"r");
if (f == NULL) {
perror(argv[optind]);
exit(1);
} else
filter(f);
}
exit(0);
}

filter(f)
FILE *f;
{
register c;

while ((c = getc(f)) != EOF) switch(c) {

case '\b':
if (col > 0)
col--;
continue;

case '\t':
col = (col+8) & ~07;
if (col > maxcol)
maxcol = col;
continue;

case '\r':
col = 0;
continue;

case SO:
mode |= ALTSET;
continue;

case SI:
mode &= ~ALTSET;
continue;

case IESC:
switch (c = getc(f)) {

case HREV:
if (halfpos == 0) {
mode |= SUPERSC;
halfpos--;
} else if (halfpos > 0) {
mode &= ~SUBSC;
halfpos--;
} else {
halfpos = 0;
reverse();
}
continue;

case HFWD:
if (halfpos == 0) {
mode |= SUBSC;
halfpos++;
} else if (halfpos < 0) {
mode &= ~SUPERSC;
halfpos++;
} else {
halfpos = 0;
fwd();
}
continue;

case FREV:
reverse();
continue;

default:
fprintf(stderr,
"Unknown escape sequence in input: %o, %o\n",
IESC, c);
exit(1);
}
continue;

case '_':
if (obuf[col].c_char)
obuf[col].c_mode |= UNDERL | mode;
else
obuf[col].c_char = '_';
case ' ':
col++;
if (col > maxcol)
maxcol = col;
continue;

case '\n':
flushln();
continue;

case '\f':
flushln();
putchar('\f');
continue;

default:
if (c < ' ') /* non printing */
continue;
if (obuf[col].c_char == '\0') {
obuf[col].c_char = c;
obuf[col].c_mode = mode;
} else if (obuf[col].c_char == '_') {
obuf[col].c_char = c;
obuf[col].c_mode |= UNDERL|mode;
} else if (obuf[col].c_char == c)
obuf[col].c_mode |= BOLD|mode;
else
obuf[col].c_mode = mode;
col++;
if (col > maxcol)
maxcol = col;
continue;
}
if (maxcol)
flushln();
}

flushln()
{
register lastmode;
register i;
int hadmodes = 0;

lastmode = NORMAL;
for (i=0; i if (obuf[i].c_mode != lastmode) {
hadmodes++;
setmode(obuf[i].c_mode);
lastmode = obuf[i].c_mode;
}
if (obuf[i].c_char == '\0') {
if (upln)
PRINT(CURS_RIGHT);
else
outc(' ');
} else
outc(obuf[i].c_char);
}
if (lastmode != NORMAL) {
setmode(0);
}
if (must_overstrike && hadmodes)
overstrike();
putchar('\n');
if (iflag && hadmodes)
iattr();
(void)fflush(stdout);
if (upln)
upln--;
initbuf();
}

/*
* For terminals that can overstrike, overstrike underlines and bolds.
* We don't do anything with halfline ups and downs, or Greek.
*/
overstrike()
{
register int i;
char lbuf[256];
register char *cp = lbuf;
int hadbold=0;

/* Set up overstrike buffer */
for (i=0; i switch (obuf[i].c_mode) {
case NORMAL:
default:
*cp++ = ' ';
break;
case UNDERL:
*cp++ = '_';
break;
case BOLD:
*cp++ = obuf[i].c_char;
hadbold=1;
break;
}
putchar('\r');
for (*cp=' '; *cp==' '; cp--)
*cp = 0;
for (cp=lbuf; *cp; cp++)
putchar(*cp);
if (hadbold) {
putchar('\r');
for (cp=lbuf; *cp; cp++)
putchar(*cp=='_' ? ' ' : *cp);
putchar('\r');
for (cp=lbuf; *cp; cp++)
putchar(*cp=='_' ? ' ' : *cp);
}
}

iattr()
{
register int i;
char lbuf[256];
register char *cp = lbuf;

for (i=0; i switch (obuf[i].c_mode) {
case NORMAL: *cp++ = ' '; break;
case ALTSET: *cp++ = 'g'; break;
case SUPERSC: *cp++ = '^'; break;
case SUBSC: *cp++ = 'v'; break;
case UNDERL: *cp++ = '_'; break;
case BOLD: *cp++ = '!'; break;
default: *cp++ = 'X'; break;
}
for (*cp=' '; *cp==' '; cp--)
*cp = 0;
for (cp=lbuf; *cp; cp++)
putchar(*cp);
putchar('\n');
}

initbuf()
{

bzero((char *)obuf, sizeof (obuf)); /* depends on NORMAL == 0 */
col = 0;
maxcol = 0;
mode &= ALTSET;
}

fwd()
{
register oldcol, oldmax;

oldcol = col;
oldmax = maxcol;
flushln();
col = oldcol;
maxcol = oldmax;
}

reverse()
{
upln++;
fwd();
PRINT(CURS_UP);
PRINT(CURS_UP);
upln++;
}

initcap()
{
static char tcapbuf[512];
char *bp = tcapbuf;
char *getenv(), *tgetstr();

/* This nonsense attempts to work with both old and new termcap */
CURS_UP = tgetstr("up", &bp);
CURS_RIGHT = tgetstr("ri", &bp);
if (CURS_RIGHT == NULL)
CURS_RIGHT = tgetstr("nd", &bp);
CURS_LEFT = tgetstr("le", &bp);
if (CURS_LEFT == NULL)
CURS_LEFT = tgetstr("bc", &bp);
if (CURS_LEFT == NULL && tgetflag("bs"))
CURS_LEFT = "\b";

ENTER_STANDOUT = tgetstr("so", &bp);
EXIT_STANDOUT = tgetstr("se", &bp);
ENTER_UNDERLINE = tgetstr("us", &bp);
EXIT_UNDERLINE = tgetstr("ue", &bp);
ENTER_DIM = tgetstr("mh", &bp);
ENTER_BOLD = tgetstr("md", &bp);
ENTER_REVERSE = tgetstr("mr", &bp);
EXIT_ATTRIBUTES = tgetstr("me", &bp);

if (!ENTER_BOLD && ENTER_REVERSE)
ENTER_BOLD = ENTER_REVERSE;
if (!ENTER_BOLD && ENTER_STANDOUT)
ENTER_BOLD = ENTER_STANDOUT;
if (!ENTER_UNDERLINE && ENTER_STANDOUT) {
ENTER_UNDERLINE = ENTER_STANDOUT;
EXIT_UNDERLINE = EXIT_STANDOUT;
}
if (!ENTER_DIM && ENTER_STANDOUT)
ENTER_DIM = ENTER_STANDOUT;
if (!ENTER_REVERSE && ENTER_STANDOUT)
ENTER_REVERSE = ENTER_STANDOUT;
if (!EXIT_ATTRIBUTES && EXIT_STANDOUT)
EXIT_ATTRIBUTES = EXIT_STANDOUT;

/*
* Note that we use REVERSE for the alternate character set,
* not the as/ae capabilities. This is because we are modelling
* the model 37 teletype (since that's what nroff outputs) and
* the typical as/ae is more of a graphics set, not the greek
* letters the 37 has.
*/

UNDER_CHAR = tgetstr("uc", &bp);
must_use_uc = (UNDER_CHAR && !ENTER_UNDERLINE);
}

outchar(c)
int c;
{
putchar(c & 0177);
}

static int curmode = 0;

outc(c)
int c;
{
putchar(c);
if (must_use_uc && (curmode&UNDERL)) {
PRINT(CURS_LEFT);
PRINT(UNDER_CHAR);
}
}

setmode(newmode)
int newmode;
{
if (!iflag) {
if (curmode != NORMAL && newmode != NORMAL)
setmode(NORMAL);
switch (newmode) {
case NORMAL:
switch(curmode) {
case NORMAL:
break;
case UNDERL:
PRINT(EXIT_UNDERLINE);
break;
default:
/* This includes standout */
PRINT(EXIT_ATTRIBUTES);
break;
}
break;
case ALTSET:
PRINT(ENTER_REVERSE);
break;
case SUPERSC:
/*
* This only works on a few terminals.
* It should be fixed.
*/
PRINT(ENTER_UNDERLINE);
PRINT(ENTER_DIM);
break;
case SUBSC:
PRINT(ENTER_DIM);
break;
case UNDERL:
PRINT(ENTER_UNDERLINE);
break;
case BOLD:
PRINT(ENTER_BOLD);
break;
default:
/*
* We should have some provision here for multiple modes
* on at once. This will have to come later.
*/
PRINT(ENTER_STANDOUT);
break;
}
}
curmode = newmode;
}
src/utila-1.0/uuencode.1 600 0 0 6616 5225143422 13146 0ustar rootroot.\" Copyright (c) 1980, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)uuencode.1 6.9 (Berkeley) 4/23/91
.\"
.Dd April 23, 1991
.Dt UUENCODE 1
.Os BSD 4
.Sh NAME
.Nm uuencode ,
.Nm uudecode
.Nd encode/decode a binary file
.Sh SYNOPSIS
.Nm uuencode
.Op Ar file
.Ar name
.Nm uudecode
.Op Ar file ...
.Sh DESCRIPTION
.Nm Uuencode
and
.Nm uudecode
are used to transmit binary files over transmission mediums
that do not support other than simple
.Tn ASCII
data.
.Pp
.Nm Uuencode
reads
.Ar file
(or by default the standard input) and writes an encoded version
to the standard output.
The encoding uses only printing
.Tn ASCII
characters and includes the
mode of the file and the operand
.Ar name
for use by
.Nm uudecode .
.Pp
.Nm Uudecode
transforms
.Em uuencoded
files (or by default, the standard input) into the original form.
The resulting file is named
.Ar name
and will have the mode of the original file except that setuid
and execute bits are not retained.
.Nm Uudecode
ignores any leading and trailing lines.
.Sh EXAMPLES
The following example packages up a source tree, compresses it,
uuencodes it and mails it to a user on another system.
When
.Nm uudecode
is run on the target system, the file ``src_tree.tar.Z'' will be
created which may then be uncompressed and extracted into the original
tree.
.Pp
.Bd -literal -offset indent -compact
tar cf \- src_tree \&| compress \&|
uuencode src_tree.tar.Z \&| mail sys1!sys2!user
.Ed
.Sh SEE ALSO
.Xr compress 1 ,
.Xr mail 1 ,
.Xr uucp 1 ,
.Xr uuencode 5 ,
.Xr format 5
.Sh BUGS
The encoded form of the file is expanded by 35% (3 bytes become 4 plus
control information).
.Sh HISTORY
The
.Nm
command appeared in
.Bx 4.0 .
src/utila-1.0/uuencode.c 600 0 0 7547 5225143422 13234 0ustar rootroot/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
static char sccsid[] = "@(#)uuencode.c 5.9 (Berkeley) 6/1/90";
#endif /* not lint */

/*
* uuencode [input] output
*
* Encode a file so it can be mailed to a remote system.
*/
#include
#include
#include

main(argc, argv)
int argc;
char **argv;
{
extern int optind;
extern int errno;
struct stat sb;
int mode;
char *strerror();

while (getopt(argc, argv, "") != EOF)
usage();
argv += optind;
argc -= optind;

switch(argc) {
case 2: /* optional first argument is input file */
if (!freopen(*argv, "r", stdin) || fstat(fileno(stdin), &sb)) {
(void)fprintf(stderr, "uuencode: %s: %s.\n",
*argv, strerror(errno));
exit(1);
}
#define RWX (S_IRWXU|S_IRWXG|S_IRWXO)
mode = sb.st_mode & RWX;
++argv;
break;
case 1:
#define RW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
mode = RW & ~umask(RW);
break;
case 0:
default:
usage();
}

(void)printf("begin %o %s\n", mode, *argv);
encode();
(void)printf("end\n");
if (ferror(stdout)) {
(void)fprintf(stderr, "uuencode: write error.\n");
exit(1);
}
exit(0);
}

/* ENC is the basic 1 character encoding function to make a char printing */
#define ENC(c) ((c) ? ((c) & 077) + ' ': '`')

/*
* copy from in to out, encoding as you go along.
*/
encode()
{
register int ch, n;
register char *p;
char buf[80];

while (n = fread(buf, 1, 45, stdin)) {
ch = ENC(n);
if (putchar(ch) == EOF)
break;
for (p = buf; n > 0; n -= 3, p += 3) {
ch = *p >> 2;
ch = ENC(ch);
if (putchar(ch) == EOF)
break;
ch = (*p << 4) & 060 | (p[1] >> 4) & 017;
ch = ENC(ch);
if (putchar(ch) == EOF)
break;
ch = (p[1] << 2) & 074 | (p[2] >> 6) & 03;
ch = ENC(ch);
if (putchar(ch) == EOF)
break;
ch = p[2] & 077;
ch = ENC(ch);
if (putchar(ch) == EOF)
break;
}
if (putchar('\n') == EOF)
break;
}
if (ferror(stdin)) {
(void)fprintf(stderr, "uuencode: read error.\n");
exit(1);
}
ch = ENC('\0');
(void)putchar(ch);
(void)putchar('\n');
}

usage()
{
(void)fprintf(stderr,"usage: uuencode [infile] remotefile\n");
exit(1);
}
src/utila-1.0/whereis.1 600 0 0 7537 5225143422 13010 0ustar rootroot.\" Copyright (c) 1980, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)whereis.1 6.5 (Berkeley) 4/23/91
.\"
.Dd April 23, 1991
.Dt WHEREIS 1
.Os BSD 3
.Sh NAME
.Nm whereis
.Nd locate binary, manual, and or source for program
.Sh SYNOPSIS
.Nm whereis
.Op Fl bms
.Op Fl u
.Op Fl BMS Ar dir Ar ... Fl f
.Ar name Ar ...
.Sh DESCRIPTION
.Nm Whereis
locates source/binary and manuals sections for specified files.
The supplied names are first stripped of leading pathname components
and of any (single) trailing extension of the form
.Ql .ext ,
e.g.
.Ql \&.c .
Prefixes of
.Ql \&.s
resulting from use of source code control are also
dealt with.
.Nm Whereis
then attempts to locate the desired program in a list of standard places.
.Pp
Available options:
.Bl -tag -width Ds
.It Fl B
Change or limit directories searched for binaries. Requires the
.Fl f
flag.
.It Fl M
Change or limit directories searched for manual entries. Requires the
.Fl f
flag.
.It Fl S
Change or limit directories searched for source. Requires the
.Fl f
flag.
.It Fl b
Search for binaries.
.It Fl f
Signals the end of a directory list specified by one or more of the
.Fl B , M
or
.Fl S
options and the start of file
.Ar names .
.It Fl m
Search for manual entries.
.It Fl s
Search for source.
.It Fl u
Search for unusual entries.
A file is said to be unusual if it does not have one entry of
each requested type.
Thus:
.Pp
.Dl whereis -m -u *
.Pp
asks for those files in the current
directory which have no documentation.
.El
.Sh EXAMPLE
The following finds all the files in
.Pa /usr/bin
which are not documented
in
.Pa /usr/share/man/man1
with source in
.Pa /usr/src/cmd:
.Bd -literal -offset indent -compact
cd /usr/ucb
whereis \-u \-M /usr/share/man/man1 \-S /usr/src/cmd \-f *
.Ed
.Sh FILES
.Bl -tag -width /lib,x/etc,x/usr/{lib,bin,ucb,old,new,local} -compact
.It Pa /usr/src/*
.It Pa /usr/{doc,man}/*
.It Pa /lib, /etc, /usr/{lib,bin,ucb,old,new,local}
.El
.Sh BUGS
Since the program uses
.Xr chdir 2
to run faster, pathnames given with the
.Fl M
.Fl S
and
.Fl B
must be full; i.e. they must begin with a
.Ql \&/ .
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3.0 .
src/utila-1.0/whereis.c 600 0 0 16357 5225255457 13126 0ustar rootroot/*-
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)whereis.c 5.5 (Berkeley) 4/18/91";
#endif /* not lint */

#include
#include
#include
#include

static char *bindirs[] = {
#ifdef linux
"/bin",
"/usr/bin",
"/etc",
"/usr/games",
"/usr/emacs/etc",

"/usr/local/bin",
"/usr/local/etc",
"/usr/local/games",
"/usr/local/emacs/etc",

"/usr/contrib",
"/usr/hosts",
"/usr/include",
#else
"/bin",
"/sbin",
"/usr/ucb",
"/usr/bin",
"/usr/sbin",
"/usr/old",
"/usr/contrib",
"/usr/games",
"/usr/local",
"/usr/libexec",
"/usr/include",
"/usr/hosts",
"/usr/share", /*?*/
"/etc",
#ifdef notdef
/* before reorg */
"/etc",
"/bin",
"/usr/bin",
"/usr/games",
"/lib",
"/usr/ucb",
"/usr/lib",
"/usr/local",
"/usr/new",
"/usr/old",
"/usr/hosts",
"/usr/include",
#endif
#endif
0
};
/* This needs to be redone - man pages live with sources */
static char *mandirs[] = {
"/usr/man/man1",
"/usr/man/man2",
"/usr/man/man3",
"/usr/man/man4",
"/usr/man/man5",
"/usr/man/man6",
"/usr/man/man7",
"/usr/man/man8",
#ifdef linux
"/usr/man/man9",
#endif
"/usr/man/manl",
"/usr/man/mann",
"/usr/man/mano",
0
};
static char *srcdirs[] = {
"/usr/src/bin",
"/usr/src/sbin",
"/usr/src/etc",
"/usr/src/pgrm",
"/usr/src/usr.bin",
"/usr/src/usr.sbin",
"/usr/src/usr.ucb",
"/usr/src/usr.new",
"/usr/src/usr.lib",
"/usr/src/libexec",
"/usr/src/libdata",
"/usr/src/share",
"/usr/src/contrib",
"/usr/src/athena",
"/usr/src/devel",
"/usr/src/games",
"/usr/src/local",
"/usr/src/man",
"/usr/src/root",
"/usr/src/old",
"/usr/src/include",
/* still need libs */
#ifdef notdef /* before reorg */
"/usr/src/bin",
"/usr/src/usr.bin",
"/usr/src/etc",
"/usr/src/ucb",
"/usr/src/games",
"/usr/src/usr.lib",
"/usr/src/lib",
"/usr/src/local",
"/usr/src/new",
"/usr/src/old",
"/usr/src/include",
"/usr/src/lib/libc/gen",
"/usr/src/lib/libc/stdio",
"/usr/src/lib/libc/sys",
"/usr/src/lib/libc/net/common",
"/usr/src/lib/libc/net/inet",
"/usr/src/lib/libc/net/misc",
"/usr/src/ucb/pascal",
"/usr/src/ucb/pascal/utilities",
"/usr/src/undoc",
#endif
0
};

char sflag = 1;
char bflag = 1;
char mflag = 1;
char **Sflag;
int Scnt;
char **Bflag;
int Bcnt;
char **Mflag;
int Mcnt;
char uflag;
/*
* whereis name
* look for source, documentation and binaries
*/
main(argc, argv)
int argc;
char *argv[];
{

argc--, argv++;
if (argc == 0) {
usage:
fprintf(stderr, "whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n");
exit(1);
}
do
if (argv[0][0] == '-') {
register char *cp = argv[0] + 1;
while (*cp) switch (*cp++) {

case 'f':
break;

case 'S':
getlist(&argc, &argv, &Sflag, &Scnt);
break;

case 'B':
getlist(&argc, &argv, &Bflag, &Bcnt);
break;

case 'M':
getlist(&argc, &argv, &Mflag, &Mcnt);
break;

case 's':
zerof();
sflag++;
continue;

case 'u':
uflag++;
continue;

case 'b':
zerof();
bflag++;
continue;

case 'm':
zerof();
mflag++;
continue;

default:
goto usage;
}
argv++;
} else
lookup(*argv++);
while (--argc > 0);
exit(0);
}

getlist(argcp, argvp, flagp, cntp)
char ***argvp;
int *argcp;
char ***flagp;
int *cntp;
{

(*argvp)++;
*flagp = *argvp;
*cntp = 0;
for ((*argcp)--; *argcp > 0 && (*argvp)[0][0] != '-'; (*argcp)--)
(*cntp)++, (*argvp)++;
(*argcp)++;
(*argvp)--;
}


zerof()
{

if (sflag && bflag && mflag)
sflag = bflag = mflag = 0;
}
int count;
int print;


lookup(cp)
register char *cp;
{
register char *dp;

for (dp = cp; *dp; dp++)
continue;
for (; dp > cp; dp--) {
if (*dp == '.') {
*dp = 0;
break;
}
}
for (dp = cp; *dp; dp++)
if (*dp == '/')
cp = dp + 1;
if (uflag) {
print = 0;
count = 0;
} else
print = 1;
again:
if (print)
printf("%s:", cp);
if (sflag) {
looksrc(cp);
if (uflag && print == 0 && count != 1) {
print = 1;
goto again;
}
}
count = 0;
if (bflag) {
lookbin(cp);
if (uflag && print == 0 && count != 1) {
print = 1;
goto again;
}
}
count = 0;
if (mflag) {
lookman(cp);
if (uflag && print == 0 && count != 1) {
print = 1;
goto again;
}
}
if (print)
printf("\n");
}

looksrc(cp)
char *cp;
{
if (Sflag == 0) {
find(srcdirs, cp);
} else
findv(Sflag, Scnt, cp);
}

lookbin(cp)
char *cp;
{
if (Bflag == 0)
find(bindirs, cp);
else
findv(Bflag, Bcnt, cp);
}

lookman(cp)
char *cp;
{
if (Mflag == 0) {
find(mandirs, cp);
} else
findv(Mflag, Mcnt, cp);
}

findv(dirv, dirc, cp)
char **dirv;
int dirc;
char *cp;
{

while (dirc > 0)
findin(*dirv++, cp), dirc--;
}

find(dirs, cp)
char **dirs;
char *cp;
{

while (*dirs)
findin(*dirs++, cp);
}

findin(dir, cp)
char *dir, *cp;
{
DIR *dirp;
struct direct *dp;

dirp = opendir(dir);
if (dirp == NULL)
return;
while ((dp = readdir(dirp)) != NULL) {
if (itsit(cp, dp->d_name)) {
count++;
if (print)
printf(" %s/%s", dir, dp->d_name);
}
}
closedir(dirp);
}

itsit(cp, dp)
register char *cp, *dp;
{
register int i = strlen(dp);

if (dp[0] == 's' && dp[1] == '.' && itsit(cp, dp+2))
return (1);
while (*cp && *dp && *cp == *dp)
cp++, dp++, i--;
if (*cp == 0 && *dp == 0)
return (1);
while (isdigit(*dp))
dp++;
if (*cp == 0 && *dp++ == '.') {
--i;
while (i > 0 && *dp)
if (--i, *dp++ == '.')
return (*dp++ == 'C' && *dp++ == 0);
return (1);
}
return (0);
}
src/utila-1.0/Makefile 600 0 0 2351 5225351225 12707 0ustar rootroot# Makefile -- Makefile for NET-2 utilties ported to Linux
# Created: Sun Jun 14 13:43:28 1992
# Revised: Sat Jul 4 16:32:22 1992 by root
# Copyright 1992 Rickard E. Faith ([email protected])
#
# $Log$
#

#STATIC= -static
CC= gcc
CFLAGS= -O -I. $(STATIC) -s

MAN1= cal.1 col.1 colcrt.1 colrm.1 column.1 false.1 hexdump.1 od.1 \
strings.1 true.1 ul.1 uuencode.1 whereis.1
MAN5= uuencode.5
MAN6= banner.6

NEEDS_GETOPT= banner cal col column strings uuencode
OTHER= colcrt colrm false true whereis
BINS= $(NEEDS_GETOPT) $(OTHER) hexdump ul

all: $(BINS)

%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@

$(NEEDS_GETOPT): getopt.o
$(CC) $(CFLAGS) [email protected] -o $@ getopt.o

$(OTHER):
$(CC) $(CFLAGS) [email protected] -o $@

ul: ul.c getopt.o
$(CC) $(CFLAGS) -o ul ul.c getopt.o -ltermcap

hexdump: hexdump.c hexdump.h getopt.o conv.o display.o hexsyntax.o \
odsyntax.o parse.o
$(CC) $(CFLAGS) -o hexdump hexdump.c getopt.o conv.o display.o \
hexsyntax.o odsyntax.o parse.o

install: all
install -m 755 $(BINS) /usr/bin
rm -f /usr/bin/od
ln /usr/bin/hexdump /usr/bin/od
rm -f /usr/bin/uudecode
ln /usr/bin/uuencode /usr/bin/uudecode
install -m 644 $(MAN1) /usr/man/man1
install -m 644 $(MAN5) /usr/man/man5
install -m 644 $(MAN6) /usr/man/man6

clean:
-rm -f $(BINS) *.o
src/utila-1.0/banner.6 600 0 0 5643 5225143235 12612 0ustar rootroot.\" Copyright (c) 1980 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)banner.6 6.4 (Berkeley) 6/23/90
.\"
.TH BANNER 6 "June 23, 1990"
.UC
.SH NAME
banner \- print large banner on printer
.SH SYNOPSIS
.B /usr/games/banner
[
.BI \-w n
]
message ...
.SH DESCRIPTION
.I Banner
prints a large, high quality banner on the standard output.
If the message is omitted, it prompts for and
reads one line of its standard input. If
.B \-w
is given, the output is scrunched down from a width of 132 to
.I n ,
suitable for a narrow terminal. If
.I n
is omitted, it defaults to 80.
.PP
The output should be printed on a hard-copy device, up to 132 columns wide,
with no breaks between the pages. The volume is great enough that you
may want
a printer or a fast hardcopy terminal, but if you are patient, a
decwriter or other 300 baud terminal will do.
.SH BUGS
Several ASCII characters are not defined, notably <, >, [, ], \\,
^, _, {, }, |, and ~. Also, the characters ", ', and & are funny
looking (but in a useful way.)
.PP
The
.B \-w
option is implemented by skipping some rows and columns.
The smaller it gets, the grainier the output.
Sometimes it runs letters together.
.SH AUTHOR
Mark Horton
src/utila-1.0/strings.c 600 0 0 12565 5225144405 13134 0ustar rootroot/*
* Copyright (c) 1980, 1987 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980, 1987 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)strings.c 5.10 (Berkeley) 5/23/91";
#endif /* not lint */

#include
#include
#include
#include
#include
#include
#include
#include
#include

#define DEF_LEN 4 /* default minimum string length */
#define ISSTR(ch) (isascii(ch) && (isprint(ch) || ch == '\t'))

typedef struct exec EXEC; /* struct exec cast */

static long foff; /* offset in the file */
static int hcnt, /* head count */
head_len, /* length of header */
read_len; /* length to read */
static u_char hbfr[sizeof(EXEC)]; /* buffer for struct exec */

static void usage();

main(argc, argv)
int argc;
char **argv;
{
extern char *optarg;
extern int optind;
register int ch, cnt;
register u_char *C;
EXEC *head;
int exitcode, minlen;
short asdata, oflg, fflg;
u_char *bfr;
char *file, *p;

/*
* for backward compatibility, allow '-' to specify 'a' flag; no
* longer documented in the man page or usage string.
*/
asdata = exitcode = fflg = oflg = 0;
minlen = -1;
while ((ch = getopt(argc, argv, "-0123456789anof")) != EOF)
switch((char)ch) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
/*
* kludge: strings was originally designed to take
* a number after a dash.
*/
if (minlen == -1) {
p = argv[optind - 1];
if (p[0] == '-' && p[1] == ch && !p[2])
minlen = atoi(++p);
else
minlen = atoi(argv[optind] + 1);
}
break;
case '-':
case 'a':
asdata = 1;
break;
case 'f':
fflg = 1;
break;
case 'n':
minlen = atoi(optarg);
break;
case 'o':
oflg = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;

if (minlen == -1)
minlen = DEF_LEN;

if (!(bfr = malloc((u_int)minlen))) {
(void)fprintf(stderr, "strings: %s\n", strerror(errno));
exit(1);
}
bfr[minlen] = '\0';
file = "stdin";
do {
if (*argv) {
file = *argv++;
if (!freopen(file, "r", stdin)) {
(void)fprintf(stderr,
"strings; %s: %s\n", file, strerror(errno));
exitcode = 1;
goto nextfile;
}
}
foff = 0;
#define DO_EVERYTHING() {read_len = -1; head_len = 0; goto start;}
read_len = -1;
if (asdata)
DO_EVERYTHING()
else {
head = (EXEC *)hbfr;
if ((head_len =
read(fileno(stdin), head, sizeof(EXEC))) == -1)
DO_EVERYTHING()
if (head_len == sizeof(EXEC) && !N_BADMAG(*head)) {
foff = N_TXTOFF(*head);
if (fseek(stdin, foff, SEEK_SET) == -1)
DO_EVERYTHING()
read_len = head->a_text + head->a_data;
head_len = 0;
}
else
hcnt = 0;
}
start:
for (cnt = 0; (ch = getch()) != EOF;) {
if (ISSTR(ch)) {
if (!cnt)
C = bfr;
*C++ = ch;
if (++cnt < minlen)
continue;
if (fflg)
printf("%s:", file);
if (oflg)
printf("%07ld %s",
foff - minlen, (char *)bfr);
else
printf("%s", bfr);
while ((ch = getch()) != EOF && ISSTR(ch))
putchar((char)ch);
putchar('\n');
}
cnt = 0;
}
nextfile: ;
} while (*argv);
exit(exitcode);
}

/*
* getch --
* get next character from wherever
*/
getch()
{
++foff;
if (head_len) {
if (hcnt < head_len)
return((int)hbfr[hcnt++]);
head_len = 0;
}
if (read_len == -1 || read_len-- > 0)
return(getchar());
return(EOF);
}

static void
usage()
{
(void)fprintf(stderr,
"usage: strings [-afo] [-n length] [file ... ]\n");
exit(1);
}
src/utila-1.0/README.linux 600 0 0 7002 5225255510 13263 0ustar rootrootThese are miscellaneous utilities from the NET-2 distribution
including: banner cal col colcrt colrm column false hexdump od strings
true ul uuencode uudecode whereis
compiled with gcc 2.2.2 under Linux 0.96b.pl2
linked static

Original source is currently available at
wuarchive.wustl.edu:/mirrors2/4.3-reno/usr.bin

Source modified for Linux is available from
tsx-11.mit.edu:/pub/linux/sources/usr.bin/utila-1.0src.tar.Z
and from banjo.concert.net:/usr/Linux/ABC-Release/usr.bin/utila-1.0src.tar.Z

Sat Jul 4 07:43:00 1992, [email protected]


WHAT'S MISSING:

Many simple utilities are not included because the NET-2 versions do not
compile with minimal changes. Some of these utilities will be included in
future releases.


HOW TO COMPILE:
0) Be sure /bin/sh is bash. DO *NOT* USE ASH!
1) cd /usr
2) tar zxvf utila-1.0src.tar.Z
3) cd src/utila-1.0
4) IF YOU WANT STATIC LINKING: edit Makefile and uncomment the STATIC line.
5) make


NOTES:

0) If you edit Makefile (or any other file in this distribution) and
change things without knowing what you are doing, you may not be able to
build a working version of these utilities. You will then blame me for
your lack of understanding and will cause me to waste my time trying to
track down your silly errors. Please don't do this.

1) You may need GNU Make in order to use the makefile. You will need the
install program in order to use 'make install.' There is an install
program in the fileutils package from the FSF.

2) The getopt(3) from the NET-2 distribution is included, and is linked
with programs that use getopt(3). This getopt behaves differently from the
standard GNU getopt. Please do *NOT* try to use the GNU getopt, since this
will require many additional patches to the programs. The man page for
getopt(3) is included for reference in the source distribution, but is
*NOT* installed in /usr/man/man3.



DIFFS:
The following are diffs against the original NET-2 distribution. For the
Linux distribution, these diffs have been applied, and are provided for
information only. The makefile was *not* part of the NET-2 distribution.

Only in utila-1.0: Makefile
Only in utila-1.0: README.linux
diff -rc net2.orig/display.c utila-1.0/display.c
*** net2.orig/display.c Fri Jul 3 21:32:34 1992
--- utila-1.0/display.c Fri Jul 3 21:56:34 1992
***************
*** 45,50 ****
--- 45,54 ----
#include
#include "hexdump.h"

+ #ifdef linux
+ #define MIN(a,b) ((a)<(b)?(a):(b))
+ #endif
+
enum _vflag vflag = FIRST;

static off_t address; /* address/offset in stream */
Only in utila-1.0: mktar.linux
Only in utila-1.0: mktar.linux.sh
diff -rc net2.orig/whereis.c utila-1.0/whereis.c
*** net2.orig/whereis.c Fri Jul 3 21:32:34 1992
--- utila-1.0/whereis.c Fri Jul 3 22:14:23 1992
***************
*** 47,52 ****
--- 47,72 ----
#include

static char *bindirs[] = {
+ #ifdef linux
+ "/bin",
+ "/usr/bin",
+ "/etc",
+ "/usr/games",
+ "/usr/emacs/etc",
+
+ "/usr/local/bin",
+ "/usr/local/etc",
+ "/usr/local/games",
+ "/usr/local/emacs/etc",
+
+ "/usr/contrib",
+ "/usr/hosts",
+ "/usr/include",
+ #else
"/bin",
"/sbin",
"/usr/ucb",
***************
*** 76,81 ****
--- 96,102 ----
"/usr/hosts",
"/usr/include",
#endif
+ #endif
0
};
/* This needs to be redone - man pages live with sources */
***************
*** 88,93 ****
--- 109,117 ----
"/usr/man/man6",
"/usr/man/man7",
"/usr/man/man8",
+ #ifdef linux
+ "/usr/man/man9",
+ #endif
"/usr/man/manl",
"/usr/man/mann",
"/usr/man/mano",
src/utila-1.0/getopt.c 600 0 0 7364 5225145172 12730 0ustar rootroot/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
*/

#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */

#include
#include
#include

/*
* get option letter from argument vector
*/
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt; /* character checked for validity */
char *optarg; /* argument associated with option */

#define BADCH (int)'?'
#define EMSG ""

int
getopt(nargc, nargv, ostr)
int nargc;
char * const *nargv;
const char *ostr;
{
static char *place = EMSG; /* option letter processing */
register char *oli; /* option letter list index */
char *p;

if (!*place) { /* update scanning pointer */
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
return(EOF);
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
return(EOF);
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
!(oli = index(ostr, optopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
*/
if (optopt == (int)'-')
return(EOF);
if (!*place)
++optind;
if (opterr) {
if (!(p = rindex(*nargv, '/')))
p = *nargv;
else
++p;
(void)fprintf(stderr, "%s: illegal option -- %c\n",
p, optopt);
}
return(BADCH);
}
if (*++oli != ':') { /* don't need argument */
optarg = NULL;
if (!*place)
++optind;
}
else { /* need an argument */
if (*place) /* no white space */
optarg = place;
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
if (!(p = rindex(*nargv, '/')))
p = *nargv;
else
++p;
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
p, optopt);
return(BADCH);
}
else /* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
return(optopt); /* dump back option letter */
}
src/utila-1.0/strings.1 600 0 0 6555 5225144405 13034 0ustar rootroot.\" Copyright (c) 1980, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)strings.1 6.11 (Berkeley) 5/9/91
.\"
.Dd May 9, 1991
.Dt STRINGS 1
.Os BSD 3
.Sh NAME
.Nm strings
.Nd find printable strings in a file
.Sh SYNOPSIS
.Nm strings
.Op Fl afo
.Op Fl n Ar number
.Op Ar file ...
.Sh DESCRIPTION
.Nm Strings
displays the sequences of printable characters in each of the specified
files, or in the standard input, by default.
By default, a sequence must be at least four characters in length
before being displayed.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl a
By default,
.Nm strings
only searches the text and data segments of object files.
The
.Fl a
option causes
.Nm strings
to search the entire object file.
.It Fl f
Each string is preceded by the name of the file
in which it was found.
.It Fl n
Specifies the minimum number of characters in a sequence to be
.Ar number ,
instead of four.
.It Fl o
Each string is preceded by its decimal offset in the
file.
.El
.Pp
.Nm Strings
is useful for identifying random binaries, among other things.
.Sh SEE ALSO
.Xr hexdump 1
.Sh BUGS
The algorithm for identifying strings is extremely primitive.
In particular, machine code instructions on certain architectures
can resemble sequences of ASCII bytes, which
will fool the algorithm.
.Sh COMPATIBILITY
Historic implementations of
.Nm
only search the initialized data portion of the object file.
This was reasonable as strings were normally stored there.
Given new compiler technology which installs strings in the
text portion of the object file, the default behavior was
changed.
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3.0 .
src/utila-1.0/mktar.linux.sh 700 0 0 1041 5225255764 14066 0ustar rootroot#!/bin/sh
cd /usr
tar zcvf /dist/utila-1.0src.tar.Z src/utila-1.0
tar zcvf /dist/utila-1.0sbin.tar.Z src/utila-1.0/R* \
bin/banner bin/cal bin/col bin/colcrt bin/colrm bin/column \
bin/false bin/hexdump bin/od bin/strings bin/true \
bin/ul bin/uuencode bin/uudecode bin/whereis \
man/man6/banner.6 man/man1/cal.1 man/man1/col.1 man/man1/colcrt.1 \
man/man1/colrm.1 man/man1/column.1 man/man1/false.1 man/man1/hexdump.1 \
man/man1/od.1 man/man1/strings.1 man/man1/true.1 \
man/man1/ul.1 man/man1/uuencode.1 man/man5/uuencode.5 man/man1/whereis.1
src/utila-1.0/getopt.3 600 0 0 12760 5225145224 12662 0ustar rootroot.\" Copyright (c) 1988, 1991 Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)getopt.3 6.16 (Berkeley) 4/19/91
.\"
.Dd April 19, 1991
.Dt GETOPT 3
.Os BSD 4.3
.Sh NAME
.Nm getopt
.Nd get option letter from argv
.Sh SYNOPSIS
.Fd #include
.Vt extern char *optarg
.Vt extern int optind
.Vt extern int opterr
.Ft int
.Fn getopt "int argc" "char * const *argv" "const char *optstring"
.Sh DESCRIPTION
The
.Fn getopt
function gets
the next
.Em known
option character from
.Fa argv .
An option character is
.Em known
if it has been specified in the string of accepted option characters,
.Fa optstring .
.Pp
The option string
.Fa optstring
may contain the following characters; letters and
letters followed by a colon to indicate an option argument
is to follow. It does not matter to
.Fn getopt
if a following argument has leading white space.
.Pp
On return from
.Fn getopt ,
.Va optarg
points to an option argument, if it is anticipated,
and the variable
.Va optind
contains the index to the next
.Fa argv
argument for a subsequent call
to
.Fn getopt .
.Pp
The variable
.Va opterr
and
.Va optind
are both initialized to 1.
In order to use
.Fn getopt
to evaluate multiple sets of arguments, or to evaluate a single set of
arguments multiple times,
.Va optind
must be initialized to the number of argv entries to be skipped in each
evaluation.
.Pp
The
.Fn getopt
function
returns an
.Dv EOF
when the argument list is exhausted, or a non-recognized
option is encountered.
The interpretation of options in the argument list may be cancelled
by the option
.Ql --
(double dash) which causes
.Fn getopt
to signal the end of argument processing and return an
.Dv EOF .
When all options have been processed (i.e., up to the first non-option
argument),
.Fn getopt
returns
.Dv EOF .
.Sh DIAGNOSTICS
If the
.Fn getopt
function encounters a character not found in the string
.Va optarg
or detects
a missing option argument
it writes error message
.Ql ?
to the
.Em stderr .
Setting
.Va opterr
to a zero will disable these error messages.
.Sh EXAMPLE
.Bd -literal -compact
extern char *optarg;
extern int optind;
int bflag, ch, fd;

bflag = 0;
while ((ch = getopt(argc, argv, "bf:")) != EOF)
switch(ch) {
case 'b':
bflag = 1;
break;
case 'f':
if ((fd = open(optarg, O_RDONLY, 0)) < 0) {
(void)fprintf(stderr,
"myname: unable to read file %s.\en", optarg);
exit(1) ;
}
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
.Ed
.Sh HISTORY
The
.Fn getopt
function appeared
.Bx 4.3 .
.Sh BUGS
Option arguments are allowed to begin with
.Dq Li \- ;
this is reasonable but
reduces the amount of error checking possible.
.Pp
A single dash
.Dq Li -
may be specified as an character in
.Fa optstring ,
however it should
.Em never
have an argument associated with it.
This allows
.Fn getopt
to be used with programs that expect
.Dq Li -
as an option flag.
This practice is wrong, and should not be used in any current development.
It is provided for backward compatibility
.Em only .
By default, a single dash causes
.Fn getopt
to return
.Dv EOF .
This is, we believe, compatible with System V.
.Pp
It is also possible to handle digits as option letters.
This allows
.Fn getopt
to be used with programs that expect a number
.Pq Dq Li \&-\&3
as an option.
This practice is wrong, and should not be used in any current development.
It is provided for backward compatibility
.Em only .
The following code fragment works fairly well.
.Bd -literal -offset indent
int length;
char *p;

while ((c = getopt(argc, argv, "0123456789")) != EOF)
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
p = argv[optind - 1];
if (p[0] == '-' && p[1] == ch && !p[2])
length = atoi(++p);
else
length = atoi(argv[optind] + 1);
break;
}
}
.Ed
src/utila-1.0/mktar.linux 700 0 0 1040 5225255747 13455 0ustar rootroot#!/bin/sh
cd /usr
tar zcvf /dist/utila-1.0src.tar.Z src/utila-1.0
tar zcvf /dist/utila-1.0bin.tar.Z src/utila-1.0/R* \
bin/banner bin/cal bin/col bin/colcrt bin/colrm bin/column \
bin/false bin/hexdump bin/od bin/strings bin/true \
bin/ul bin/uuencode bin/uudecode bin/whereis \
man/man6/banner.6 man/man1/cal.1 man/man1/col.1 man/man1/colcrt.1 \
man/man1/colrm.1 man/man1/column.1 man/man1/false.1 man/man1/hexdump.1 \
man/man1/od.1 man/man1/strings.1 man/man1/true.1 \
man/man1/ul.1 man/man1/uuencode.1 man/man5/uuencode.5 man/man1/whereis.1
src/utila-1.0/uuencode.5 600 0 0 7216 5225143526 13154 0ustar rootroot.\" Copyright (c) 1989, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' 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 REGENTS 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.
.\"
.\" @(#)uuencode.format.5 6.4 (Berkeley) 5/10/91
.\"
.Dd May 10, 1991
.Dt UUENCODE 5
.Os BSD 4.0
.Sh NAME
.Nm uuencode
.Nd format of an encoded uuencode file
.Sh DESCRIPTION
Files output by
.Xr uuencode 1
consist of a header line,
followed by a number of body lines,
and a trailer line.
The
.Xr uudecode 1
command
will ignore any lines preceding the header or
following the trailer.
Lines preceding a header must not, of course,
look like a header.
.Pp
The header line is distinguished by having the first
6 characters
.Dq begin\ \&
The word
.Em begin
is followed by a mode (in octal),
and a string which names the remote file.
A space separates the three items in the header line.
.Pp
The body consists of a number of lines, each at most 62 characters
long (including the trailing newline).
These consist of a character count,
followed by encoded characters,
followed by a newline.
The character count is a single printing character,
and represents an integer, the number of bytes
the rest of the line represents.
Such integers are always in the range from 0 to 63 and can
be determined by subtracting the character space (octal 40)
from the character.
.Pp
Groups of 3 bytes are stored in 4 characters, 6 bits per character.
All are offset by a space to make the characters printing.
The last line may be shorter than the normal 45 bytes.
If the size is not a multiple of 3, this fact can be determined
by the value of the count on the last line.
Extra garbage will be included to make the character count a multiple
of 4.
The body is terminated by a line with a count of zero.
This line consists of one
.Tn ASCII
space.
.Pp
The trailer line consists of
.Dq end
on a line by itself.
.Sh SEE ALSO
.Xr uuencode 1 ,
.Xr uudecode 1 ,
.Xr uusend 1 ,
.Xr uucp 1 ,
.Xr mail 1
.Sh HISTORY
The
.Nm
file format appeared in
.Bx 4.0 .
.\" It was named uuencode.5 prior to 4.3


  3 Responses to “Category : Linux Files
Archive   : UTILA10S.ZIP
Filename : UTILA10S.TAR

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/