wc.c (98165) | wc.c (98245) |
---|---|
1/* 2 * Copyright (c) 1980, 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40#if 0 41#ifndef lint 42static char sccsid[] = "@(#)wc.c 8.1 (Berkeley) 6/6/93"; 43#endif /* not lint */ 44#endif 45 46#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1980, 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40#if 0 41#ifndef lint 42static char sccsid[] = "@(#)wc.c 8.1 (Berkeley) 6/6/93"; 43#endif /* not lint */ 44#endif 45 46#include <sys/cdefs.h> |
47__FBSDID("$FreeBSD: head/usr.bin/wc/wc.c 98165 2002-06-13 12:48:50Z tjr $"); | 47__FBSDID("$FreeBSD: head/usr.bin/wc/wc.c 98245 2002-06-15 08:31:19Z tjr $"); |
48 49#include <sys/param.h> 50#include <sys/stat.h> 51 52#include <ctype.h> 53#include <err.h> 54#include <errno.h> 55#include <fcntl.h> --- 121 unchanged lines hidden (view full) --- 177 tcharct += charct; 178 (void)printf(" %7ju", charct); 179 } 180 (void)close(fd); 181 return (0); 182 } 183 /* 184 * If all we need is the number of characters and it's a | 48 49#include <sys/param.h> 50#include <sys/stat.h> 51 52#include <ctype.h> 53#include <err.h> 54#include <errno.h> 55#include <fcntl.h> --- 121 unchanged lines hidden (view full) --- 177 tcharct += charct; 178 (void)printf(" %7ju", charct); 179 } 180 (void)close(fd); 181 return (0); 182 } 183 /* 184 * If all we need is the number of characters and it's a |
185 * regular or linked file, just stat the puppy. | 185 * regular file, just stat the puppy. |
186 */ 187 if (dochar || domulti) { 188 if (fstat(fd, &sb)) { 189 warn("%s: fstat", file); 190 (void)close(fd); 191 return (1); 192 } | 186 */ 187 if (dochar || domulti) { 188 if (fstat(fd, &sb)) { 189 warn("%s: fstat", file); 190 (void)close(fd); 191 return (1); 192 } |
193 if (S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)) { | 193 if (S_ISREG(sb.st_mode)) { |
194 (void)printf(" %7lld", (long long)sb.st_size); 195 tcharct += sb.st_size; 196 (void)close(fd); 197 return (0); 198 } 199 } 200 } 201 --- 66 unchanged lines hidden --- | 194 (void)printf(" %7lld", (long long)sb.st_size); 195 tcharct += sb.st_size; 196 (void)close(fd); 197 return (0); 198 } 199 } 200 } 201 --- 66 unchanged lines hidden --- |