5822
by Bernhard Reutner-Fischer
- move #include busybox.h to the very top so we pull in the config |
1 |
/* vi: set sw=4 ts=4: */
|
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
2 |
/*
|
3 |
* Monitor a pipe with a simple progress display.
|
|
4 |
*
|
|
5 |
* Copyright (C) 2003 by Rob Landley <rob@landley.net>, Joey Hess
|
|
6 |
*
|
|
11635
by Denys Vlasenko
*: make GNU licensing statement forms more regular |
7 |
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
8 |
*/
|
13755
by Denys Vlasenko
debianutils/*: convert to new-style "one file" applets |
9 |
//config:config PIPE_PROGRESS
|
16069
by Denys Vlasenko
config: update size information |
10 |
//config: bool "pipe_progress (275 bytes)"
|
13755
by Denys Vlasenko
debianutils/*: convert to new-style "one file" applets |
11 |
//config: default y
|
12 |
//config: help
|
|
14777
by Denys Vlasenko
config: deindent all help texts |
13 |
//config: Display a dot to indicate pipe activity.
|
13755
by Denys Vlasenko
debianutils/*: convert to new-style "one file" applets |
14 |
|
15 |
//applet:IF_PIPE_PROGRESS(APPLET(pipe_progress, BB_DIR_BIN, BB_SUID_DROP))
|
|
16 |
||
17 |
//kbuild:lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o
|
|
12256
by Pere Orga
move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c editors/*.c loginutils/*.c mailutils/*.c |
18 |
|
19 |
//usage:#define pipe_progress_trivial_usage NOUSAGE_STR
|
|
20 |
//usage:#define pipe_progress_full_usage ""
|
|
21 |
||
7574
by Denis Vlasenko
usage.c: remove reference to busybox.h |
22 |
#include "libbb.h" |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
23 |
|
24 |
#define PIPE_PROGRESS_SIZE 4096
|
|
25 |
||
5822
by Bernhard Reutner-Fischer
- move #include busybox.h to the very top so we pull in the config |
26 |
/* Read a block of data from stdin, write it to stdout.
|
27 |
* Activity is indicated by a '.' to stderr
|
|
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
28 |
*/
|
8059
by Denis Vlasenko
add -fvisibility=hidden to CC flags, mark XXX_main functions |
29 |
int pipe_progress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
9081
by Denis Vlasenko
*: rename ATTRIBUTE_XXX to just XXX. |
30 |
int pipe_progress_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
31 |
{
|
11404
by Denys Vlasenko
pipe_progress: shrink |
32 |
char buf[PIPE_PROGRESS_SIZE]; |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
33 |
time_t t = time(NULL); |
11404
by Denys Vlasenko
pipe_progress: shrink |
34 |
int len; |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
35 |
|
11404
by Denys Vlasenko
pipe_progress: shrink |
36 |
while ((len = safe_read(STDIN_FILENO, buf, PIPE_PROGRESS_SIZE)) > 0) { |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
37 |
time_t new_time = time(NULL); |
38 |
if (new_time != t) { |
|
39 |
t = new_time; |
|
11405
by Denys Vlasenko
pipe_progress: make it independent of printf machinery |
40 |
bb_putchar_stderr('.'); |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
41 |
}
|
11404
by Denys Vlasenko
pipe_progress: shrink |
42 |
full_write(STDOUT_FILENO, buf, len); |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
43 |
}
|
44 |
||
11405
by Denys Vlasenko
pipe_progress: make it independent of printf machinery |
45 |
bb_putchar_stderr('\n'); |
3663
by Glenn L McGrath
NEW APPLET: pipe_progress, used by debian installer |
46 |
|
47 |
return 0; |
|
48 |
}
|