/pee.c (6ba38f78da10b61c8670b1c450fa769248ef84c4) (1040 bytes) (mode 100644) (type blob)
#include <stdlib.h>
#include <stdio.h>
/* Licensed under the GPL
* Copyright (c) Miek Gieben, 2006
*/
/* like tee(1), but then connect to other programs using
* pipes _and_ output to standard output
*/
void
close_pipes(FILE **p, size_t i)
{
size_t j;
for (j = 0; j < i; j++)
pclose(p[j]);
}
int
main(int argc, char **argv) {
size_t i, r;
FILE **pipes;
char buf[BUFSIZ];
pipes = malloc(((argc - 1) * sizeof *pipes));
if (!pipes)
exit(EXIT_FAILURE);
for (i = 1; i < argc; i++) {
pipes[i - 1] = popen(argv[i], "w");
if (!pipes[i - 1]) {
fprintf(stderr, "Can not open pipe to '%s\'\n", argv[i]);
close_pipes(pipes, i);
exit(EXIT_FAILURE);
}
}
argc--;
while(!feof(stdin) && (!ferror(stdin))) {
r = fread(buf, sizeof(char), BUFSIZ, stdin);
for(i = 0; i < argc; i++) {
if (fwrite(buf, sizeof(char), r, pipes[i]) != r) {
fprintf(stderr, "Write error to `%s\'\n", argv[i + 1]);
close_pipes(pipes, i);
exit(EXIT_FAILURE);
}
}
}
close_pipes(pipes, argc);
exit(EXIT_SUCCESS);
}
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
17989 |
b7b5f53df1412df1e117607f18385b39004cdaa2 |
COPYING |
100644 |
blob |
883 |
f5142db3609d9e0b4041e9bbd244042206c426df |
Makefile |
100644 |
blob |
1048 |
ccc257cd3e6190cafffba1b73125677a16beea33 |
README |
100755 |
blob |
687 |
3abb315c7a9592c44f884cf5817dd062f9804f43 |
check-isutf8 |
100755 |
blob |
2607 |
a695935b24a5f2789c71a8affc4486859a41f737 |
combine |
040000 |
tree |
- |
46c7b55a7a07e3ee2e69b02ecff6b2cfec14de3b |
debian |
100644 |
blob |
12767 |
f8fa0240cfe7d245c22dbd09d77be08e479ada1d |
ifdata.c |
100644 |
blob |
7039 |
5f2837f71cb7ea8e1aa8481d854d975174e19ab9 |
ifdata.docbook |
100644 |
blob |
2345 |
817b1c510c92e581233bc19dc3c920b6c2c17181 |
ifne.c |
100644 |
blob |
1826 |
92c7f4835d7c28a65c173273ec734b53fe3fdb41 |
ifne.docbook |
100644 |
blob |
7296 |
4306c7d7a22b230db58248e3317ada4a1f60bb34 |
isutf8.c |
100644 |
blob |
2894 |
f9c9eb59e9e15197e686a25a93d8785e4522696a |
isutf8.docbook |
100644 |
blob |
5471 |
4925409bd548b058f07defe913724868801040df |
lckdo.c |
100644 |
blob |
3261 |
8a0a4a863aba57a7a4d7b06b69414c25c21dfa17 |
lckdo.docbook |
100644 |
blob |
5777 |
43ba76aa6f3d24cfe8bb90b3776b044f27df9d37 |
mispipe.c |
100644 |
blob |
2292 |
b645b2c756f9b79cdde96a4a82c63bd9fd60fbff |
mispipe.docbook |
100644 |
blob |
1040 |
6ba38f78da10b61c8670b1c450fa769248ef84c4 |
pee.c |
100644 |
blob |
1948 |
bbae794db60fb651b41727c216d047eef3929869 |
pee.docbook |
100644 |
blob |
7301 |
a53a2cf1906998c91533f5f5435ceeeeb1a7cd59 |
physmem.c |
100644 |
blob |
7736 |
dcd4abaaa37c30c00b15f3f0ef64391f90231a73 |
sponge.c |
100644 |
blob |
1757 |
f9395a72eb845f0c8007dd2777501a305243f579 |
sponge.docbook |
100755 |
blob |
1849 |
d1cbb16e1c31b3393901b0633c251a6d37ae782b |
ts |
100755 |
blob |
4488 |
7d382b237593dc88d471db016a3bdd8899f14ec8 |
vidir |
100755 |
blob |
1260 |
8cee2b1775c19a3e7e046984a325eebfc8b94ecf |
vipe |
100755 |
blob |
2018 |
7776db2d94f0d91a7783eab259ed9283f8c1703e |
zrun |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/nicolas/debian.moreutils
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/nicolas/debian.moreutils
Clone this repository using git:
git clone git://git.rocketgit.com/user/nicolas/debian.moreutils
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main