summaryrefslogtreecommitdiff
path: root/libbb/print_file.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-04-09 22:48:12 +0000
committerEric Andersen <andersen@codepoet.org>2001-04-09 22:48:12 +0000
commite5dfced23a904d08afa5dcee190c3c3d845d9f50 (patch)
treeef367ee8a9096884fb40debdc9e10af8583f9d5f /libbb/print_file.c
parenta75e2867435faa68ea03735fe09ad298fa3e4e72 (diff)
downloadbusybox-w32-e5dfced23a904d08afa5dcee190c3c3d845d9f50.tar.gz
busybox-w32-e5dfced23a904d08afa5dcee190c3c3d845d9f50.tar.bz2
busybox-w32-e5dfced23a904d08afa5dcee190c3c3d845d9f50.zip
Apply Vladimir's latest cleanup patch.
-Erik
Diffstat (limited to 'libbb/print_file.c')
-rw-r--r--libbb/print_file.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/libbb/print_file.c b/libbb/print_file.c
index 52a39774f..b47723454 100644
--- a/libbb/print_file.c
+++ b/libbb/print_file.c
@@ -2,9 +2,7 @@
2/* 2/*
3 * Utility routines. 3 * Utility routines.
4 * 4 *
5 * Copyright (C) tons of folks. Tracking down who wrote what 5 * Copyright (C) 1999-2001 Erik Andersen <andersee@debian.org>
6 * isn't something I'm going to worry about... If you wrote something
7 * here, please feel free to acknowledge your work.
8 * 6 *
9 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -19,13 +17,10 @@
19 * You should have received a copy of the GNU General Public License 17 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
24 * Permission has been granted to redistribute this code under the GPL.
25 *
26 */ 20 */
27 21
28#include <stdio.h> 22#include <stdio.h>
23#include <sys/stat.h>
29#include "libbb.h" 24#include "libbb.h"
30 25
31 26
@@ -41,11 +36,21 @@ extern void print_file(FILE *file)
41 36
42extern int print_file_by_name(char *filename) 37extern int print_file_by_name(char *filename)
43{ 38{
44 FILE *file; 39 struct stat statBuf;
45 if ((file = wfopen(filename, "r")) == NULL) 40 int status = TRUE;
46 return FALSE; 41
47 print_file(file); 42 if(is_directory(filename, TRUE, &statBuf)==TRUE) {
48 return TRUE; 43 error_msg("%s: Is directory", filename);
44 status = FALSE;
45 } else {
46 FILE *f = wfopen(filename, "r");
47 if(f!=NULL)
48 print_file(f);
49 else
50 status = FALSE;
51 }
52
53 return status;
49} 54}
50 55
51 56