in an attempt to make the .bss section smaller.
*/
#include "internal.h"
+#include <errno.h>
#include <stdio.h>
static const char tee_usage[] =
/* FileList _______________________________________________________________ */
#define FL_MAX 1024
-static FILE *FileList[FL_MAX];
+static FILE **FileList;
static int FL_end;
typedef void (FL_Function) (FILE * file, char c);
}
/* init FILE pointers */
+ FileList = calloc(FL_MAX, sizeof(FILE*));
+ if (!FileList) {
+ fprintf(stderr, "tee: %s\n", strerror(errno));
+ exit(1);
+ }
FL_end = 0;
FileList[0] = stdout;
for (; i < argc; i++) {
/* clean up */
FL_apply(tee_fclose, 0);
+ free(FileList);
exit(0);
}
-/* $Id: tee.c,v 1.6 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: tee.c,v 1.7 2000/03/08 00:14:35 beppu Exp $ */
*/
#include "internal.h"
+#include <errno.h>
#include <stdio.h>
static const char tee_usage[] =
/* FileList _______________________________________________________________ */
#define FL_MAX 1024
-static FILE *FileList[FL_MAX];
+static FILE **FileList;
static int FL_end;
typedef void (FL_Function) (FILE * file, char c);
}
/* init FILE pointers */
+ FileList = calloc(FL_MAX, sizeof(FILE*));
+ if (!FileList) {
+ fprintf(stderr, "tee: %s\n", strerror(errno));
+ exit(1);
+ }
FL_end = 0;
FileList[0] = stdout;
for (; i < argc; i++) {
/* clean up */
FL_apply(tee_fclose, 0);
+ free(FileList);
exit(0);
}
-/* $Id: tee.c,v 1.6 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: tee.c,v 1.7 2000/03/08 00:14:35 beppu Exp $ */