r9365 - in packages/branches/upstream: ! dirs' list truncated !
Peter Pentchev
roam-guest at alioth.debian.org
Fri Apr 3 13:06:19 UTC 2009
Author: roam-guest
Date: 2009-04-03 13:06:19 +0000 (Fri, 03 Apr 2009)
New Revision: 9365
Added:
packages/branches/upstream/cookietool/
packages/branches/upstream/cookietool/current/
packages/branches/upstream/cookietool/current/Makefile
packages/branches/upstream/cookietool/current/compress.c
packages/branches/upstream/cookietool/current/doc/
packages/branches/upstream/cookietool/current/doc/cdbdiff.6
packages/branches/upstream/cookietool/current/doc/cdbsplit.6
packages/branches/upstream/cookietool/current/doc/cookietool.6
Log:
[svn-inject] Installing original source of cookietool
Added: packages/branches/upstream/cookietool/current/Makefile
===================================================================
--- packages/branches/upstream/cookietool/current/Makefile (rev 0)
+++ packages/branches/upstream/cookietool/current/Makefile 2009-04-03 13:06:19 UTC (rev 9365)
@@ -0,0 +1,48 @@
+# $Id: Makefile,v 1.6 2000/06/17 18:49:22 baran Exp $
+# slightly rewritten original Wilhelm Noeker's Makefile
+
+targets = cookietool cdbsplit cdbdiff
+objects = cookietool.o cdbsplit.o cdbdiff.o strstuff.o \
+ cookio.o compress.o
+prefix = usr
+binprefix = $(prefix)/games
+manprefix = $(prefix)/share/man/man6
+CC = gcc
+RM = rm -v
+INSTALL = install
+CFLAGS = -O2 -Wall
+
+build : $(targets)
+
+strstuff.o : strstuff.c strstuff.h
+cookio.o : cookio.c cookio.h
+compress.o : compress.c compress.h
+
+cookietool : cookietool.o strstuff.o compress.o cookio.o
+cookietool.o : cookietool.c strstuff.h compress.h cookio.h
+
+cdbdiff : cdbdiff.o strstuff.o compress.o cookio.o
+cdbdiff.o : cdbdiff.c strstuff.h compress.h cookio.h
+
+cdbsplit : cdbsplit.o strstuff.o cookio.o
+cdbsplit.o : cdbsplit.c strstuff.h cookio.h
+
+clean :
+ @-$(RM) $(targets) $(objects)
+
+# for AmigaOS installation change install-binary-unix to
+# install-binary-amiga; for non-debian-installation, use `make all'
+
+install : install-binary # install-manpages
+
+install-binary :
+ @for file in $(targets); do \
+ $(INSTALL) -m 0755 $$file $(DESTDIR)/$(binprefix)/$$file; \
+ done;
+
+install-manpages :
+ @for file in doc/*.6; do \
+ $(INSTALL) -m 0644 $$file $(DESTDIR)/$(manprefix)/$$file; \
+ done;
+
+all : build install install-manpages
Added: packages/branches/upstream/cookietool/current/compress.c
===================================================================
--- packages/branches/upstream/cookietool/current/compress.c (rev 0)
+++ packages/branches/upstream/cookietool/current/compress.c 2009-04-03 13:06:19 UTC (rev 9365)
@@ -0,0 +1,336 @@
+/*
+ cookietool is (c) 1995-2001 by Wilhelm Noeker (wnoeker at t-online.de)
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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 program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA
+
+ */
+
+
+/*========================================================================*\
+ | File: compress.c Date: 22 Mar 2001 |
+ *------------------------------------------------------------------------*
+ | Read cookies, remove duplicates, sort, and write back to file. |
+ | These routines are common to both cookietool and cdbdiff. |
+ | |
+\*========================================================================*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "cookio.h"
+#include "compress.h"
+
+
+
+struct cookie
+ {
+ UBYTE *text;
+ UBYTE *sorthook;
+ long size;
+ long number;
+ };
+
+struct cookie *clist = NULL;
+long listsize = 0; /* will be adjusted dynamically */
+long listed = 0;
+
+
+/*
+ * Assign ascending numbers to all cookies in the list and reset each sort
+ * hook to the start of its body text.
+ */
+void rebuild_listinfo()
+ {
+ long l;
+
+ for( l = 0; l < listed; l++ )
+ {
+ clist[ l ].number = l;
+ clist[ l ].sorthook = clist[ l ].text;
+ }
+ }
+
+
+
+/*
+ * Build cookie list from file.
+ * The list may or may not be empty before this call.
+ */
+void read_cookies( FILE *fp, int fmt )
+ {
+ long lines, cbuflen, offset, ignored = 0;
+ char *cptr;
+
+ offset = listed; /* may or may not be 0 */
+ printf( "Reading cookies..." );
+ fflush( stdout );
+ while( (cptr = read_cookie( fp, fmt, &cbuflen, &lines, NULL )) != NULL )
+ {
+ if( lines > 0 )
+ { /* store the cookie */
+ if( listed == listsize )
+ { /* we start with listsize==0, clist==NULL ! */
+ listsize = 3 * listsize / 2 + 1000;
+ clist = realloc( clist, listsize * sizeof( struct cookie ) );
+ if( !clist )
+ {
+ printf( "\nList reallocation failed\n" );
+ exit( 20 );
+ }
+ }
+ clist[ listed ].text = malloc( cbuflen + 1 ); /* mind the '\0'! */
+ if( clist[ listed ].text != NULL )
+ {
+ clist[ listed ].size = cbuflen;
+ strcpy( clist[ listed ].text, cptr );
+ }
+ else
+ {
+ printf( "\nOut of memory\n" );
+ exit( 20 );
+ }
+ listed++;
+ }
+ else
+ ignored++; /* or ignore it */
+ }
+ rebuild_listinfo();
+ printf( " done. (%ld read, %ld empty)\n", listed-offset, ignored );
+ }
+
+
+/*
+ * Write cookies to file, optionally skipping some at the start of the
+ * list.
+ */
+void write_cookies( FILE *fp, int fmt, long offset )
+ {
+ long l;
+
+ printf( "Writing cookies..." );
+ fflush( stdout );
+ for( l = offset; l < listed; l++ )
+ if( !write_cookie( clist[ l ].text, fp, fmt ) )
+ {
+ printf( "\nFile error, aborted !!!\n" );
+ exit( 20 );
+ }
+ printf( " done. (%ld written)\n", listed-offset );
+ }
+
+
+
+/*
+ * Cookie comparison, for sorting.
+ */
+int cookie_cmp( struct cookie *a, struct cookie *b, int mode )
+ {
+ int c = 0;
+
+ switch( mode )
+ {
+ case SORT_BODY: /* by name */
+ c = str_cmp( a->sorthook, b->sorthook );
+ break;
+ case SORT_REVERSE: /* descending, by name */
+ c = str_cmp( b->sorthook, a->sorthook );
+ break;
+ case SORT_SIZE: /* by size */
+ c = a->size - b->size;
+ break;
+ }
+ if( c == 0 ) /* when in doubt, the number decides */
+ c = a->number - b->number;
+ return c;
+ }
+
+
+
+/*
+ * sift(): does the main work for my_heapsort()
+ */
+void sift( struct cookie v[], long i, long m, int mode )
+ {
+ long j;
+ struct cookie temp;
+
+ while( (j = 2 * (i + 1) - 1) <= m )
+ {
+ if( j < m && cookie_cmp( &v[ j ], &v[ j + 1 ], mode ) < 0 )
+ j++;
+ if( cookie_cmp( &v[ i ], &v[ j ], mode ) < 0 )
+ {
+ temp = v[ i ];
+ v[ i ] = v[ j ];
+ v[ j ] = temp;
+ i = j;
+ }
+ else
+ i = m; /* done */
+ }
+ }
+
+
+/*
+ * Note the side effect: Will print three "."s to stdout: one on entry,
+ * one when the sort is halfway through, and another one when it's all done.
+ */
+void my_heapsort( struct cookie v[], long n, int mode )
+ {
+ long i;
+ struct cookie temp;
+
+ putchar( '.' ); fflush( stdout );
+ if( n < 2 ) /* no sorting necessary */
+ return;
+ for( i = n/2 - 1; i >= 0; i-- )
+ sift( v, i, n - 1, mode );
+ putchar( '.' ); fflush( stdout );
+ for( i = n - 1; i >= 1; i-- )
+ {
+ temp = v[ 0 ];
+ v[ 0 ] = v[ i ];
+ v[ i ] = temp;
+ sift( v, 0, i - 1, mode );
+ }
+ putchar( '.' ); fflush( stdout );
+ }
+
+
+
+/*
+ * Adjust sorthooks for the final sort, according to the desired mode.
+ */
+void set_hooks( int mode, UBYTE *hooktarget )
+ {
+ long l;
+ int hot;
+ UBYTE *s;
+
+ printf( "Adjusting sort hooks..." );
+ fflush( stdout );
+ for( l = 0; l < listed; l++ )
+ {
+ s = clist[ l ].text;
+ switch( mode )
+ {
+ case SORT_LASTLINE: /* start of last line */
+ hot = 1;
+ while( *s )
+ {
+ if( *s == '\n' )
+ hot = 1;
+ else if( hot )
+ {
+ clist[ l ].sorthook = s;
+ hot = 0;
+ }
+ s++;
+ }
+ break;
+ case SORT_LASTWORD: /* start of last word */
+ hot = 1;
+ while( *s )
+ {
+ if( isspace( *s ) )
+ hot = 1;
+ else if( hot )
+ {
+ clist[ l ].sorthook = s;
+ hot = 0;
+ }
+ s++;
+ }
+ break;
+ case SORT_HOOKTARGET:
+ while( s ) /* at last occurence of <hooktarget> */
+ {
+ clist[ l ].sorthook = s++;
+ s = strstr( s, hooktarget );
+ }
+ break;
+ default:
+ }
+ }
+ printf( " done.\n" );
+ }
+
+
+
+/*
+ * Delete cookies and (optionally) log them to a file. For values of delmode
+ * and sortmode, see "compress.h".
+ * Note that the routine expects the sorthooks to point at the body texts
+ * on entry, but may modify and not restore them itself. There are many
+ * reasons why this does *not* hurt with the current implementations of both
+ * cookietool and cdbdiff, but it might be a pitfall in the future.
+ */
+void one_cookie( int delmode, int sortmode, UBYTE *hooktarget, FILE *fp, int fmt )
+ {
+ long i, j, dbl = 0, abr = 0;
+ int cmp;
+
+ if( delmode != DUPDEL_NONE )
+ {
+ printf( "Removing double entries" );
+ if( delmode == DUPDEL_ABBREVS )
+ printf( " + 'abbreviations'" );
+ /* sort descending by string */
+ my_heapsort( clist, listed, SORT_REVERSE );
+ for( i = listed - 1; i > 0; i = j )
+ {
+ for( j = i - 1; j >= 0
+ && ( (cmp = str_cmp( clist[ j ].text, clist[ i ].text )) == 0
+ || (delmode == DUPDEL_ABBREVS && cmp == STR_LONGER) ); j-- )
+ {
+ if( fp )
+ if( !write_cookie( clist[ i ].text, fp, fmt ) )
+ {
+ printf( "\nFile error, aborted !!!\n" );
+ exit( 20 );
+ }
+ free( clist[ i ].text );
+ clist[ i-- ] = clist[ --listed ];
+ if( cmp == 0 )
+ dbl++;
+ else
+ abr++;
+ }
+ }
+ printf( " done. (%ld ", dbl );
+ if( delmode == DUPDEL_ABBREVS )
+ printf( "+ %ld ", abr );
+ printf( "found)\n" );
+ }
+ if( sortmode == SORT_RESTORE )
+ {
+ printf( "Restoring order" );
+ my_heapsort( clist, listed, SORT_RESTORE );
+ }
+ else
+ {
+ if( sortmode > SORT_BODY )
+ set_hooks( sortmode, hooktarget );
+ printf( "Sorting" );
+ if( sortmode == SORT_SIZE )
+ my_heapsort( clist, listed, SORT_SIZE );
+ else
+ my_heapsort( clist, listed, SORT_BODY );
+ }
+ printf( " done.\n" );
+ }
+
Added: packages/branches/upstream/cookietool/current/doc/cdbdiff.6
===================================================================
--- packages/branches/upstream/cookietool/current/doc/cdbdiff.6 (rev 0)
+++ packages/branches/upstream/cookietool/current/doc/cdbdiff.6 2009-04-03 13:06:19 UTC (rev 9365)
@@ -0,0 +1,48 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" $Jubal::Debian::Packages$
+.TH COOKIETOOL 6 "May 19, 2001"
+.SH NAME
+cdbdiff \- program to operate cookie (fortune) database
+.SH SYNOPSIS
+.B cdbdiff
+.RI [ options ] " <database1> <database2> <resultfile>"
+.SH DESCRIPTION
+This manual page documents briefly the \fBcdbdiff\fP command.
+
+This manual page was written for the Debian GNU/Linux distribution
+because the original program does not have a manual page. Instead, it
+has some plaintext documentation, see below.
+.PP
+\fBcdbdiff\fP is a program that compares two cookie databases and
+builds a list of those cookies that are only present in second, but not
+in the first of them. The input files are not modified in any way.
+.SH OPTIONS
+A summary of options is included below. For a complete description, see
+the documentation in \fI/usr/share/doc/cookietool\fP directory
+.TP
+.B [nothing]
+Shows summary of options.
+.TP
+.B \-c
+case sensitive comparisons.
+.TP
+.B \-d[0-3]
+how fuzzy about word delimiters? (default: 2)
+.TP
+.B \-f[0-3]
+input file format \- \-f3: cookies are separated by '%%' lines; \-f2:
+cookies are separated by '%' lines (DEFAULT); \-f1: each line is a
+cookie; \-f0: each word is a cookie.
+.TP
+.B \-a
+append if <resultfile> exists (instead of failing).
+.SH SEE ALSO
+\fBcookietool(6)\fP, \fBcdbsplit(6)\fP
+.SH BUGS
+None known.
+.SH AUTHOR
+Upstream author and Aminet cookietool.lha package with AmigaOS binaries
+uploader is Wilhelm Nöker, <wnoeker at t-online.de>. Unix manpages
+(including this one) and makefile are maintained by Miros/law L. Baran
+<baran at debian.org>. This manual page uses many excerpts from the
+original README file.
Added: packages/branches/upstream/cookietool/current/doc/cdbsplit.6
===================================================================
--- packages/branches/upstream/cookietool/current/doc/cdbsplit.6 (rev 0)
+++ packages/branches/upstream/cookietool/current/doc/cdbsplit.6 2009-04-03 13:06:19 UTC (rev 9365)
@@ -0,0 +1,84 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" $Jubal::Debian::Packages$
+.TH COOKIETOOL 6 "May 19, 2001"
+.SH NAME
+cdbsplit \- program to operate cookie (fortune) database
+.SH SYNOPSIS
+.B cdbsplit
+.RI [ options ] " <cookie-database> <hitfile>"
+.SH DESCRIPTION
+This manual page documents briefly the \fBcdbsplit\fP command.
+
+This manual page was written for the Debian GNU/Linux distribution
+because the original program does not have a manual page. Instead, it
+has some plain text documentation, see below.
+.PP
+\fBcdbsplit\fP is a program that can be used to operate cookie database
+in various formats, the default is standard fortune(6) format, i.e.
+list of 'cookies' delimited with line containing a single percent
+('\fB%\fP') char . With 'cdbsplit' you can split cookie database, or
+extract parts of it depending on various criteria.
+.SH OPTIONS
+A summary of options is included below. For a complete description, see
+the documentation in \fI/usr/share/doc/cookietool\fP directory.
+\fBNOTE\fP, that default behaviour is to overwrite existing database
+with its reduced version, so the cookies are MOVED to hitfile. The
+hitfile is never overwritten, but may be appended to.
+.TP
+.B [nothing]
+Shows summary of options.
+.TP
+.B \-c
+case-sensitive comparisons (for both keywords and groups)
+.TP
+.B \-d[0-3]
+how fuzzy about word delimiters? (default: 2)
+.TP
+.B \-k<keyword>
+optional keyword
+.TP
+.B \-K<keyword>
+mandatory keyword (use both of them to form boolean expressions)
+.TP
+.B \-l<min_lines>
+minimal cookie length (in lines)
+.TP
+.B \-L<max_lines>
+maximal cookie length (in lines)
+.TP
+.B \-w<chars>
+minimal line width (in chars)
+.TP
+.B \-W<chars>
+maximal line width (in chars)
+.TP
+.B \-n<min_number>
+start at cookie <min_number>
+.TP
+.B \-N<max_number>
+stop after <max_number> cookie
+.TP
+.B \-m<chars>
+find groups of cookies starting with <n> matching characters (database
+must be sorted for this to make sense!)
+.TP
+.B \-x
+extract only, don't modify <cookie-database>
+.TP
+.B \-a
+append, don't overwrite <hitfile> if such a filename exists
+.TP
+.B \-f[0-3]
+input file format \- \-f3: cookies are separated by '%%' lines; \-f2:
+cookies are separated by '%' lines (DEFAULT); \-f1: each line is a
+cookie; \-f0: each word is a cookie.
+.SH SEE ALSO
+\fBcookietool(6)\fP, \fBcdbdiff(6)\fP
+.SH BUGS
+None known.
+.SH AUTHOR
+Upstream author and Aminet cookietool.lha package with AmigaOS binaries
+uploader is Wilhelm Nöker, <wnoeker at t-online.de>. Unix manpages
+(including this one) and makefile are maintained by Miros/law L. Baran
+<baran at debian.org>. This manual page uses many excerpts from the
+original README file.
Added: packages/branches/upstream/cookietool/current/doc/cookietool.6
===================================================================
--- packages/branches/upstream/cookietool/current/doc/cookietool.6 (rev 0)
+++ packages/branches/upstream/cookietool/current/doc/cookietool.6 2009-04-03 13:06:19 UTC (rev 9365)
@@ -0,0 +1,68 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" $Jubal::Debian::Packages$
+.TH COOKIETOOL 6 "May 19, 2001"
+.SH NAME
+cookietool \- program to operate cookie (fortune) database
+.SH SYNOPSIS
+.B cookietool
+.RI [ options ] " <database>"
+.SH DESCRIPTION
+This manual page documents briefly the \fBcookietool\fP command.
+
+This manual page was written for the Debian GNU/Linux distribution
+because the original program does not have a manual page. Instead, it
+has some plaintext documentation, see below.
+.PP
+\fBcookietool\fP is a program that should be used to sort, clear and
+maintain cookie database in standard fortune(6) format, i.e. list of
+\fBcookies\fP delimited with line containing a single percent
+('\fB%\fP') char. \fBcookietool\fP can now understand another formats
+and convert
+cookie database between them.
+.SH OPTIONS
+A summary of options is included below. For a complete description, see
+the documentation in \fI/usr/share/doc/cookietool\fP directory
+.TP
+.B [nothing]
+Shows summary of options.
+.TP
+.B \-c
+case sensitive comparisons.
+.TP
+.B \-d[0-3]
+how fuzzy about word delimiters? (default: 2)
+.TP
+.B \-b
+delete cookies that are 'abbreviations' of another, too.
+.TP
+.B \-p
+passive, don't delete anything.
+.TP
+.B \-s[l|w|<sep>|s]
+sort cookies; looking after last line only; looking after last word
+only; starting after the last <sep>, e.g. '-s--'; by size.
+.TP
+.B \-a
+treat 'abbreviations' as doubles (i.e. delete them from the database,
+too).
+.TP
+.B \-f[0-3]
+input file format \- \-f3: cookies are separated by '%%' lines; \-f2:
+cookies are separated by '%' lines (DEFAULT); \-f1: each line is a
+cookie; \-f0: each word is a cookie.
+.TP
+.B \-F[0-3]
+force output in a different file format, see \-f.
+.TP
+.B \-o
+overwrite directly without temporary file. CAUTION NEEDED.
+.SH SEE ALSO
+\fBcdbdiff(6)\fP, \fBcdbsplit(6)\fP
+.SH BUGS
+None known.
+.SH AUTHOR
+Upstream author and Aminet cookietool.lha package with AmigaOS binaries
+uploader is Wilhelm Nöker, <wnoeker at t-online.de>. Unix manpages
+(including this one) and makefile are maintained by Miros/law L. Baran
+<baran at debian.org>. This manual page uses many excerpts from the
+original README file.
More information about the Pkg-games-commits
mailing list