From 8cc71b38c27f2be8ba4c227078a51c63847a89de Mon Sep 17 00:00:00 2001 From: cperciva Date: Fri, 2 Oct 2015 10:08:11 +0000 Subject: Final step of eliminating the "games" distribution: Merge src/games (or what's left of it, at least) into src/usr.bin. This change will not be MFCed. Discussed at: EuroBSDCon 2014 Committed from: EuroBSDCon 2015 --- games/fortune/tools/Do_spell | 10 ------- games/fortune/tools/Do_troff | 10 ------- games/fortune/tools/Troff.mac | 26 ---------------- games/fortune/tools/Troff.sed | 13 -------- games/fortune/tools/do_sort | 13 -------- games/fortune/tools/do_uniq.py | 68 ------------------------------------------ 6 files changed, 140 deletions(-) delete mode 100644 games/fortune/tools/Do_spell delete mode 100644 games/fortune/tools/Do_troff delete mode 100644 games/fortune/tools/Troff.mac delete mode 100644 games/fortune/tools/Troff.sed delete mode 100644 games/fortune/tools/do_sort delete mode 100644 games/fortune/tools/do_uniq.py (limited to 'games/fortune/tools') diff --git a/games/fortune/tools/Do_spell b/games/fortune/tools/Do_spell deleted file mode 100644 index d997392..0000000 --- a/games/fortune/tools/Do_spell +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# -# @(#)Do_spell 8.1 (Berkeley) 5/31/93 -# - -F=_spell.$$ -echo $1 -spell < $1 > $F -sort $F $1.sp.ok | uniq -u | column -rm -f $F diff --git a/games/fortune/tools/Do_troff b/games/fortune/tools/Do_troff deleted file mode 100644 index 52cb282..0000000 --- a/games/fortune/tools/Do_troff +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/csh -f -# -# @(#)Do_troff 8.1 (Berkeley) 5/31/93 -# - -set file=$1 -shift -( echo ".ds Se $file" ; cat Troff.mac ; sed -f Troff.sed $file ) | \ - $* -me >& $file.tr -echo troff output in $file.tr diff --git a/games/fortune/tools/Troff.mac b/games/fortune/tools/Troff.mac deleted file mode 100644 index c2b433e..0000000 --- a/games/fortune/tools/Troff.mac +++ /dev/null @@ -1,26 +0,0 @@ -.nr tp 8 -.nr hm 3v -.nr fm 2v -.nr tm 5v -.nr bm 4v -.cs R -.sc -.sz 6 -.ll +10n -.lt \n(.l -.de $h -.tl 'Fortune Database'\\*(Se'\*(td' -.. -.de $f -.tl ''- % -'' -.. -.2c -.nf -.ta -.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n 80n -.de %% -.sp .3 -.ce -\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq -.sp .2 -.. diff --git a/games/fortune/tools/Troff.sed b/games/fortune/tools/Troff.sed deleted file mode 100644 index 3216681..0000000 --- a/games/fortune/tools/Troff.sed +++ /dev/null @@ -1,13 +0,0 @@ -/^['.]/s//\\\&&/ -/^%%/s//.&/ -/--/s//\\*-/g -/_a-squared cos 2(phi)/s//\\fIa\\fP\\u2\\d cos 2\\(*f/ -/__**\([a-zA-Z]*\)/s//\\fI\1\\fP/g -/"\(.\)/s//\1\\*:/g -/`\(.\)/s//\1\\*`/g -/'\(.\)/s//\1\\*'/g -/~\(.\)/s//\1\\*~/g -/\^\(.\)/s//\1\\*^/g -/,\(.\)/s//\1\\*,/g -/\(.\)\(.\)/s//\\o_\1\2_/g -/*/s//\\(bs/g diff --git a/games/fortune/tools/do_sort b/games/fortune/tools/do_sort deleted file mode 100644 index 07e301b..0000000 --- a/games/fortune/tools/do_sort +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/sh -# -# @(#)do_sort 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ -# -# an aggressive little script for sorting the fortune files -# depends on octal 02 and 03 not being anywhere in the files. - -sp="/usr/bin/sort -dfu -T /var/tmp" - -sed 's/^%$//' | tr '\12' '\3' | tr '\2' '\12' | - sed -e 's/^//' -e '/^$/d' -e 's/$/%/' | - $sp | tr '\3' '\12' diff --git a/games/fortune/tools/do_uniq.py b/games/fortune/tools/do_uniq.py deleted file mode 100644 index bd62676..0000000 --- a/games/fortune/tools/do_uniq.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/local/bin/python -# -# $FreeBSD$ -# -# an aggressive little script for trimming duplicate cookies - -import argparse -import re - -wordlist = [ - 'hadnot', - 'donot', 'hadnt', - 'dont', 'have', 'more', 'will', 'your', - 'and', 'are', 'had', 'the', 'you', - 'am', 'an', 'is', 'll', 've', 'we', - 'a', 'd', 'i', 'm', 's', -] - - -def hash(fortune): - f = fortune - f = f.lower() - f = re.sub('[\W_]', '', f) - for word in wordlist: - f = re.sub(word, '', f) -# f = re.sub('[aeiouy]', '', f) -# f = re.sub('[^aeiouy]', '', f) - f = f[:30] -# f = f[-30:] - return f - - -def edit(datfile): - dups = {} - fortunes = [] - fortune = "" - with open(datfile, "r") as datfiledf: - for line in datfiledf: - if line == "%\n": - key = hash(fortune) - if key not in dups: - dups[key] = [] - dups[key].append(fortune) - fortunes.append(fortune) - fortune = "" - else: - fortune += line - for key in list(dups.keys()): - if len(dups[key]) == 1: - del dups[key] - with open(datfile + "~", "w") as o: - for fortune in fortunes: - key = hash(fortune) - if key in dups: - print('\n' * 50) - for f in dups[key]: - if f != fortune: - print(f, '%') - print(fortune, '%') - if input("Remove last fortune? ") == 'y': - del dups[key] - continue - o.write(fortune + "%\n") - -parser = argparse.ArgumentParser(description="trimming duplicate cookies") -parser.add_argument("filename", type=str, nargs=1) -args = parser.parse_args() -edit(args.filename[0]) -- cgit v1.1