--- coreutils-5.94/src/cut.c 2005-08-12 07:16:25.000000000 +0000 +++ coreutils-5.94-buf/src/cut.c 2006-04-04 08:32:26.000000000 +0000 @@ -738,6 +738,47 @@ return true; } +FILE* fd_to_stream(int fd) +{ + switch (fd) { + case STDIN_FILENO: return stdin; + case STDOUT_FILENO: return stdout; + case STDERR_FILENO: return stderr; + default: return (FILE*)NULL; + } +} + +void config_stream_buffers(void) +{ + int num_to_check=3; + int fd; + for (fd=0; fd 1) { + char* buf = malloc(value); + if (!buf) { + fprintf(stderr,"Error allocating buffer of %ld bytes\n",value); + } else { + setvbuf(stream, buf, _IOFBF, value); + } + } else { + fprintf(stderr,"Error value in %s=%s\n",name,value_str); + } + } +} + int main (int argc, char **argv) { @@ -746,6 +787,7 @@ bool delim_specified = false; char *spec_list_string IF_LINT(= NULL); + config_stream_buffers(); //must call before any stdio functions used initialize_main (&argc, &argv); program_name = argv[0]; setlocale (LC_ALL, "");