colrm.c (92920) | colrm.c (100817) |
---|---|
1/*- 2 * Copyright (c) 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[] = "@(#)colrm.c 8.2 (Berkeley) 5/4/95"; 43#endif 44#endif 45 46#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 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[] = "@(#)colrm.c 8.2 (Berkeley) 5/4/95"; 43#endif 44#endif 45 46#include <sys/cdefs.h> |
47__FBSDID("$FreeBSD: head/usr.bin/colrm/colrm.c 92920 2002-03-22 01:22:50Z imp $"); | 47__FBSDID("$FreeBSD: head/usr.bin/colrm/colrm.c 100817 2002-07-28 15:22:43Z dwmalone $"); |
48 49#include <sys/types.h> 50#include <err.h> 51#include <errno.h> 52#include <limits.h> 53#include <stdio.h> 54#include <stdlib.h> 55#include <string.h> 56#include <unistd.h> 57 58#define TAB 8 59 60void check(FILE *); 61static void usage(void); 62 63int | 48 49#include <sys/types.h> 50#include <err.h> 51#include <errno.h> 52#include <limits.h> 53#include <stdio.h> 54#include <stdlib.h> 55#include <string.h> 56#include <unistd.h> 57 58#define TAB 8 59 60void check(FILE *); 61static void usage(void); 62 63int |
64main(argc, argv) 65 int argc; 66 char *argv[]; | 64main(int argc, char *argv[]) |
67{ 68 u_long column, start, stop; 69 int ch; 70 char *p; 71 72 while ((ch = getopt(argc, argv, "")) != -1) 73 switch(ch) { 74 case '?': --- 46 unchanged lines hidden (view full) --- 121 122 if ((!start || column < start || (stop && column > stop)) && 123 putchar(ch) == EOF) 124 check(stdout); 125 } 126} 127 128void | 65{ 66 u_long column, start, stop; 67 int ch; 68 char *p; 69 70 while ((ch = getopt(argc, argv, "")) != -1) 71 switch(ch) { 72 case '?': --- 46 unchanged lines hidden (view full) --- 119 120 if ((!start || column < start || (stop && column > stop)) && 121 putchar(ch) == EOF) 122 check(stdout); 123 } 124} 125 126void |
129check(stream) 130 FILE *stream; | 127check(FILE *stream) |
131{ 132 if (feof(stream)) 133 exit(0); 134 if (ferror(stream)) 135 err(1, "%s", stream == stdin ? "stdin" : "stdout"); 136} 137 138void | 128{ 129 if (feof(stream)) 130 exit(0); 131 if (ferror(stream)) 132 err(1, "%s", stream == stdin ? "stdin" : "stdout"); 133} 134 135void |
139usage() | 136usage(void) |
140{ 141 (void)fprintf(stderr, "usage: colrm [start [stop]]\n"); 142 exit(1); 143} 144 | 137{ 138 (void)fprintf(stderr, "usage: colrm [start [stop]]\n"); 139 exit(1); 140} 141 |