diff options
author | joeyh <joeyh> | 2006-03-13 17:06:37 +0000 |
---|---|---|
committer | joeyh <joeyh> | 2006-03-13 17:06:37 +0000 |
commit | 84cc0252d7bf1cc8514ef347e150e9c8b930f0bd (patch) | |
tree | d4330fe66d3e46c6ec4a179d2e004f3a5b65ca3e | |
parent | 7b031cc5149b6558cb5964b8db55538792de3ea6 (diff) | |
download | moreutils-84cc0252d7bf1cc8514ef347e150e9c8b930f0bd.tar.gz |
releasing version 0.60.6
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | README | 16 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/copyright | 23 | ||||
-rwxr-xr-x | sponge | 54 | ||||
-rw-r--r-- | sponge.c | 91 | ||||
-rw-r--r-- | sponge.docbook | 64 |
8 files changed, 100 insertions, 164 deletions
@@ -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 @@ -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 <joey@kitenet.net> 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 <joeyh@debian.org> 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 <cjwatson@debian.org>. +# +# 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: @@ -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 <cjwatson@debian.org> + +=cut + +use warnings; +use strict; + +# Copyright (C) 2003 Colin Watson <cjwatson@debian.org>. +# +# 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 = <STDIN>; +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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -#include <string.h> - -void usage() { - printf("sponge <file>: suck in all input from stdin and write it to <file>"); - 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 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - -Copyright © 2006 Joey Hess - -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 - ---> - -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN" -"file:///usr/share/xml/docbook/schema/dtd/4.4/docbookx.dtd" -[]> - -<refentry> - - <refentryinfo> - <author> - <firstname>Joey</firstname> - <surname>Hess</surname> - </author> - <date>2006-02-19</date> - </refentryinfo> - - <refmeta> - <refentrytitle>sponge</refentrytitle> - <manvolnum>1</manvolnum> - </refmeta> - - <refnamediv> - <refname>sponge</refname> - <refpurpose>soak up standard input and write to a file</refpurpose> - </refnamediv> - - <refsynopsisdiv> - <cmdsynopsis> - <command>sed '...' file | grep '...' | sponge file</command> - </cmdsynopsis> - </refsynopsisdiv> - - <refsect1> - <title>DESCRIPTION</title> - - <para><command>sponge</command> 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. </para> - - </refsect1> -</refentry> |