tr.c (af647767ed8f2ec38251e8185ef0b6adb35529e6) tr.c (69bd8767a990a230c6f8fc6758a07dfb61ca6b66)
1/*
2 * Copyright (c) 1988, 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

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
43#endif
44static const char rcsid[] =
1/*
2 * Copyright (c) 1988, 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

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
43#endif
44static const char rcsid[] =
45 "$Id$";
45 "$Id: tr.c,v 1.6 1997/08/18 07:24:58 charnier Exp $";
46#endif /* not lint */
47
48#include <locale.h>
49#include <sys/types.h>
50
51#include <err.h>
52#include <stdio.h>
53#include <stdlib.h>

--- 49 unchanged lines hidden (view full) ---

103 char **argv;
104{
105 register int ch, cnt, lastch, *p;
106 int cflag, dflag, sflag, isstring2;
107
108 (void) setlocale(LC_CTYPE, "");
109
110 cflag = dflag = sflag = 0;
46#endif /* not lint */
47
48#include <locale.h>
49#include <sys/types.h>
50
51#include <err.h>
52#include <stdio.h>
53#include <stdlib.h>

--- 49 unchanged lines hidden (view full) ---

103 char **argv;
104{
105 register int ch, cnt, lastch, *p;
106 int cflag, dflag, sflag, isstring2;
107
108 (void) setlocale(LC_CTYPE, "");
109
110 cflag = dflag = sflag = 0;
111 while ((ch = getopt(argc, argv, "cds")) != -1)
111 while ((ch = getopt(argc, argv, "cdsu")) != -1)
112 switch((char)ch) {
113 case 'c':
114 cflag = 1;
115 break;
116 case 'd':
117 dflag = 1;
118 break;
119 case 's':
120 sflag = 1;
121 break;
112 switch((char)ch) {
113 case 'c':
114 cflag = 1;
115 break;
116 case 'd':
117 dflag = 1;
118 break;
119 case 's':
120 sflag = 1;
121 break;
122 case 'u':
123 setbuf(stdout, (char *)NULL);
124 break;
122 case '?':
123 default:
124 usage();
125 }
126 argc -= optind;
127 argv += optind;
128
129 switch(argc) {

--- 127 unchanged lines hidden (view full) ---

257 for (p = string, cnt = NCHARS; cnt--; ++p)
258 *p = !*p;
259}
260
261static void
262usage()
263{
264 (void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
125 case '?':
126 default:
127 usage();
128 }
129 argc -= optind;
130 argv += optind;
131
132 switch(argc) {

--- 127 unchanged lines hidden (view full) ---

260 for (p = string, cnt = NCHARS; cnt--; ++p)
261 *p = !*p;
262}
263
264static void
265usage()
266{
267 (void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
265 "usage: tr [-cs] string1 string2",
266 " tr [-c] -d string1",
267 " tr [-c] -s string1",
268 " tr [-c] -ds string1 string2");
268 "usage: tr [-csu] string1 string2",
269 " tr [-cu] -d string1",
270 " tr [-cu] -s string1",
271 " tr [-cu] -ds string1 string2");
269 exit(1);
270}
272 exit(1);
273}