wc.c (98291) | wc.c (101670) |
---|---|
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 98291 2002-06-16 06:04:43Z tjr $"); | 47__FBSDID("$FreeBSD: head/usr.bin/wc/wc.c 101670 2002-08-11 10:52:13Z 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> 56#include <locale.h> 57#include <stdint.h> 58#include <stdio.h> 59#include <stdlib.h> 60#include <string.h> 61#include <unistd.h> | 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> 56#include <locale.h> 57#include <stdint.h> 58#include <stdio.h> 59#include <stdlib.h> 60#include <string.h> 61#include <unistd.h> |
62#include <wctype.h> |
|
62 63uintmax_t tlinect, twordct, tcharct; 64int doline, doword, dochar, domulti; 65 66static int cnt(const char *); 67static void usage(void); 68 69int --- 159 unchanged lines hidden (view full) --- 229 break; 230 } 231 } 232 charct++; 233 len -= clen; 234 p += clen; 235 if (wch == L'\n') 236 ++linect; | 63 64uintmax_t tlinect, twordct, tcharct; 65int doline, doword, dochar, domulti; 66 67static int cnt(const char *); 68static void usage(void); 69 70int --- 159 unchanged lines hidden (view full) --- 230 break; 231 } 232 } 233 charct++; 234 len -= clen; 235 p += clen; 236 if (wch == L'\n') 237 ++linect; |
237 /* XXX Non-portable; should use iswspace() */ 238 if (isspace(wch)) | 238 if (iswspace(wch)) |
239 gotsp = 1; 240 else if (gotsp) { 241 gotsp = 0; 242 ++wordct; 243 } 244 } 245 } 246 if (doline) { --- 21 unchanged lines hidden --- | 239 gotsp = 1; 240 else if (gotsp) { 241 gotsp = 0; 242 ++wordct; 243 } 244 } 245 } 246 if (doline) { --- 21 unchanged lines hidden --- |