summaryrefslogtreecommitdiffhomepage
path: root/libbb/print_file.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
committerRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /libbb/print_file.c
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'libbb/print_file.c')
-rw-r--r--libbb/print_file.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/libbb/print_file.c b/libbb/print_file.c
deleted file mode 100644
index ea5d1d222..000000000
--- a/libbb/print_file.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Utility routines.
- *
- * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
- *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "libbb.h"
-
-void bb_xprint_and_close_file(FILE *file)
-{
- bb_xfflush_stdout();
- /* Note: Do not use STDOUT_FILENO here, as this is a lib routine
- * and the calling code may have reassigned stdout. */
- if (bb_copyfd_eof(fileno(file), STDOUT_FILENO) == -1) {
- /* bb_copyfd outputs any needed messages, so just die. */
- exit(bb_default_error_retval);
- }
- /* Note: Since we're reading, don't bother checking the return value
- * of fclose(). The only possible failure is EINTR which
- * should already have been taken care of. */
- fclose(file);
-}
-
-/* Returns:
- * 0 if successful
- * -1 if 'filename' does not exist or is a directory
- * exits with default error code if an error occurs
- */
-
-int bb_xprint_file_by_name(const char *filename)
-{
- FILE *f;
-
-#if 0
- /* This check shouldn't be necessary for linux, but is left
- * here disabled just in case. */
- struct stat statBuf;
-
- if(is_directory(filename, TRUE, &statBuf)) {
- bb_error_msg("%s: Is directory", filename);
- } else
-#endif
- if ((f = bb_wfopen(filename, "r")) != NULL) {
- bb_xprint_and_close_file(f);
- return 0;
- }
-
- return -1;
-}