-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
isutf8.1: isutf8.docbook
docbook2x-man isutf8.docbook
-sponge.1: sponge.docbook
- docbook2x-man sponge.docbook
-
ifdata.1: ifdata.docbook
docbook2x-man ifdata.docbook
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
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>
+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).
- 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
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:
--- /dev/null
+#!/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: $!";
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-<?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>