-
- for(a=0;a<argc;a++)
- {
- file=xfopen(argv[a],"r");
-
- pipe:
-
- count=0;
- string=xmalloc(n);
- string[n]='\0';
- n--;
- while(1)
- {
- c=fgetc(file);
- if(ISSTR(c))
- {
- if(i==0)
- t=count;
- if(i<=n)
- string[i]=c;
- if(i==n)
- {
- if(opt == 1 || opt == 3 )
- printf("%s: ",(!argv[a])?"{stdin}":argv[a]);
- if(opt >= 2 )
- printf("%7lo ",t);
- printf("%s",string);
+
+ do {
+ if ((file = bb_wfopen(*argv, "r"))) {
+PIPE:
+ count = 0;
+ do {
+ c = fgetc(file);
+ if (ISSTR(c)) {
+ if (i <= n) {
+ string[i]=c;
+ } else {
+ putchar(c);
+ }
+ if (i == n) {
+ if (opt & PRINT_NAME) {
+ printf(fmt, *argv);
+ }
+ if (opt & PRINT_OFFSET) {
+ printf("%7lo ", count - n );
+ }
+ printf("%s", string);
+ }
+ i++;
+ } else {
+ if (i > n) {
+ putchar('\n');
+ }
+ i = 0;