1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-11 07:22:22 +00:00

nonsense is a nonsense, but funny-sounding, text generator.

This commit is contained in:
Peter Pentchev 2000-12-15 16:56:11 +00:00
parent c188bdaeaa
commit df0e18cf20
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=35999
7 changed files with 128 additions and 0 deletions

View File

@ -177,6 +177,7 @@
SUBDIR += trojka
SUBDIR += tvp
SUBDIR += nil
SUBDIR += nonsense
SUBDIR += omega
SUBDIR += uox3
SUBDIR += wmeyes

27
games/nonsense/Makefile Normal file
View File

@ -0,0 +1,27 @@
# New ports collection makefile for: nonsense
# Date created: 15 December 2000
# Whom: roam@FreeBSD.org
#
# $FreeBSD$
#
PORTNAME= nonsense
PORTVERSION= 0.4
CATEGORIES= games
MASTER_SITES= http://i-want-a-website.com/about-linux/
MAINTAINER= roam@FreeBSD.org
NO_BUILD= defined
post-configure:
${PERL} -pi -e "s,/usr/local,${PREFIX}," ${WRKSRC}/nonsense
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/nonsense ${PREFIX}/bin
${MKDIR} ${PREFIX}/share/nonsense/data
${MKDIR} ${PREFIX}/share/nonsense/template
${INSTALL_DATA} ${WRKSRC}/*.data ${PREFIX}/share/nonsense/data
${INSTALL_DATA} ${WRKSRC}/*.template ${PREFIX}/share/nonsense/template
.include <bsd.port.mk>

1
games/nonsense/distinfo Normal file
View File

@ -0,0 +1 @@
MD5 (nonsense-0.4.tar.gz) = 4913fd46d6b93a62eb26cf96586721b8

View File

@ -0,0 +1,65 @@
--- nonsense 2000/12/15 13:26:57 1.1.1.3
+++ nonsense 2000/12/15 13:54:30 1.6
@@ -40,6 +40,10 @@
use POSIX qw( strftime ); # Just in case somebody needs the date
use CGI;
+my $PREFIX = "/usr/local";
+my $datadir = "$PREFIX/share/nonsense/data";
+my $templatedir = "$PREFIX/share/nonsense/template";
+
my %pool; # Where the datafiles are slurped into
my %static; # Hash of persistent data (to maintain state)
@@ -328,7 +332,8 @@
sub LoadDataFile {
my $file = shift;
$file = SafeFile( $file ) if $cgi_mode;
- open IN, $file or die "Error opening $file... $!\n";
+ open IN, $file or open IN, "$datadir/$file"
+ or die "Error opening $file... $!\n";
local $/ = '';
SECTION: while( <IN> ) {
@@ -344,7 +349,8 @@
my $file = shift;
my $m = '';
$file = SafeFile( $file ) if $cgi_mode;
- open IN, $file or die "Error opening $file template... $!\n";
+ open IN, $file or open IN, "$templatedir/$file"
+ or die "Error opening $file template... $!\n";
local $/; undef $/; my $t = <IN>;
close IN;
if( $t =~ /__BEGIN__/ ) { # Check for a header
@@ -356,15 +362,29 @@
### Remove special characters from a filename to prevent maliciousness
sub SafeFile {
my( $file ) = shift;
- $file =~ s/([|<>])//g;
+ $file =~ s/([|<>\0]|\.\.\/)//g;
warn("[" . localtime() . "] [warning] [client $ENV{REMOTE_ADDR}] Attempt to override filename safety feature!") if $1;
return $file;
}
+sub ListUniq {
+ my ($v, $last) = (undef, undef);
+ my @l = ();
+
+ foreach $v (@_) {
+ push (@l, $v) if (defined($last) && ($v ne $last));
+ $last = $v;
+ }
+ return @l;
+}
+
### Return all of the datafiles in the current directory
sub GlobCurrentDirectory {
opendir(DIR, ".");
my @datafiles = grep { /\.data$/ } readdir(DIR);
+ closedir(DIR);
+ opendir(DIR, "$datadir");
+ push(@datafiles, grep { /\.data$/ } readdir(DIR));
closedir(DIR);
- return @datafiles;
+ return ListUniq(sort @datafiles);
}

View File

@ -0,0 +1 @@
A nonsense text generator

10
games/nonsense/pkg-descr Normal file
View File

@ -0,0 +1,10 @@
From the nonsense README:
Nonsense generates random (and sometimes humorous) text from datafiles and
templates using a very simple, recursive grammar. It's like having a million
monkeys sitting in front of a million typewriters, without having to feed or
clean up after them. From fake Slashdot headlines to absurd college courses to
buzzword bingo cards, Nonsense is a good way to waste time.
Author: James Bughn <nonsense@i-want-a-website.com>
WWW: http://i-want-a-website.com/about-linux/downloads.shtml

23
games/nonsense/pkg-plist Normal file
View File

@ -0,0 +1,23 @@
bin/nonsense
share/nonsense/data/college.data
share/nonsense/data/cookie.data
share/nonsense/data/default.data
share/nonsense/data/insults.data
share/nonsense/data/linux.data
share/nonsense/data/mission.data
share/nonsense/data/newspaper.data
share/nonsense/data/ratherism.data
share/nonsense/data/resume.data
share/nonsense/data/shows.data
share/nonsense/data/slashdot.data
share/nonsense/data/stupidlaws.data
share/nonsense/template/bingo.html.template
share/nonsense/template/bizplan.html.template
share/nonsense/template/freshmeat.rdf.template
share/nonsense/template/newspaper.html.template
share/nonsense/template/resume.html.template
share/nonsense/template/slashdot.html.template
share/nonsense/template/slashdot.rdf.template
@dirrm share/nonsense/data
@dirrm share/nonsense/template
@dirrm share/nonsense