debian/0000755000000000000000000000000011750775037007202 5ustar debian/watch0000644000000000000000000000010311750772216010221 0ustar version=3 http://www.jwz.org/dadadodo/ \ dadadodo-([\d.]+).tar.gz debian/dadadodo.install0000755000000000000000000000011711750772216012327 0ustar #! /usr/bin/dh-exec dodotodo => /usr/share/doc/dadadodo/TODO dadadodo /usr/bin debian/rules0000755000000000000000000000003711750772216010256 0ustar #! /usr/bin/make -f %: dh $@ debian/dadadodo.docs0000644000000000000000000000000711750772216011604 0ustar README debian/source/0000755000000000000000000000000011750772216010476 5ustar debian/source/format0000644000000000000000000000001411750772216011704 0ustar 3.0 (quilt) debian/source/git-patches0000644000000000000000000000006411750772216012631 0ustar dadadodo-$UPSTREAM_VERSION..debian/patched/$DEB_REF debian/local/0000755000000000000000000000000011750772216010270 5ustar debian/local/dadadodo.10000644000000000000000000000362211750772216012114 0ustar .TH dadadodo 1 .SH "NAME" dadadodo \- exterminate all rational thought .SH "SYNOPSIS" .B dadadodo [ .I options ] [ .I input\-files ] .SH "DESCRIPTION" .B dadadodo is a program that analyses texts for Markov chains of word probabilities and then generates random sentences based on those probabilities. Sometimes these sentences are nonsense, but sometimes they cut right through to the heart of the matter and reveal hidden meanings. .SH "OPTIONS" .B dadadodo accepts the following options: .TP .B \-c, \-count \fIn\fP Generate \fIn\fP sentences. .TP .B \-h, \-help Show summary of options and exit. .TP .B \-html Output HTML instead of plain text. .TP .B \-l, \-load \fIfile\fP Load compiled data from \fIfile\fP (\(oq\-\(cq for standard input). .TP .B \-o, \-output \fIfile\fP Save compiled data in \fIfile\fP (\(oq\-\(cq for standard output). .TP .B \-p, \-pause \fIs\fP Delay \fIs\fP seconds between paragraphs. .TP .B \-w, \-columns \fIcolumns\fP Format output for a device .I columns character cells in width. If not specified, the value of the environment variable .B COLUMNS is used to determine the width. If that variable is not defined, a width of 72 is assumed. .SH "NOTES" Non\-option arguments are input files. These should be text files, but may be mail folders or HTML. MIME messages are handled sensibly. When no output file is specified, sentences will be generated from the input data directly. However, loading a saved file is far faster than re\-parsing the text files each time. .SH "ENVIRONMENT" .TP .B COLUMNS Determines the width (in character cells) of the output if the .B \-w, \-columns option is not used. If not set, a width of 72 is assumed. .SH "SEE ALSO" .BR dadadodo 's upstream website is .IR "http://www.jwz.org/dadadodo/" . .SH AUTHOR .B dadadodo was written by Jamie Zawinski. .PP This manual page was written by Sudhakar Chandrasekharan , based on the program's usage message. debian/compat0000644000000000000000000000000211750772216010374 0ustar 9 debian/copyright0000644000000000000000000000371611750772216011140 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: dadadodo Upstream-Contact: Jamie Zawinski Source: http://www.jwz.org/dadadodo/ Copyright: 1997, 1998, 2003 Jamie Zawinski Files: * Copyright: 1997, 1998, 2003 Jamie Zawinski License: permissive DadaDodo, Copyright (c) 1997, 1998 Jamie Zawinski . Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Files: debian/* Copyright: 1998-2001 Sudhakar Chandrasekharan 2001 Martin Michlmayr 2001-2002 Gergely Nagy 2002-2004 Decklin Foster 2008 Chris Lamb 2012 Gergely Nagy License: GPL-2 This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. debian/README.Debian0000644000000000000000000000157011750772216011242 0ustar dadadodo for Debian ------------------- DadaDodo is one of the class of programs known as dissociators, a coin perhaps termed by the amazing Emacs hack, Dissociated Press. DadaDodo works rather differently than Dissociated Press; whereas Dissociated Press (which, incidentally, refers to itself as a travesty generator) simply grabs segments of the body of text and shuffles them, DadaDodo tries to work on a larger scale: it scans bodies of text, and builds a probability tree expressing how frequently word B tends to occur after word A, and various other statistics; then it generates sentences based on those probabilities. The theory here is that, with a large enough corpus, the generated sentences will tend to be grammatically correct, but semantically random: exterminate all rational thought. Sudhakar Chandrasekharan , Wed, 7 Oct 1998 12:46:39 -0700 debian/changelog0000644000000000000000000001025311750772216011051 0ustar dadadodo (1.04-4) unstable; urgency=low * New maintainer. (Closes: #660498) * Convert to Format: 3.0 (quilt). * Bump Standards-Version to 3.9.3. * Convert to dh short form and dh-exec. * Build with hardening flags enabled. * Convert debian/copyright to machine-readable format. * Add Homepage & Vcs-* headers. * Added debian/watch file. * Fixed a buffer overrun when reading large files. (Closes: #657642) -- Gergely Nagy Fri, 04 May 2012 17:21:25 +0200 dadadodo (1.04-3.1) unstable; urgency=medium * Non-maintainer upload. * Fix bashism in debian/rules (Closes: #477621) * Bump Standards-Version to 3.8.0 * Don't ignore "make clean" errors -- Chris Lamb Sat, 07 Jun 2008 19:31:16 +0100 dadadodo (1.04-3) unstable; urgency=low * Fix -w option, which was looking at the wrong element of argv and thus always setting the width to 0. -- Decklin Foster Mon, 22 Nov 2004 19:58:47 -0500 dadadodo (1.04-2) unstable; urgency=low * Applied fixes from Branden Robinson : - Make dadadodo check the COLUMNS environment variable for the terminal width before falling back to the hard-coded default of 72. - Clean up manpage and document new -w, -columns option. -- Decklin Foster Sun, 3 Oct 2004 22:29:18 -0400 dadadodo (1.04-1) unstable; urgency=low * New upstream release * Added patch by Brenton Stone to add -w option. (Closes: #239295) * Bumped Standards-Version to 3.6.1 -- Decklin Foster Sat, 2 Oct 2004 11:47:50 -0400 dadadodo (1.03-9) unstable; urgency=low * Adopting package (Closes: #154637) -- Decklin Foster Thu, 1 Aug 2002 15:05:50 -0400 dadadodo (1.03-8) unstable; urgency=low * The "Is there anybody in there?" release * Migrate to build-time patching, and include the list (with descriptions) of the applied patches in the installed copyright file. -- Gergely Nagy Sat, 1 Jun 2002 01:55:46 +0200 dadadodo (1.03-7) unstable; urgency=low * The "Back from Poland and I am happy" release * files.c (read_dadadodo_file): cast buf to unsigned char, fixing a segmentation fault. Patch courtesy of Bernhard R. Link (Closes: #106891) -- Gergely Nagy Mon, 20 May 2002 18:54:32 +0200 dadadodo (1.03-6) unstable; urgency=low * dadadodo.c (main): Check if enough parameters were given to -p and -c, and bail out if not. This fixes a segfault on `dadadodo -p'. (Closes: #137934) * debian/local/dadadodo.1: escaped a `-', and fixed .TH * debian/rules: converted to non-debhelper, related files were changed accordingly. -- Gergely Nagy Thu, 14 Mar 2002 10:11:51 +0100 dadadodo (1.03-5) unstable; urgency=low * New maintainer * debian/rules (build-stamp, install-stamp): stamp files are Evil (clean): no stamp files, so remove the rm -f call * debian/control: Fixed spelling mistake, thanks to Matt Zimmerman * debian/copyright: added myself -- Gergely Nagy Thu, 13 Dec 2001 14:03:48 +0100 dadadodo (1.03-4) unstable; urgency=low * New Maintainer (Closes: #107424). * Pump Standards-Version to 3.5.6: - honour DEB_BUILD_OPTIONS. * Use newer debhelper mode. * Fix 8bit handling, thanks Dmitry Astapov for the patch (Closes: #30117). * Remove modifications of upstream Makefile and instead add code for the installation to debian/rules. * Format dadadodo.README.debian and description nicer. * Removed Emacs cruft from debian/changelog. -- Martin Michlmayr Thu, 02 Aug 2001 19:21:06 +0200 dadadodo (1.03-3) unstable; urgency=low * Fixing bug # 70245 -- Sudhakar Chandrasekharan Wed, 17 Jan 2001 17:39:50 -0800 dadadodo (1.03-2) unstable; urgency=low * Fixing a whole bunch of warnings and errors that lintian complains about. -- Sudhakar Chandrasekharan Tue, 6 Jun 2000 17:51:01 -0700 dadadodo (1.03-1) unstable; urgency=low * Initial Release. -- Sudhakar Chandrasekharan Wed, 7 Oct 1998 12:46:39 -0700 debian/patches/0000755000000000000000000000000011750775037010631 5ustar debian/patches/0003-Makefile-Respect-CFLAGS-properly.patch0000644000000000000000000000150711750775037020164 0ustar From dec4b39b2ecb056fa46dce00940c57e94756b107 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 4 May 2012 15:55:53 +0200 Subject: [PATCH] Makefile: Respect CFLAGS properly Signed-off-by: Gergely Nagy --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e748699..7407abf 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ # Makefile for DadaDodo, Copyright (c) 1997 Jamie Zawinski. SHELL = /bin/sh -CC = gcc -Wall -Wstrict-prototypes -Wnested-externs -Wno-format +CC = gcc #CC = cc -fullwarn -use_readonly_const -rdata_shared -g3 -CFLAGS = -g +CFLAGS += -Wall -Wstrict-prototypes -Wnested-externs -Wno-format LDFLAGS = DEFS = -DGETTIMEOFDAY_TWO_ARGS -DHAVE_UNISTD_H LIBS = -- 1.7.10 debian/patches/series0000644000000000000000000000041411750775037012045 0ustar # debian/source/git-patches exported from git by quilt-patches-deb-export-hook 0001-Make-dadadodo-8bit-clean.patch 0002-Add-a-w-option-to-change-the-width-of-the-output.patch 0003-Makefile-Respect-CFLAGS-properly.patch 0004-Fix-a-buffer-overrun-during-file-read.patch debian/patches/0004-Fix-a-buffer-overrun-during-file-read.patch0000644000000000000000000000404111750775037021257 0ustar From bef7a08c405b5d6fe426ceba5797dd1e5c32ca57 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 4 May 2012 17:13:12 +0200 Subject: [PATCH] Fix a buffer overrun during file read In read_dadadodo_file() only n * sizeof(int) bytes of memory was allocated to a buffer, and later on, we tried to access that same buffer as if it was an array of longs, which obviously overflowed. While there, also fixed another crash we could run into later on, by skipping words that have a count of 0. This latter would probably need to get addressed some other way, to skip these words entirely, but for now, this will do. Signed-off-by: Gergely Nagy --- files.c | 2 +- generate.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/files.c b/files.c index a1aa371..7fc1dbe 100644 --- a/files.c +++ b/files.c @@ -548,7 +548,7 @@ read_dadadodo_file (FILE *in) goto FAIL; nstarters = (long) ntohl (nstarters); - st = (int *) malloc ((nstarters + 1) * sizeof(*st)); + st = (int *) malloc ((nstarters + 1) * sizeof(u_long)); if (!st) goto FAIL; switch (buf_elt_size) diff --git a/generate.c b/generate.c index 0d0546b..331aacf 100644 --- a/generate.c +++ b/generate.c @@ -111,7 +111,7 @@ random_sentence (FILE *stream, int *column, int indent, int fill_column, { int open_paren_next_p = 0; int close_paren_p = 0; - int punctuate_chance = RAND(word->count); + int punctuate_chance; int always_cap_p = (word->count - word->start) <= word->cap; int cap_p = (first_p || always_cap_p); const unsigned char *c1 = all_strings[word->string]; @@ -131,6 +131,11 @@ random_sentence (FILE *stream, int *column, int indent, int fill_column, count++; + if (word->count == 0) + continue; + + punctuate_chance = RAND(word->count); + /* Every ten words, increase the chance of the sentence ending by 16% (yet, only end at places where periods were possible.) */ if ((count % 10) == 0) -- 1.7.10 debian/patches/0002-Add-a-w-option-to-change-the-width-of-the-output.patch0000644000000000000000000000557611750775037023202 0ustar From e0d198cd192632b36b75a42b87065707cecaec52 Mon Sep 17 00:00:00 2001 From: Brenton Stone Date: Sun, 21 Mar 2004 23:33:39 -0500 Subject: [PATCH] Add a -w option to change the width of the output I've been getting amusing results from using dadadodo in conjunction with some of the text-output hacks in xscreensaver, but dadadodo will only output 72-columns wide output, which will wrap in bad places in the hacks that use smaller widths. This patch adds a command-line option to change the width of the output, like --cols on ljlatest. --- dadadodo.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/dadadodo.c b/dadadodo.c index 6fdf3a8..38b9b9f 100644 --- a/dadadodo.c +++ b/dadadodo.c @@ -780,6 +780,7 @@ Options include:\n\ -o or -output file to save compiled data in (- for stdout)\n\ -l or -load file of compiled data to load (- for stdin)\n\ -c or -count how many sentences to generate (0 = inf)\n\ + -w or -columns how many columns wide the output should be\n\ -p or -pause delay between paragraphs\n\ -html output HTML instead of plain-text.\n\ \n\ @@ -804,6 +805,8 @@ main (int argc, char **argv) int n_input = 0; int count = -1; int pause = 1; + int columns; + char *columns_str = NULL; int html_p = 0; const char ** input = (const char **) malloc (argc * sizeof(*input)); char *output = 0; @@ -841,6 +844,15 @@ main (int argc, char **argv) } count = atoi(argv[++i]); } + else if (!strcmp(sw, "-w") || !strcmp(sw, "-columns")) + { + if (i+1 >= argc) + { + usage(argv[0]); + exit(1); + } + columns_str = argv[++i]; + } else if (!strcmp(sw, "-p") || !strcmp(sw, "-pause")) { if (i+1 >= argc) @@ -872,6 +884,25 @@ main (int argc, char **argv) } } + /* + * Set the column width of the output. Prefer the command-line option if + * it is present. Fall back to the COLUMNS environment variable. If + * that is not available either, use 72 as the default. + */ + if (columns_str == NULL) + { + columns_str = getenv("COLUMNS"); + } + + if (columns_str != NULL) + { + columns = atoi(columns_str); + } + else + { + columns = 72; + } + if (n_input == 0 && !output && !load) { usage(argv[0]); @@ -1090,7 +1121,7 @@ main (int argc, char **argv) int words = 0; int n = 0; int indent = 0; - int fill_column = 72; + int fill_column = columns; int sidebar_p = 0; int sidebar_words = 0; int number_p = 0; @@ -1110,7 +1141,7 @@ main (int argc, char **argv) if (RAND(3) == 0) indent = RAND(4) * 4; - fill_column = 72; + fill_column = columns; if (indent && (RAND(2) == 0)) fill_column -= indent; -- 1.7.10 debian/patches/0001-Make-dadadodo-8bit-clean.patch0000644000000000000000000000130011750775037016560 0ustar From c1257fb683dcaa7f412c398a0a9a563ede83c2c4 Mon Sep 17 00:00:00 2001 From: Dmitry Astapov Date: Mon, 25 Jun 2001 22:51:47 +0300 Subject: [PATCH] Make dadadodo 8bit clean --- dadadodo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dadadodo.c b/dadadodo.c index 5e46b39..6fdf3a8 100644 --- a/dadadodo.c +++ b/dadadodo.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "hash.h" #include "dadadodo.h" @@ -810,6 +811,8 @@ main (int argc, char **argv) char *stat_words = 0; FILE *tmp_file = 0; + setlocale(LC_ALL, ""); + for (i = 1; i < argc; i++) { const char *sw = argv[i]; -- 1.7.10 debian/control0000644000000000000000000000133411750772216010602 0ustar Source: dadadodo Section: text Priority: optional Maintainer: Gergely Nagy Build-Depends: debhelper (>= 9~), dh-exec Homepage: http://www.jwz.org/dadadodo/ Vcs-Git: git://git.madhouse-project.org/debian/dadadodo.git Vcs-Browser: http://git.madhouse-project.org/debian/dadadodo/ Standards-Version: 3.9.3 Package: dadadodo Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Exterminates all rational thought DadaDodo is a program that analyses texts for Markov chains of word probabilities and then generates random sentences based on that. Sometimes these sentences are nonsense; but sometimes they cut right through to the heart of the matter and reveal hidden meanings. debian/dadadodo.manpages0000644000000000000000000000003011750772216012443 0ustar debian/local/dadadodo.1