uniq.c (1590) | uniq.c (23690) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Case Larsen. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 27 unchanged lines hidden (view full) --- 36 37#ifndef lint 38static char copyright[] = 39"@(#) Copyright (c) 1989, 1993\n\ 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Case Larsen. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 27 unchanged lines hidden (view full) --- 36 37#ifndef lint 38static char copyright[] = 39"@(#) Copyright (c) 1989, 1993\n\ 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint |
44static char sccsid[] = "@(#)uniq.c 8.1 (Berkeley) 6/6/93"; | 44static char sccsid[] = "@(#)uniq.c 8.3 (Berkeley) 5/4/95"; |
45#endif /* not lint */ 46 47#include <errno.h> 48#include <stdio.h> 49#include <ctype.h> 50#include <stdlib.h> 51#include <string.h> | 45#endif /* not lint */ 46 47#include <errno.h> 48#include <stdio.h> 49#include <ctype.h> 50#include <stdlib.h> 51#include <string.h> |
52#include <unistd.h> |
|
52 53#define MAXLINELEN (8 * 1024) 54 55int cflag, dflag, uflag; 56int numchars, numfields, repeats; 57 58void err __P((const char *, ...)); 59FILE *file __P((char *, char *)); --- 106 unchanged lines hidden (view full) --- 166 * Output a line depending on the flags and number of repetitions 167 * of the line. 168 */ 169void 170show(ofp, str) 171 FILE *ofp; 172 char *str; 173{ | 53 54#define MAXLINELEN (8 * 1024) 55 56int cflag, dflag, uflag; 57int numchars, numfields, repeats; 58 59void err __P((const char *, ...)); 60FILE *file __P((char *, char *)); --- 106 unchanged lines hidden (view full) --- 167 * Output a line depending on the flags and number of repetitions 168 * of the line. 169 */ 170void 171show(ofp, str) 172 FILE *ofp; 173 char *str; 174{ |
174 if (cflag) | 175 176 if (cflag && *str) |
175 (void)fprintf(ofp, "%4d %s", repeats + 1, str); 176 if (dflag && repeats || uflag && !repeats) 177 (void)fprintf(ofp, "%s", str); 178} 179 180char * 181skip(str) 182 register char *str; --- 92 unchanged lines hidden --- | 177 (void)fprintf(ofp, "%4d %s", repeats + 1, str); 178 if (dflag && repeats || uflag && !repeats) 179 (void)fprintf(ofp, "%s", str); 180} 181 182char * 183skip(str) 184 register char *str; --- 92 unchanged lines hidden --- |