From 84cc0252d7bf1cc8514ef347e150e9c8b930f0bd Mon Sep 17 00:00:00 2001 From: joeyh Date: Mon, 13 Mar 2006 17:06:37 +0000 Subject: [PATCH] releasing version 0.6 --- Makefile | 7 ++-- README | 16 ++++++++- debian/changelog | 7 ++++ debian/control | 2 +- debian/copyright | 23 ++++++++++-- sponge | 54 ++++++++++++++++++++++++++++ sponge.c | 91 ------------------------------------------------ sponge.docbook | 64 ---------------------------------- 8 files changed, 100 insertions(+), 164 deletions(-) create mode 100755 sponge delete mode 100644 sponge.c delete mode 100644 sponge.docbook diff --git a/Makefile b/Makefile index 7cacd7e..a4527e0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -BINS=isutf8 sponge ifdata -PERLSCRIPTS=vidir vipe ts combine +BINS=isutf8 ifdata +PERLSCRIPTS=vidir vipe ts combine sponge MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifdata.1 CFLAGS=-O2 -g -Wall @@ -22,9 +22,6 @@ check: isutf8 isutf8.1: isutf8.docbook docbook2x-man isutf8.docbook -sponge.1: sponge.docbook - docbook2x-man sponge.docbook - ifdata.1: ifdata.docbook docbook2x-man ifdata.docbook diff --git a/README b/README index a69a6ec..061c31f 100644 --- a/README +++ b/README @@ -10,7 +10,7 @@ ts vidir edit a directory in your text editor vipe - edit a pipe using your text editor + insert a text editor into a pipe combine combine the lines in two files using boolean operations ifdata @@ -40,4 +40,18 @@ tmp add adds up numbers from stdin +todist + inputs a list of numbers and outputs their distribution, a value + and how many time it occurs in the input + http://baruch.ev-en.org/files/todist + + Not a general enough unix tool, probably? + +tostats + inputs a list of numbers and outputs some statistics about the + numbers: average, stddev, min, max, mid point + http://baruch.ev-en.org/files/todist + + Not a general enough unix tool, probably? + -- Joey Hess diff --git a/debian/changelog b/debian/changelog index 9eeedd9..f9b2baf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +moreutils (0.6) unstable; urgency=low + + * Revert to perl sponge since the C one corrupts larger files. + Hopefully temporary.. + + -- Joey Hess Fri, 10 Mar 2006 15:33:43 -0500 + moreutils (0.5) unstable; urgency=low * Added ifdata, by Benjamin BAYART (originally called ifcfg). diff --git a/debian/control b/debian/control index d0c752e..a49a3e1 100644 --- a/debian/control +++ b/debian/control @@ -17,6 +17,6 @@ Description: additional unix utilities - sponge: soak up standard input and write to a file - ts: timestamp standard input - vidir: edit a directory in your text editor - - vipe: edit a pipe using your text editor + - vipe: insert a text editor into a pipe - combine: combine the lines in two files using boolean operations - ifdata: get network interface info without parsing ifconfig output diff --git a/debian/copyright b/debian/copyright index 1f3a9a4..455e406 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,8 +4,27 @@ This package was put together and debianized by Joey Hess isutf8 is Copyright (C) 2005 by Lars Wirzenius, under the terms of the GPL. -spong is Copyright (C) 2006 by Tollef Fog Heen, under the terms of -the GPL version 2. Name and concept by Colin Watson. +sponge has this copyright: +# Copyright (C) 2003 Colin Watson . +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE +# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ifdata is Copyright (C) 2002 by Benjamin BAYART, under the terms of the GPL. It was originally called ifcfg and has a web page here: diff --git a/sponge b/sponge new file mode 100755 index 0000000..324970b --- /dev/null +++ b/sponge @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +=head1 NAME + +sponge - soak up standard input and write to a file + +=head1 SYNOPSIS + +sed '...' file | grep '...' | sponge file + +=head1 DESCRIPTION + +sponge reads standard input and writes it out to the specified file. +Unlike a shell redirect, sponge soaks up all its input before opening the +output file. This allows for constructing pipelines that read from and write +to the same file. + +=head1 AUTHOR + +Colin Watson + +=cut + +use warnings; +use strict; + +# Copyright (C) 2003 Colin Watson . +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE +# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +my $file=shift || die "usage: sponge file\n"; +binmode STDIN; +undef $/; +my $input = ; +open OUT, ">$file" or die "couldn't open $file: $!"; +print OUT $input or die "couldn't write to $file: $!"; +close OUT or die "couldn't close $file: $!"; diff --git a/sponge.c b/sponge.c deleted file mode 100644 index 59952ea..0000000 --- a/sponge.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * sponge.c - read in all available info from stdin, then output it to - * file named on the command line - * - * Copyright © 2006 Tollef Fog Heen - * - * This program 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 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 - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -void usage() { - printf("sponge : suck in all input from stdin and write it to "); - exit(0); -} - -int main(int argc, char **argv) { - char *buf, *bufstart; - size_t bufsize = 8192; - size_t bufused = 0; - ssize_t i = 0; - int outfd; - - if (argc != 2) { - usage(); - } - - bufstart = buf = malloc(bufsize); - if (!buf) { - perror("malloc"); - exit(1); - } - - while ((i = read(0, buf, bufsize - bufused)) > 0) { - bufused = bufused+i; - if (bufused == bufsize) { - bufsize *= 2; - bufstart = realloc(bufstart, bufsize); - if (!bufstart) { - perror("realloc"); - exit(1); - } - - buf = bufstart + bufused; - } - } - if (i == -1) { - perror("read"); - exit(1); - } - - outfd = open(argv[1], O_CREAT | O_TRUNC | O_WRONLY, 0666); - if (outfd == -1) { - fprintf(stderr, "Can't open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - - i = write(outfd, bufstart, bufused); - if (i == -1) { - perror("write"); - exit(1); - } - - i = close(outfd); - if (i == -1) { - perror("close"); - exit(1); - } - - return 0; -} diff --git a/sponge.docbook b/sponge.docbook deleted file mode 100644 index 674ef05..0000000 --- a/sponge.docbook +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - Joey - Hess - - 2006-02-19 - - - - sponge - 1 - - - - sponge - soak up standard input and write to a file - - - - - sed '...' file | grep '...' | sponge file - - - - - DESCRIPTION - - sponge reads standard input and - writes it out to the specified file. Unlike a shell - redirect, sponge soaks up all its input before - opening the output file. This allows for - constructing pipelines that read from and write to - the same file. - - - -- 2.39.5