home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume22 / tpipe < prev    next >
SHell self-extracting ARchive  |  1990-06-07  |  8.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news or mail, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/rfc822 default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 53 75 62 6a 65 63 74 3a | 20 20 76 32 32 69 30 31 |Subject:| v22i01|
|00000010| 31 3a 20 20 41 20 22 74 | 65 65 22 20 74 68 61 74 |1: A "t|ee" that|
|00000020| 20 66 65 65 64 73 20 69 | 6e 74 6f 20 70 69 70 65 | feeds i|nto pipe|
|00000030| 73 2e 0a 4e 65 77 73 67 | 72 6f 75 70 73 3a 20 63 |s..Newsg|roups: c|
|00000040| 6f 6d 70 2e 73 6f 75 72 | 63 65 73 2e 75 6e 69 78 |omp.sour|ces.unix|
|00000050| 0a 41 70 70 72 6f 76 65 | 64 3a 20 72 73 61 6c 7a |.Approve|d: rsalz|
|00000060| 40 75 75 6e 65 74 2e 55 | 55 2e 4e 45 54 0a 58 2d |@uunet.U|U.NET.X-|
|00000070| 43 68 65 63 6b 73 75 6d | 2d 53 6e 65 66 72 75 3a |Checksum|-Snefru:|
|00000080| 20 65 62 36 35 37 66 35 | 30 20 38 62 33 65 39 39 | eb657f5|0 8b3e99|
|00000090| 39 33 20 35 33 37 63 31 | 65 38 37 20 32 66 35 39 |93 537c1|e87 2f59|
|000000a0| 37 39 61 30 0a 0a 53 75 | 62 6d 69 74 74 65 64 2d |79a0..Su|bmitted-|
|000000b0| 62 79 3a 20 44 61 76 69 | 64 20 42 20 52 6f 73 65 |by: Davi|d B Rose|
|000000c0| 6e 20 3c 72 6f 73 65 6e | 40 62 75 63 61 73 62 2e |n <rosen|@bucasb.|
|000000d0| 62 75 2e 65 64 75 3e 0a | 50 6f 73 74 69 6e 67 2d |bu.edu>.|Posting-|
|000000e0| 6e 75 6d 62 65 72 3a 20 | 56 6f 6c 75 6d 65 20 32 |number: |Volume 2|
|000000f0| 32 2c 20 49 73 73 75 65 | 20 31 31 0a 41 72 63 68 |2, Issue| 11.Arch|
|00000100| 69 76 65 2d 6e 61 6d 65 | 3a 20 74 70 69 70 65 0a |ive-name|: tpipe.|
|00000110| 0a 74 70 69 70 65 20 69 | 73 20 61 20 73 69 6d 70 |.tpipe i|s a simp|
|00000120| 6c 65 20 75 74 69 6c 69 | 74 79 20 70 72 6f 67 72 |le utili|ty progr|
|00000130| 61 6d 20 74 68 61 74 20 | 63 61 6e 20 62 65 20 75 |am that |can be u|
|00000140| 73 65 64 20 74 6f 20 73 | 70 6c 69 74 20 61 20 75 |sed to s|plit a u|
|00000150| 6e 69 78 0a 70 69 70 65 | 6c 69 6e 65 20 69 6e 74 |nix.pipe|line int|
|00000160| 6f 20 74 77 6f 20 70 69 | 70 65 6c 69 6e 65 73 2e |o two pi|pelines.|
|00000170| 20 54 68 61 74 20 69 73 | 2c 20 74 68 65 20 6f 75 | That is|, the ou|
|00000180| 74 70 75 74 20 6f 66 20 | 6f 6e 65 20 70 69 70 65 |tput of |one pipe|
|00000190| 6c 69 6e 65 20 63 61 6e | 0a 62 65 20 72 65 70 6c |line can|.be repl|
|000001a0| 69 63 61 74 65 64 20 61 | 6e 64 20 73 75 70 70 6c |icated a|nd suppl|
|000001b0| 69 65 64 20 61 73 20 74 | 68 65 20 69 6e 70 75 74 |ied as t|he input|
|000001c0| 20 74 6f 20 74 77 6f 20 | 6f 74 68 65 72 20 70 69 | to two |other pi|
|000001d0| 70 65 6c 69 6e 65 73 0a | 65 78 65 63 75 74 69 6e |pelines.|executin|
|000001e0| 67 20 73 69 6d 75 6c 74 | 61 6e 65 6f 75 73 6c 79 |g simult|aneously|
|000001f0| 2e 0a 0a 46 6f 72 20 65 | 78 61 6d 70 6c 65 0a 20 |...For e|xample. |
|00000200| 20 20 20 63 6d 64 31 20 | 3c 69 6e 66 69 6c 65 20 | cmd1 |<infile |
|00000210| 7c 20 74 70 69 70 65 20 | 22 63 6d 64 32 20 7c 20 || tpipe |"cmd2 | |
|00000220| 63 6d 64 33 20 3e 6f 75 | 74 66 69 6c 65 22 20 7c |cmd3 >ou|tfile" ||
|00000230| 20 63 6d 64 34 20 0a 77 | 69 6c 6c 20 6c 6f 6f 6b | cmd4 .w|ill look|
|00000240| 20 6c 69 6b 65 20 74 68 | 69 73 20 64 69 61 67 72 | like th|is diagr|
|00000250| 61 6d 61 74 69 63 61 6c | 6c 79 3a 0a 09 09 09 20 |amatical|ly:.... |
|00000260| 2d 2d 3e 20 63 6d 64 32 | 20 2d 2d 3e 20 63 6d 64 |--> cmd2| --> cmd|
|00000270| 33 20 2d 2d 3e 20 6f 75 | 74 66 69 6c 65 0a 09 09 |3 --> ou|tfile...|
|00000280| 20 20 20 20 20 20 20 2f | 0a 20 20 20 20 69 6e 66 | /|. inf|
|00000290| 69 6c 65 20 20 2d 2d 3e | 20 63 6d 64 31 20 2d 3c |ile -->| cmd1 -<|
|000002a0| 0a 09 09 20 20 20 20 20 | 20 20 5c 5c 0a 09 09 09 |... | \\....|
|000002b0| 20 2d 2d 3e 20 63 6d 64 | 34 20 2d 2d 3e 20 20 28 | --> cmd|4 --> (|
|000002c0| 73 74 61 6e 64 61 72 64 | 20 6f 75 74 70 75 74 29 |standard| output)|
|000002d0| 0a 0a 23 21 20 2f 62 69 | 6e 2f 73 68 0a 23 20 54 |..#! /bi|n/sh.# T|
|000002e0| 68 69 73 20 69 73 20 61 | 20 73 68 65 6c 6c 20 61 |his is a| shell a|
|000002f0| 72 63 68 69 76 65 2e 20 | 20 52 65 6d 6f 76 65 20 |rchive. | Remove |
|00000300| 61 6e 79 74 68 69 6e 67 | 20 62 65 66 6f 72 65 20 |anything| before |
|00000310| 74 68 69 73 20 6c 69 6e | 65 2c 20 74 68 65 6e 20 |this lin|e, then |
|00000320| 75 6e 70 61 63 6b 0a 23 | 20 69 74 20 62 79 20 73 |unpack.#| it by s|
|00000330| 61 76 69 6e 67 20 69 74 | 20 69 6e 74 6f 20 61 20 |aving it| into a |
|00000340| 66 69 6c 65 20 61 6e 64 | 20 74 79 70 69 6e 67 20 |file and| typing |
|00000350| 22 73 68 20 66 69 6c 65 | 22 2e 20 20 54 6f 20 6f |"sh file|". To o|
|00000360| 76 65 72 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |verwrite| existin|
|00000370| 67 0a 23 20 66 69 6c 65 | 73 2c 20 74 79 70 65 20 |g.# file|s, type |
|00000380| 22 73 68 20 66 69 6c 65 | 20 2d 63 22 2e 20 20 59 |"sh file| -c". Y|
|00000390| 6f 75 20 63 61 6e 20 61 | 6c 73 6f 20 66 65 65 64 |ou can a|lso feed|
|000003a0| 20 74 68 69 73 20 61 73 | 20 73 74 61 6e 64 61 72 | this as| standar|
|000003b0| 64 20 69 6e 70 75 74 20 | 76 69 61 0a 23 20 75 6e |d input |via.# un|
|000003c0| 73 68 61 72 2c 20 6f 72 | 20 62 79 20 74 79 70 69 |shar, or| by typi|
|000003d0| 6e 67 20 22 73 68 20 3c | 66 69 6c 65 22 2c 20 65 |ng "sh <|file", e|
|000003e0| 2e 67 2e 2e 20 20 49 66 | 20 74 68 69 73 20 61 72 |.g.. If| this ar|
|000003f0| 63 68 69 76 65 20 69 73 | 20 63 6f 6d 70 6c 65 74 |chive is| complet|
|00000400| 65 2c 20 79 6f 75 0a 23 | 20 77 69 6c 6c 20 73 65 |e, you.#| will se|
|00000410| 65 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |e the fo|llowing |
|00000420| 6d 65 73 73 61 67 65 20 | 61 74 20 74 68 65 20 65 |message |at the e|
|00000430| 6e 64 3a 0a 23 09 09 22 | 45 6e 64 20 6f 66 20 73 |nd:.#.."|End of s|
|00000440| 68 65 6c 6c 20 61 72 63 | 68 69 76 65 2e 22 0a 23 |hell arc|hive.".#|
|00000450| 20 43 6f 6e 74 65 6e 74 | 73 3a 20 20 4d 61 6b 65 | Content|s: Make|
|00000460| 66 69 6c 65 20 52 45 41 | 44 4d 45 20 74 70 69 70 |file REA|DME tpip|
|00000470| 65 2e 31 20 74 70 69 70 | 65 2e 63 0a 23 20 57 72 |e.1 tpip|e.c.# Wr|
|00000480| 61 70 70 65 64 20 62 79 | 20 72 73 61 6c 7a 40 70 |apped by| rsalz@p|
|00000490| 61 70 61 79 61 2e 62 62 | 6e 2e 63 6f 6d 20 6f 6e |apaya.bb|n.com on|
|000004a0| 20 54 68 75 20 4d 61 79 | 20 20 33 20 31 36 3a 34 | Thu May| 3 16:4|
|000004b0| 30 3a 31 30 20 31 39 39 | 30 0a 50 41 54 48 3d 2f |0:10 199|0.PATH=/|
|000004c0| 62 69 6e 3a 2f 75 73 72 | 2f 62 69 6e 3a 2f 75 73 |bin:/usr|/bin:/us|
|000004d0| 72 2f 75 63 62 20 3b 20 | 65 78 70 6f 72 74 20 50 |r/ucb ; |export P|
|000004e0| 41 54 48 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |ATH.if t|est -f '|
|000004f0| 4d 61 6b 65 66 69 6c 65 | 27 20 2d 61 20 22 24 7b |Makefile|' -a "${|
|00000500| 31 7d 22 20 21 3d 20 22 | 2d 63 22 20 3b 20 74 68 |1}" != "|-c" ; th|
|00000510| 65 6e 20 0a 20 20 65 63 | 68 6f 20 73 68 61 72 3a |en . ec|ho shar:|
|00000520| 20 57 69 6c 6c 20 6e 6f | 74 20 63 6c 6f 62 62 65 | Will no|t clobbe|
|00000530| 72 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |r existi|ng file |
|00000540| 5c 22 27 4d 61 6b 65 66 | 69 6c 65 27 5c 22 0a 65 |\"'Makef|ile'\".e|
|00000550| 6c 73 65 0a 65 63 68 6f | 20 73 68 61 72 3a 20 45 |lse.echo| shar: E|
|00000560| 78 74 72 61 63 74 69 6e | 67 20 5c 22 27 4d 61 6b |xtractin|g \"'Mak|
|00000570| 65 66 69 6c 65 27 5c 22 | 20 5c 28 31 30 37 20 63 |efile'\"| \(107 c|
|00000580| 68 61 72 61 63 74 65 72 | 73 5c 29 0a 73 65 64 20 |haracter|s\).sed |
|00000590| 22 73 2f 5e 58 2f 2f 22 | 20 3e 27 4d 61 6b 65 66 |"s/^X//"| >'Makef|
|000005a0| 69 6c 65 27 20 3c 3c 27 | 45 4e 44 5f 4f 46 5f 46 |ile' <<'|END_OF_F|
|000005b0| 49 4c 45 27 0a 58 43 43 | 20 3d 09 09 63 63 0a 58 |ILE'.XCC| =..cc.X|
|000005c0| 43 46 4c 41 47 53 20 3d | 09 2d 4f 0a 58 54 50 49 |CFLAGS =|.-O.XTPI|
|000005d0| 50 45 20 3d 09 09 74 70 | 69 70 65 0a 58 43 46 49 |PE =..tp|ipe.XCFI|
|000005e0| 4c 45 53 20 3d 09 74 70 | 69 70 65 2e 63 0a 58 0a |LES =.tp|ipe.c.X.|
|000005f0| 58 24 28 54 50 49 50 45 | 29 3a 20 24 28 43 46 49 |X$(TPIPE|): $(CFI|
|00000600| 4c 45 53 29 0a 58 09 24 | 28 43 43 29 20 24 28 43 |LES).X.$|(CC) $(C|
|00000610| 46 4c 41 47 53 29 20 24 | 28 43 46 49 4c 45 53 29 |FLAGS) $|(CFILES)|
|00000620| 20 2d 6f 20 24 40 0a 45 | 4e 44 5f 4f 46 5f 46 49 | -o $@.E|ND_OF_FI|
|00000630| 4c 45 0a 69 66 20 74 65 | 73 74 20 31 30 37 20 2d |LE.if te|st 107 -|
|00000640| 6e 65 20 60 77 63 20 2d | 63 20 3c 27 4d 61 6b 65 |ne `wc -|c <'Make|
|00000650| 66 69 6c 65 27 60 3b 20 | 74 68 65 6e 0a 20 20 20 |file'`; |then. |
|00000660| 20 65 63 68 6f 20 73 68 | 61 72 3a 20 5c 22 27 4d | echo sh|ar: \"'M|
|00000670| 61 6b 65 66 69 6c 65 27 | 5c 22 20 75 6e 70 61 63 |akefile'|\" unpac|
|00000680| 6b 65 64 20 77 69 74 68 | 20 77 72 6f 6e 67 20 73 |ked with| wrong s|
|00000690| 69 7a 65 21 0a 66 69 0a | 23 20 65 6e 64 20 6f 66 |ize!.fi.|# end of|
|000006a0| 20 27 4d 61 6b 65 66 69 | 6c 65 27 0a 66 69 0a 69 | 'Makefi|le'.fi.i|
|000006b0| 66 20 74 65 73 74 20 2d | 66 20 27 52 45 41 44 4d |f test -|f 'READM|
|000006c0| 45 27 20 2d 61 20 22 24 | 7b 31 7d 22 20 21 3d 20 |E' -a "$|{1}" != |
|000006d0| 22 2d 63 22 20 3b 20 74 | 68 65 6e 20 0a 20 20 65 |"-c" ; t|hen . e|
|000006e0| 63 68 6f 20 73 68 61 72 | 3a 20 57 69 6c 6c 20 6e |cho shar|: Will n|
|000006f0| 6f 74 20 63 6c 6f 62 62 | 65 72 20 65 78 69 73 74 |ot clobb|er exist|
|00000700| 69 6e 67 20 66 69 6c 65 | 20 5c 22 27 52 45 41 44 |ing file| \"'READ|
|00000710| 4d 45 27 5c 22 0a 65 6c | 73 65 0a 65 63 68 6f 20 |ME'\".el|se.echo |
|00000720| 73 68 61 72 3a 20 45 78 | 74 72 61 63 74 69 6e 67 |shar: Ex|tracting|
|00000730| 20 5c 22 27 52 45 41 44 | 4d 45 27 5c 22 20 5c 28 | \"'READ|ME'\" \(|
|00000740| 32 31 31 38 20 63 68 61 | 72 61 63 74 65 72 73 5c |2118 cha|racters\|
|00000750| 29 0a 73 65 64 20 22 73 | 2f 5e 58 2f 2f 22 20 3e |).sed "s|/^X//" >|
|00000760| 27 52 45 41 44 4d 45 27 | 20 3c 3c 27 45 4e 44 5f |'README'| <<'END_|
|00000770| 4f 46 5f 46 49 4c 45 27 | 0a 58 2d 2d 2d 2d 2d 2d |OF_FILE'|.X------|
|00000780| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000790| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007b0| 2d 2d 2d 2d 2d 2d 2d 0a | 58 74 70 69 70 65 20 2d |-------.|Xtpipe -|
|000007c0| 2d 20 20 72 65 70 6c 69 | 63 61 74 65 20 73 74 61 |- repli|cate sta|
|000007d0| 6e 64 61 72 64 20 6f 75 | 74 70 75 74 20 74 6f 20 |ndard ou|tput to |
|000007e0| 61 6e 20 61 64 64 69 74 | 69 6f 6e 61 6c 20 70 69 |an addit|ional pi|
|000007f0| 70 65 6c 69 6e 65 0a 58 | 20 20 20 20 20 20 20 20 |peline.X| |
|00000800| 20 20 20 20 20 20 76 65 | 72 73 69 6f 6e 20 31 2e | ve|rsion 1.|
|00000810| 30 32 20 20 20 20 36 20 | 4d 61 72 2e 20 31 39 39 |02 6 |Mar. 199|
|00000820| 30 0a 58 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |0.X-----|--------|
|00000830| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000840| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000850| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000860| 0a 58 0a 58 74 70 69 70 | 65 20 69 73 20 61 20 73 |.X.Xtpip|e is a s|
|00000870| 69 6d 70 6c 65 20 75 74 | 69 6c 69 74 79 20 70 72 |imple ut|ility pr|
|00000880| 6f 67 72 61 6d 20 74 68 | 61 74 20 63 61 6e 20 62 |ogram th|at can b|
|00000890| 65 20 75 73 65 64 20 74 | 6f 20 73 70 6c 69 74 20 |e used t|o split |
|000008a0| 61 20 75 6e 69 78 0a 58 | 70 69 70 65 6c 69 6e 65 |a unix.X|pipeline|
|000008b0| 20 69 6e 74 6f 20 74 77 | 6f 20 70 69 70 65 6c 69 | into tw|o pipeli|
|000008c0| 6e 65 73 2e 20 54 68 61 | 74 20 69 73 2c 20 74 68 |nes. Tha|t is, th|
|000008d0| 65 20 6f 75 74 70 75 74 | 20 6f 66 20 6f 6e 65 20 |e output| of one |
|000008e0| 70 69 70 65 6c 69 6e 65 | 20 63 61 6e 0a 58 62 65 |pipeline| can.Xbe|
|000008f0| 20 72 65 70 6c 69 63 61 | 74 65 64 20 61 6e 64 20 | replica|ted and |
|00000900| 73 75 70 70 6c 69 65 64 | 20 61 73 20 74 68 65 20 |supplied| as the |
|00000910| 69 6e 70 75 74 20 74 6f | 20 74 77 6f 20 6f 74 68 |input to| two oth|
|00000920| 65 72 20 70 69 70 65 6c | 69 6e 65 73 0a 58 65 78 |er pipel|ines.Xex|
|00000930| 65 63 75 74 69 6e 67 20 | 73 69 6d 75 6c 74 61 6e |ecuting |simultan|
|00000940| 65 6f 75 73 6c 79 2e 0a | 58 0a 58 4c 69 6b 65 20 |eously..|X.XLike |
|00000950| 74 65 65 28 31 29 2c 20 | 74 70 69 70 65 20 74 72 |tee(1), |tpipe tr|
|00000960| 61 6e 73 63 72 69 62 65 | 73 20 69 74 73 20 73 74 |anscribe|s its st|
|00000970| 61 6e 64 61 72 64 20 69 | 6e 70 75 74 20 74 6f 20 |andard i|nput to |
|00000980| 69 74 73 20 73 74 61 6e | 64 61 72 64 0a 58 6f 75 |its stan|dard.Xou|
|00000990| 74 70 75 74 2e 20 42 75 | 74 20 77 68 65 72 65 20 |tput. Bu|t where |
|000009a0| 74 65 65 28 31 29 20 77 | 72 69 74 65 73 20 61 6e |tee(1) w|rites an|
|000009b0| 20 61 64 64 69 74 69 6f | 6e 61 6c 20 63 6f 70 79 | additio|nal copy|
|000009c0| 20 6f 66 20 69 74 73 20 | 69 6e 70 75 74 20 74 6f | of its |input to|
|000009d0| 20 61 0a 58 66 69 6c 65 | 2c 20 74 70 69 70 65 20 | a.Xfile|, tpipe |
|000009e0| 77 72 69 74 65 73 20 74 | 68 65 20 61 64 64 69 74 |writes t|he addit|
|000009f0| 69 6f 6e 61 6c 20 63 6f | 70 79 20 74 6f 20 74 68 |ional co|py to th|
|00000a00| 65 20 69 6e 70 75 74 20 | 6f 66 20 61 6e 6f 74 68 |e input |of anoth|
|00000a10| 65 72 0a 58 70 69 70 65 | 6c 69 6e 65 2c 20 77 68 |er.Xpipe|line, wh|
|00000a20| 69 63 68 20 69 73 20 73 | 70 65 63 69 66 69 65 64 |ich is s|pecified|
|00000a30| 20 61 73 20 74 68 65 20 | 61 72 67 75 6d 65 6e 74 | as the |argument|
|00000a40| 20 74 6f 20 74 70 69 70 | 65 2e 20 49 6e 20 61 20 | to tpip|e. In a |
|00000a50| 74 79 70 69 63 61 6c 0a | 58 75 73 65 2c 20 74 68 |typical.|Xuse, th|
|00000a60| 69 73 20 70 69 70 65 6c | 69 6e 65 20 77 69 6c 6c |is pipel|ine will|
|00000a70| 20 65 76 65 6e 74 75 61 | 6c 6c 79 20 77 72 69 74 | eventua|lly writ|
|00000a80| 65 20 74 6f 20 61 20 66 | 69 6c 65 2e 20 54 68 65 |e to a f|ile. The|
|00000a90| 20 73 74 61 6e 64 61 72 | 64 0a 58 6f 75 74 70 75 | standar|d.Xoutpu|
|00000aa0| 74 20 6f 66 20 74 70 69 | 70 65 20 69 73 20 74 79 |t of tpi|pe is ty|
|00000ab0| 70 69 63 61 6c 6c 79 20 | 70 69 70 65 64 20 69 6e |pically |piped in|
|00000ac0| 74 6f 20 61 6e 6f 74 68 | 65 72 20 70 69 70 65 6c |to anoth|er pipel|
|00000ad0| 69 6e 65 2c 20 77 68 6f | 73 65 20 6f 75 74 70 75 |ine, who|se outpu|
|00000ae0| 74 0a 58 28 69 66 20 61 | 6e 79 29 20 6d 61 79 20 |t.X(if a|ny) may |
|00000af0| 67 6f 20 74 6f 20 74 68 | 65 20 75 73 65 72 27 73 |go to th|e user's|
|00000b00| 20 74 65 72 6d 69 6e 61 | 6c 20 6f 72 20 61 6e 79 | termina|l or any|
|00000b10| 77 68 65 72 65 20 61 74 | 20 61 6c 6c 2e 0a 58 0a |where at| all..X.|
|00000b20| 58 49 20 77 72 6f 74 65 | 20 74 70 69 70 65 20 62 |XI wrote| tpipe b|
|00000b30| 65 63 61 75 73 65 20 49 | 20 77 61 73 20 70 72 6f |ecause I| was pro|
|00000b40| 63 65 73 73 69 6e 67 20 | 69 6d 61 67 65 20 66 69 |cessing |image fi|
|00000b50| 6c 65 73 20 28 75 73 69 | 6e 67 20 70 62 6d 70 6c |les (usi|ng pbmpl|
|00000b60| 75 73 29 2c 0a 58 61 6e | 64 20 49 20 77 61 6e 74 |us),.Xan|d I want|
|00000b70| 65 64 20 74 6f 20 61 70 | 70 6c 79 20 6d 6f 72 65 |ed to ap|ply more|
|00000b80| 20 74 68 61 6e 20 6f 6e | 65 20 70 69 70 65 6c 69 | than on|e pipeli|
|00000b90| 6e 65 20 74 6f 20 74 68 | 65 20 73 61 6d 65 20 69 |ne to th|e same i|
|00000ba0| 6e 70 75 74 20 66 69 6c | 65 2c 0a 58 62 75 74 20 |nput fil|e,.Xbut |
|00000bb0| 74 68 65 20 65 61 72 6c | 79 20 70 61 72 74 73 20 |the earl|y parts |
|00000bc0| 6f 66 20 74 68 65 20 70 | 69 70 65 6c 69 6e 65 20 |of the p|ipeline |
|00000bd0| 77 65 72 65 20 74 68 65 | 20 73 61 6d 65 2e 20 49 |were the| same. I|
|00000be0| 20 64 69 64 20 6e 6f 74 | 20 77 61 6e 74 20 74 6f | did not| want to|
|00000bf0| 0a 58 68 61 76 65 20 74 | 6f 20 65 78 65 63 75 74 |.Xhave t|o execut|
|00000c00| 65 20 74 68 65 20 65 61 | 72 6c 79 20 70 61 72 74 |e the ea|rly part|
|00000c10| 73 20 6d 75 6c 74 69 70 | 6c 65 20 74 69 6d 65 73 |s multip|le times|
|00000c20| 2e 20 49 20 64 69 64 20 | 6e 6f 74 20 68 61 76 65 |. I did |not have|
|00000c30| 20 65 6e 6f 75 67 68 0a | 58 64 69 73 6b 20 73 70 | enough.|Xdisk sp|
|00000c40| 61 63 65 20 74 6f 20 77 | 72 69 74 65 20 77 68 61 |ace to w|rite wha|
|00000c50| 74 20 77 6f 75 6c 64 20 | 68 61 76 65 20 62 65 65 |t would |have bee|
|00000c60| 6e 20 61 20 68 75 67 65 | 20 69 6e 74 65 72 6d 65 |n a huge| interme|
|00000c70| 64 69 61 74 65 20 66 69 | 6c 65 2e 0a 58 46 72 61 |diate fi|le..XFra|
|00000c80| 6e 6b 6c 79 2c 20 49 20 | 64 69 64 20 6e 6f 74 20 |nkly, I |did not |
|00000c90| 6b 6e 6f 77 20 61 62 6f | 75 74 20 74 65 65 69 6e |know abo|ut teein|
|00000ca0| 67 20 74 6f 20 6e 61 6d | 65 64 20 70 69 70 65 73 |g to nam|ed pipes|
|00000cb0| 2c 20 62 75 74 20 61 6e | 79 77 61 79 20 69 74 27 |, but an|yway it'|
|00000cc0| 73 0a 58 6e 69 63 65 20 | 6e 6f 74 20 74 6f 20 68 |s.Xnice |not to h|
|00000cd0| 61 76 65 20 74 6f 20 62 | 6f 74 68 65 72 20 77 69 |ave to b|other wi|
|00000ce0| 74 68 20 74 68 65 6d 20 | 6f 72 20 77 6f 72 72 79 |th them |or worry|
|00000cf0| 20 61 62 6f 75 74 20 6e | 61 6d 65 20 63 6f 6e 66 | about n|ame conf|
|00000d00| 6c 69 63 74 73 2c 0a 58 | 65 73 70 65 63 69 61 6c |licts,.X|especial|
|00000d10| 6c 79 20 69 66 20 79 6f | 75 20 68 61 76 65 20 6d |ly if yo|u have m|
|00000d20| 6f 72 65 20 74 68 61 6e | 20 6f 6e 65 20 6a 6f 62 |ore than| one job|
|00000d30| 20 77 61 6e 74 69 6e 67 | 20 74 6f 20 64 6f 20 74 | wanting| to do t|
|00000d40| 68 69 73 20 61 74 20 74 | 68 65 0a 58 73 61 6d 65 |his at t|he.Xsame|
|00000d50| 20 74 69 6d 65 2e 2e 2e | 0a 58 0a 58 53 65 65 20 | time...|.X.XSee |
|00000d60| 74 68 65 20 6d 61 6e 75 | 61 6c 20 70 61 67 65 20 |the manu|al page |
|00000d70| 66 6f 72 20 74 70 69 70 | 65 28 31 29 20 66 6f 72 |for tpip|e(1) for|
|00000d80| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 61 62 6f | informa|tion abo|
|00000d90| 75 74 20 69 74 73 20 75 | 73 65 2c 0a 58 69 6e 63 |ut its u|se,.Xinc|
|00000da0| 6c 75 64 69 6e 67 20 61 | 6e 20 61 72 74 69 66 69 |luding a|n artifi|
|00000db0| 63 69 61 6c 20 65 78 61 | 6d 70 6c 65 2e 20 0a 58 |cial exa|mple. .X|
|00000dc0| 0a 58 54 68 69 73 20 64 | 69 73 74 72 69 62 75 74 |.XThis d|istribut|
|00000dd0| 69 6f 6e 20 63 6f 6e 74 | 61 69 6e 73 20 66 6f 75 |ion cont|ains fou|
|00000de0| 72 20 66 69 6c 65 73 3a | 0a 58 20 20 52 65 61 64 |r files:|.X Read|
|00000df0| 6d 65 20 28 74 68 69 73 | 20 69 73 20 69 74 29 0a |me (this| is it).|
|00000e00| 58 20 20 4d 61 6b 65 66 | 69 6c 65 20 28 69 74 20 |X Makef|ile (it |
|00000e10| 69 73 20 74 72 69 76 69 | 61 6c 29 0a 58 20 20 74 |is trivi|al).X t|
|00000e20| 70 69 70 65 2e 31 20 20 | 28 74 68 65 20 6d 61 6e |pipe.1 |(the man|
|00000e30| 75 61 6c 20 70 61 67 65 | 29 0a 58 20 20 74 70 69 |ual page|).X tpi|
|00000e40| 70 65 2e 63 20 20 28 74 | 68 65 20 63 6f 64 65 21 |pe.c (t|he code!|
|00000e50| 29 0a 58 0a 58 54 6f 20 | 72 65 61 64 20 74 68 65 |).X.XTo |read the|
|00000e60| 20 6d 61 6e 75 61 6c 20 | 70 61 67 65 2c 20 6a 75 | manual |page, ju|
|00000e70| 73 74 20 60 6e 72 6f 66 | 66 20 2d 6d 61 6e 20 74 |st `nrof|f -man t|
|00000e80| 70 69 70 65 2e 31 27 2e | 0a 58 0a 58 54 6f 20 63 |pipe.1'.|.X.XTo c|
|00000e90| 6f 6d 70 69 6c 65 20 74 | 70 69 70 65 2c 20 6a 75 |ompile t|pipe, ju|
|00000ea0| 73 74 20 60 6d 61 6b 65 | 27 2e 20 50 75 74 20 74 |st `make|'. Put t|
|00000eb0| 70 69 70 65 2e 31 20 69 | 6e 20 74 68 65 20 6d 61 |pipe.1 i|n the ma|
|00000ec0| 6e 31 2f 20 64 69 72 65 | 63 74 6f 72 79 20 69 6e |n1/ dire|ctory in|
|00000ed0| 0a 58 79 6f 75 72 20 4d | 41 4e 50 41 54 48 20 6f |.Xyour M|ANPATH o|
|00000ee0| 72 20 74 68 65 20 73 79 | 73 74 65 6d 20 6d 61 6e |r the sy|stem man|
|00000ef0| 20 70 61 74 68 2e 0a 58 | 0a 58 2d 2d 0a 58 44 61 | path..X|.X--.XDa|
|00000f00| 76 69 64 20 42 20 52 6f | 73 65 6e 2c 20 43 6f 67 |vid B Ro|sen, Cog|
|00000f10| 6e 69 74 69 76 65 20 26 | 20 4e 65 75 72 61 6c 20 |nitive &| Neural |
|00000f20| 53 79 73 74 65 6d 73 20 | 20 20 20 20 20 20 20 20 |Systems | |
|00000f30| 20 20 20 20 20 20 20 20 | 20 72 6f 73 65 6e 40 62 | | rosen@b|
|00000f40| 75 63 61 73 62 2e 62 75 | 2e 65 64 75 0a 58 43 65 |ucasb.bu|.edu.XCe|
|00000f50| 6e 74 65 72 20 66 6f 72 | 20 41 64 61 70 74 69 76 |nter for| Adaptiv|
|00000f60| 65 20 53 79 73 74 65 6d | 73 20 20 20 20 20 20 20 |e System|s |
|00000f70| 20 20 20 20 20 20 20 20 | 20 20 72 6f 73 65 6e 25 | | rosen%|
|00000f80| 62 75 63 61 73 62 40 7b | 62 75 61 63 63 61 2c 62 |bucasb@{|buacca,b|
|00000f90| 75 2d 69 74 7d 2e 62 75 | 2e 65 64 75 0a 58 42 6f |u-it}.bu|.edu.XBo|
|00000fa0| 73 74 6f 6e 20 55 6e 69 | 76 65 72 73 69 74 79 20 |ston Uni|versity |
|00000fb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 6d 69 | | {mi|
|00000fc0| 74 2d 65 64 64 69 65 2c | 68 61 72 76 61 72 64 2c |t-eddie,|harvard,|
|00000fd0| 75 75 6e 65 74 7d 21 62 | 75 2e 65 64 75 21 74 68 |uunet}!b|u.edu!th|
|00000fe0| 61 6c 61 6d 75 73 21 72 | 6f 73 65 6e 0a 45 4e 44 |alamus!r|osen.END|
|00000ff0| 5f 4f 46 5f 46 49 4c 45 | 0a 69 66 20 74 65 73 74 |_OF_FILE|.if test|
|00001000| 20 32 31 31 38 20 2d 6e | 65 20 60 77 63 20 2d 63 | 2118 -n|e `wc -c|
|00001010| 20 3c 27 52 45 41 44 4d | 45 27 60 3b 20 74 68 65 | <'READM|E'`; the|
|00001020| 6e 0a 20 20 20 20 65 63 | 68 6f 20 73 68 61 72 3a |n. ec|ho shar:|
|00001030| 20 5c 22 27 52 45 41 44 | 4d 45 27 5c 22 20 75 6e | \"'READ|ME'\" un|
|00001040| 70 61 63 6b 65 64 20 77 | 69 74 68 20 77 72 6f 6e |packed w|ith wron|
|00001050| 67 20 73 69 7a 65 21 0a | 66 69 0a 23 20 65 6e 64 |g size!.|fi.# end|
|00001060| 20 6f 66 20 27 52 45 41 | 44 4d 45 27 0a 66 69 0a | of 'REA|DME'.fi.|
|00001070| 69 66 20 74 65 73 74 20 | 2d 66 20 27 74 70 69 70 |if test |-f 'tpip|
|00001080| 65 2e 31 27 20 2d 61 20 | 22 24 7b 31 7d 22 20 21 |e.1' -a |"${1}" !|
|00001090| 3d 20 22 2d 63 22 20 3b | 20 74 68 65 6e 20 0a 20 |= "-c" ;| then . |
|000010a0| 20 65 63 68 6f 20 73 68 | 61 72 3a 20 57 69 6c 6c | echo sh|ar: Will|
|000010b0| 20 6e 6f 74 20 63 6c 6f | 62 62 65 72 20 65 78 69 | not clo|bber exi|
|000010c0| 73 74 69 6e 67 20 66 69 | 6c 65 20 5c 22 27 74 70 |sting fi|le \"'tp|
|000010d0| 69 70 65 2e 31 27 5c 22 | 0a 65 6c 73 65 0a 65 63 |ipe.1'\"|.else.ec|
|000010e0| 68 6f 20 73 68 61 72 3a | 20 45 78 74 72 61 63 74 |ho shar:| Extract|
|000010f0| 69 6e 67 20 5c 22 27 74 | 70 69 70 65 2e 31 27 5c |ing \"'t|pipe.1'\|
|00001100| 22 20 5c 28 32 34 36 35 | 20 63 68 61 72 61 63 74 |" \(2465| charact|
|00001110| 65 72 73 5c 29 0a 73 65 | 64 20 22 73 2f 5e 58 2f |ers\).se|d "s/^X/|
|00001120| 2f 22 20 3e 27 74 70 69 | 70 65 2e 31 27 20 3c 3c |/" >'tpi|pe.1' <<|
|00001130| 27 45 4e 44 5f 4f 46 5f | 46 49 4c 45 27 0a 58 2e |'END_OF_|FILE'.X.|
|00001140| 54 48 20 54 50 49 50 45 | 20 31 20 20 22 32 39 20 |TH TPIPE| 1 "29 |
|00001150| 4a 61 6e 75 61 72 79 20 | 31 39 39 30 22 0a 58 2e |January |1990".X.|
|00001160| 5c 22 20 40 28 23 29 74 | 70 69 70 65 2e 31 20 31 |\" @(#)t|pipe.1 1|
|00001170| 2e 30 20 39 30 2f 30 31 | 2f 32 39 3b 20 44 61 76 |.0 90/01|/29; Dav|
|00001180| 69 64 20 42 20 52 6f 73 | 65 6e 20 28 72 6f 73 65 |id B Ros|en (rose|
|00001190| 6e 40 62 75 63 61 73 62 | 2e 62 75 2e 65 64 75 29 |n@bucasb|.bu.edu)|
|000011a0| 0a 58 2e 53 48 20 4e 41 | 4d 45 0a 58 74 70 69 70 |.X.SH NA|ME.Xtpip|
|000011b0| 65 20 5c 2d 20 72 65 70 | 6c 69 63 61 74 65 20 74 |e \- rep|licate t|
|000011c0| 68 65 20 73 74 61 6e 64 | 61 72 64 20 6f 75 74 70 |he stand|ard outp|
|000011d0| 75 74 20 69 6e 74 6f 20 | 61 6e 20 61 64 64 69 74 |ut into |an addit|
|000011e0| 69 6f 6e 61 6c 20 70 69 | 70 65 6c 69 6e 65 0a 58 |ional pi|peline.X|
|000011f0| 74 68 61 74 20 69 73 20 | 72 75 6e 20 69 6e 20 61 |that is |run in a|
|00001200| 20 73 75 62 73 68 65 6c | 6c 0a 58 2e 53 48 20 53 | subshel|l.X.SH S|
|00001210| 59 4e 4f 50 53 49 53 0a | 58 2e 42 20 74 70 69 70 |YNOPSIS.|X.B tpip|
|00001220| 65 0a 58 5b 0a 58 2e 49 | 20 70 69 70 65 6c 69 6e |e.X[.X.I| pipelin|
|00001230| 65 0a 58 5d 0a 58 2e 49 | 58 20 20 22 74 70 69 70 |e.X].X.I|X "tpip|
|00001240| 65 20 63 6f 6d 6d 61 6e | 64 22 20 20 22 22 20 20 |e comman|d" "" |
|00001250| 22 5c 66 4c 74 70 69 70 | 65 5c 66 50 20 5c 28 65 |"\fLtpip|e\fP \(e|
|00001260| 6d 20 63 6f 70 79 20 73 | 74 61 6e 64 61 72 64 20 |m copy s|tandard |
|00001270| 6f 75 74 70 75 74 20 74 | 6f 20 6d 61 6e 79 20 70 |output t|o many p|
|00001280| 69 70 65 6c 69 6e 65 73 | 22 0a 58 2e 49 58 20 20 |ipelines|".X.IX |
|00001290| 22 63 6f 70 79 22 20 22 | 73 74 61 6e 64 61 72 64 |"copy" "|standard|
|000012a0| 20 6f 75 74 70 75 74 20 | 74 6f 20 6d 61 6e 79 20 | output |to many |
|000012b0| 70 69 70 65 6c 69 6e 65 | 73 20 5c 28 65 6d 20 5c |pipeline|s \(em \|
|000012c0| 66 4c 74 70 69 70 65 5c | 66 50 22 0a 58 2e 49 58 |fLtpipe\|fP".X.IX|
|000012d0| 20 20 22 73 74 61 6e 64 | 61 72 64 20 6f 75 74 70 | "stand|ard outp|
|000012e0| 75 74 22 20 20 22 63 6f | 70 79 20 74 6f 20 6d 61 |ut" "co|py to ma|
|000012f0| 6e 79 20 70 69 70 65 6c | 69 6e 65 73 22 20 20 22 |ny pipel|ines" "|
|00001300| 22 20 20 22 63 6f 70 79 | 20 74 6f 20 6d 61 6e 79 |" "copy| to many|
|00001310| 20 70 69 70 65 6c 69 6e | 65 73 20 5c 28 65 6d 20 | pipelin|es \(em |
|00001320| 5c 66 4c 74 70 69 70 65 | 5c 66 50 22 0a 58 2e 49 |\fLtpipe|\fP".X.I|
|00001330| 58 20 20 70 69 70 65 6c | 69 6e 65 73 20 20 22 63 |X pipel|ines "c|
|00001340| 6f 70 79 20 73 74 61 6e | 64 61 72 64 20 6f 75 74 |opy stan|dard out|
|00001350| 70 75 74 20 74 6f 20 6d | 61 6e 79 22 20 20 22 22 |put to m|any" ""|
|00001360| 20 20 22 63 6f 70 79 20 | 73 74 61 6e 64 61 72 64 | "copy |standard|
|00001370| 20 6f 75 74 70 75 74 20 | 74 6f 20 6d 61 6e 79 20 | output |to many |
|00001380| 5c 28 65 6d 20 5c 66 4c | 74 70 69 70 65 5c 66 50 |\(em \fL|tpipe\fP|
|00001390| 22 0a 58 2e 53 48 20 44 | 45 53 43 52 49 50 54 49 |".X.SH D|ESCRIPTI|
|000013a0| 4f 4e 0a 58 2e 42 20 74 | 70 69 70 65 0a 58 74 72 |ON.X.B t|pipe.Xtr|
|000013b0| 61 6e 73 63 72 69 62 65 | 73 20 74 68 65 20 73 74 |anscribe|s the st|
|000013c0| 61 6e 64 61 72 64 20 69 | 6e 70 75 74 20 74 6f 20 |andard i|nput to |
|000013d0| 74 68 65 0a 58 73 74 61 | 6e 64 61 72 64 20 6f 75 |the.Xsta|ndard ou|
|000013e0| 74 70 75 74 20 61 6e 64 | 20 73 69 6d 75 6c 74 61 |tput and| simulta|
|000013f0| 6e 65 6f 75 73 6c 79 20 | 77 72 69 74 65 73 20 61 |neously |writes a|
|00001400| 6e 20 61 64 64 69 74 69 | 6f 6e 61 6c 20 63 6f 70 |n additi|onal cop|
|00001410| 79 20 74 6f 0a 58 61 20 | 73 70 65 63 69 66 69 65 |y to.Xa |specifie|
|00001420| 64 0a 58 2e 49 52 20 70 | 69 70 65 6c 69 6e 65 20 |d.X.IR p|ipeline |
|00001430| 2e 0a 58 2e 50 50 0a 58 | 74 70 69 70 65 20 69 73 |..X.PP.X|tpipe is|
|00001440| 20 73 69 6d 69 6c 61 72 | 20 74 6f 20 74 65 65 28 | similar| to tee(|
|00001450| 31 29 20 65 78 63 65 70 | 74 20 74 68 61 74 20 74 |1) excep|t that t|
|00001460| 70 69 70 65 20 77 72 69 | 74 65 73 20 74 68 65 20 |pipe wri|tes the |
|00001470| 64 75 70 6c 69 63 61 74 | 65 20 63 6f 70 79 0a 58 |duplicat|e copy.X|
|00001480| 6f 66 20 69 74 73 20 73 | 74 61 6e 64 61 72 64 20 |of its s|tandard |
|00001490| 69 6e 70 75 74 20 74 6f | 20 61 20 63 6f 6d 6d 61 |input to| a comma|
|000014a0| 6e 64 20 6f 72 20 70 69 | 70 65 6c 69 6e 65 20 69 |nd or pi|peline i|
|000014b0| 6e 73 74 65 61 64 20 6f | 66 20 61 20 66 69 6c 65 |nstead o|f a file|
|000014c0| 2e 20 54 68 69 73 0a 58 | 63 61 6e 20 68 65 6c 70 |. This.X|can help|
|000014d0| 20 79 6f 75 20 61 76 6f | 69 64 20 72 65 2d 65 78 | you avo|id re-ex|
|000014e0| 65 63 75 74 69 6e 67 20 | 65 61 72 6c 69 65 72 20 |ecuting |earlier |
|000014f0| 63 6f 6d 6d 61 6e 64 73 | 20 69 6e 20 74 68 65 20 |commands| in the |
|00001500| 70 69 70 65 6c 69 6e 65 | 2c 0a 58 77 72 69 74 69 |pipeline|,.Xwriti|
|00001510| 6e 67 20 74 65 6d 70 6f | 72 61 72 79 20 66 69 6c |ng tempo|rary fil|
|00001520| 65 73 2c 20 6f 72 20 72 | 65 73 6f 72 74 69 6e 67 |es, or r|esorting|
|00001530| 20 74 6f 20 74 68 65 20 | 75 73 65 20 6f 66 20 6e | to the |use of n|
|00001540| 61 6d 65 64 20 70 69 70 | 65 73 2e 0a 58 2e 50 50 |amed pip|es..X.PP|
|00001550| 0a 58 54 68 65 20 73 70 | 65 63 69 66 69 65 64 0a |.XThe sp|ecified.|
|00001560| 58 2e 49 52 20 70 69 70 | 65 6c 69 6e 65 0a 58 69 |X.IR pip|eline.Xi|
|00001570| 73 20 61 6c 77 61 79 73 | 20 65 78 65 63 75 74 65 |s always| execute|
|00001580| 64 20 69 6e 20 61 20 73 | 75 62 73 68 65 6c 6c 20 |d in a s|ubshell |
|00001590| 62 79 20 73 68 28 31 29 | 2c 20 72 65 67 61 72 64 |by sh(1)|, regard|
|000015a0| 6c 65 73 73 20 6f 66 20 | 79 6f 75 72 20 63 75 72 |less of |your cur|
|000015b0| 72 65 6e 74 0a 58 73 68 | 65 6c 6c 2e 20 20 49 66 |rent.Xsh|ell. If|
|000015c0| 20 61 20 6e 6f 6e 2d 65 | 6d 70 74 79 20 73 74 72 | a non-e|mpty str|
|000015d0| 69 6e 67 20 69 73 20 73 | 75 70 70 6c 69 65 64 20 |ing is s|upplied |
|000015e0| 61 73 20 74 68 65 20 61 | 72 67 75 6d 65 6e 74 2c |as the a|rgument,|
|000015f0| 20 69 74 20 6d 75 73 74 | 20 62 65 20 0a 58 61 20 | it must| be .Xa |
|00001600| 76 61 6c 69 64 20 70 69 | 70 65 6c 69 6e 65 20 6f |valid pi|peline o|
|00001610| 72 20 63 6f 6d 6d 61 6e | 64 20 66 6f 72 20 73 68 |r comman|d for sh|
|00001620| 28 31 29 2e 20 4e 6f 72 | 6d 61 6c 6c 79 2c 20 79 |(1). Nor|mally, y|
|00001630| 6f 75 20 77 69 6c 6c 20 | 77 61 6e 74 20 74 6f 20 |ou will |want to |
|00001640| 65 6e 63 6c 6f 73 65 0a | 58 74 68 65 0a 58 2e 49 |enclose.|Xthe.X.I|
|00001650| 52 20 70 69 70 65 6c 69 | 6e 65 0a 58 61 72 67 75 |R pipeli|ne.Xargu|
|00001660| 6d 65 6e 74 20 69 6e 20 | 71 75 6f 74 65 73 20 28 |ment in |quotes (|
|00001670| 27 27 20 6f 72 20 22 22 | 29 2e 20 20 54 68 65 20 |'' or ""|). The |
|00001680| 74 79 70 65 20 6f 66 20 | 71 75 6f 74 65 73 20 79 |type of |quotes y|
|00001690| 6f 75 20 63 68 6f 6f 73 | 65 0a 58 77 69 6c 6c 20 |ou choos|e.Xwill |
|000016a0| 61 66 66 65 63 74 20 76 | 61 72 69 61 62 6c 65 20 |affect v|ariable |
|000016b0| 73 75 62 73 74 69 74 75 | 74 69 6f 6e 20 62 79 20 |substitu|tion by |
|000016c0| 79 6f 75 72 20 73 68 65 | 6c 6c 20 28 73 65 65 20 |your she|ll (see |
|000016d0| 74 68 65 20 6d 61 6e 20 | 70 61 67 65 20 0a 58 66 |the man |page .Xf|
|000016e0| 6f 72 20 79 6f 75 72 20 | 73 68 65 6c 6c 2c 20 73 |or your |shell, s|
|000016f0| 75 63 68 20 61 73 20 63 | 73 68 28 31 29 2c 20 66 |uch as c|sh(1), f|
|00001700| 6f 72 20 64 65 74 61 69 | 6c 73 29 2e 0a 58 2e 50 |or detai|ls)..X.P|
|00001710| 50 0a 58 49 66 20 74 68 | 65 20 73 75 62 73 68 65 |P.XIf th|e subshe|
|00001720| 6c 6c 20 70 69 70 65 6c | 69 6e 65 20 77 72 69 74 |ll pipel|ine writ|
|00001730| 65 73 20 74 6f 20 69 74 | 73 20 73 74 61 6e 64 61 |es to it|s standa|
|00001740| 72 64 20 6f 75 74 70 75 | 74 2c 20 74 68 69 73 20 |rd outpu|t, this |
|00001750| 6f 75 74 70 75 74 0a 58 | 77 69 6c 6c 20 67 6f 20 |output.X|will go |
|00001760| 74 6f 20 74 68 65 20 73 | 74 61 6e 64 61 72 64 20 |to the s|tandard |
|00001770| 6f 75 74 70 75 74 20 6f | 66 20 74 70 69 70 65 2c |output o|f tpipe,|
|00001780| 20 77 68 65 72 65 20 69 | 74 20 77 69 6c 6c 20 62 | where i|t will b|
|00001790| 65 20 69 6e 74 65 72 73 | 70 65 72 73 65 64 0a 58 |e inters|persed.X|
|000017a0| 69 6e 20 61 6e 20 75 6e | 70 72 65 64 69 63 74 61 |in an un|predicta|
|000017b0| 62 6c 65 20 77 61 79 20 | 77 69 74 68 20 74 68 65 |ble way |with the|
|000017c0| 20 6f 74 68 65 72 20 63 | 6f 70 79 20 6f 66 20 73 | other c|opy of s|
|000017d0| 74 61 6e 64 61 72 64 20 | 69 6e 70 75 74 2e 0a 58 |tandard |input..X|
|000017e0| 4e 6f 72 6d 61 6c 6c 79 | 2c 20 74 68 69 73 20 69 |Normally|, this i|
|000017f0| 73 20 6e 6f 74 20 77 68 | 61 74 20 79 6f 75 20 77 |s not wh|at you w|
|00001800| 61 6e 74 2e 20 49 6e 73 | 74 65 61 64 2c 20 79 6f |ant. Ins|tead, yo|
|00001810| 75 20 77 6f 75 6c 64 20 | 74 79 70 69 63 61 6c 6c |u would |typicall|
|00001820| 79 0a 58 73 70 65 63 69 | 66 79 20 61 20 73 75 62 |y.Xspeci|fy a sub|
|00001830| 73 68 65 6c 6c 0a 58 2e | 49 52 20 70 69 70 65 6c |shell.X.|IR pipel|
|00001840| 69 6e 65 20 0a 58 77 68 | 6f 73 65 20 6f 75 74 70 |ine .Xwh|ose outp|
|00001850| 75 74 20 69 73 20 72 65 | 64 69 72 65 63 74 65 64 |ut is re|directed|
|00001860| 20 74 6f 20 61 20 66 69 | 6c 65 20 28 61 73 20 69 | to a fi|le (as i|
|00001870| 6e 20 74 68 65 20 65 78 | 61 6d 70 6c 65 0a 58 62 |n the ex|ample.Xb|
|00001880| 65 6c 6f 77 29 20 6f 72 | 20 68 61 73 20 73 6f 6d |elow) or| has som|
|00001890| 65 20 6f 74 68 65 72 20 | 65 66 66 65 63 74 2e 0a |e other |effect..|
|000018a0| 58 2e 53 48 20 45 58 41 | 4d 50 4c 45 0a 58 2e 49 |X.SH EXA|MPLE.X.I|
|000018b0| 50 0a 58 25 20 63 6d 64 | 31 20 3c 69 6e 66 69 6c |P.X% cmd|1 <infil|
|000018c0| 65 20 7c 20 74 70 69 70 | 65 20 22 63 6d 64 32 20 |e | tpip|e "cmd2 |
|000018d0| 7c 20 63 6d 64 33 20 3e | 6f 75 74 66 69 6c 65 22 || cmd3 >|outfile"|
|000018e0| 20 7c 20 63 6d 64 34 20 | 0a 58 2e 50 50 0a 58 77 | | cmd4 |.X.PP.Xw|
|000018f0| 68 69 63 68 20 68 61 73 | 20 74 68 65 20 65 66 66 |hich has| the eff|
|00001900| 65 63 74 20 6f 66 20 72 | 75 6e 6e 69 6e 67 20 74 |ect of r|unning t|
|00001910| 68 65 20 6f 75 74 70 75 | 74 20 6f 66 20 63 6f 6d |he outpu|t of com|
|00001920| 6d 61 6e 64 20 63 6d 64 | 31 0a 58 73 69 6d 75 6c |mand cmd|1.Xsimul|
|00001930| 74 61 6e 65 6f 75 73 6c | 79 20 74 68 72 6f 75 67 |taneousl|y throug|
|00001940| 68 20 74 77 6f 20 70 69 | 70 65 6c 69 6e 65 73 2c |h two pi|pelines,|
|00001950| 20 22 63 6d 64 32 20 7c | 20 63 6d 64 33 20 3e 6f | "cmd2 || cmd3 >o|
|00001960| 75 74 66 69 6c 65 22 20 | 61 6e 64 20 63 6d 64 34 |utfile" |and cmd4|
|00001970| 2e 0a 58 44 69 61 67 72 | 61 6d 61 74 69 63 61 6c |..XDiagr|amatical|
|00001980| 6c 79 2c 20 69 6e 20 74 | 68 69 73 20 65 78 61 6d |ly, in t|his exam|
|00001990| 70 6c 65 20 28 74 68 69 | 73 20 77 69 6c 6c 20 6c |ple (thi|s will l|
|000019a0| 6f 6f 6b 20 77 72 6f 6e | 67 20 77 69 74 68 0a 58 |ook wron|g with.X|
|000019b0| 61 20 76 61 72 69 61 62 | 6c 65 2d 73 70 61 63 65 |a variab|le-space|
|000019c0| 64 20 66 6f 6e 74 29 3a | 0a 58 0a 58 2e 6e 66 0a |d font):|.X.X.nf.|
|000019d0| 58 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |X | |
|000019e0| 20 20 20 20 20 20 2d 2d | 3e 20 63 6d 64 32 20 2d | --|> cmd2 -|
|000019f0| 2d 3e 20 63 6d 64 33 20 | 2d 2d 3e 20 6f 75 74 66 |-> cmd3 |--> outf|
|00001a00| 69 6c 65 0a 58 20 20 20 | 20 20 20 20 20 20 20 20 |ile.X | |
|00001a10| 20 20 20 20 20 20 20 20 | 2f 0a 58 69 6e 66 69 6c | |/.Xinfil|
|00001a20| 65 20 20 2d 2d 3e 20 63 | 6d 64 31 20 2d 3c 0a 58 |e --> c|md1 -<.X|
|00001a30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a40| 20 20 20 5c 5c 0a 58 20 | 20 20 20 20 20 20 20 20 | \\.X | |
|00001a50| 20 20 20 20 20 20 20 20 | 20 20 20 20 2d 2d 3e 20 | | --> |
|00001a60| 63 6d 64 34 20 2d 2d 3e | 20 20 28 73 74 61 6e 64 |cmd4 -->| (stand|
|00001a70| 61 72 64 20 6f 75 74 70 | 75 74 29 0a 58 2e 66 69 |ard outp|ut).X.fi|
|00001a80| 0a 58 2e 53 48 20 53 45 | 45 20 41 4c 53 4f 0a 58 |.X.SH SE|E ALSO.X|
|00001a90| 2e 42 52 20 74 65 65 20 | 28 31 29 2c 0a 58 2e 42 |.BR tee |(1),.X.B|
|00001aa0| 52 20 73 68 20 28 31 29 | 2c 0a 58 2e 42 52 20 63 |R sh (1)|,.X.BR c|
|00001ab0| 61 74 20 28 31 29 0a 58 | 0a 58 2e 53 48 20 41 55 |at (1).X|.X.SH AU|
|00001ac0| 54 48 4f 52 0a 58 44 61 | 76 69 64 20 42 20 52 6f |THOR.XDa|vid B Ro|
|00001ad0| 73 65 6e 0a 58 2e 50 50 | 0a 58 54 48 49 53 20 53 |sen.X.PP|.XTHIS S|
|00001ae0| 4f 46 54 57 41 52 45 20 | 49 53 20 50 52 4f 56 49 |OFTWARE |IS PROVI|
|00001af0| 44 45 44 20 22 41 53 20 | 49 53 22 20 41 4e 44 20 |DED "AS |IS" AND |
|00001b00| 57 49 54 48 4f 55 54 20 | 45 58 50 52 45 53 53 20 |WITHOUT |EXPRESS |
|00001b10| 4f 52 20 49 4d 50 4c 49 | 45 44 20 57 41 52 52 41 |OR IMPLI|ED WARRA|
|00001b20| 4e 54 59 2e 0a 45 4e 44 | 5f 4f 46 5f 46 49 4c 45 |NTY..END|_OF_FILE|
|00001b30| 0a 69 66 20 74 65 73 74 | 20 32 34 36 35 20 2d 6e |.if test| 2465 -n|
|00001b40| 65 20 60 77 63 20 2d 63 | 20 3c 27 74 70 69 70 65 |e `wc -c| <'tpipe|
|00001b50| 2e 31 27 60 3b 20 74 68 | 65 6e 0a 20 20 20 20 65 |.1'`; th|en. e|
|00001b60| 63 68 6f 20 73 68 61 72 | 3a 20 5c 22 27 74 70 69 |cho shar|: \"'tpi|
|00001b70| 70 65 2e 31 27 5c 22 20 | 75 6e 70 61 63 6b 65 64 |pe.1'\" |unpacked|
|00001b80| 20 77 69 74 68 20 77 72 | 6f 6e 67 20 73 69 7a 65 | with wr|ong size|
|00001b90| 21 0a 66 69 0a 23 20 65 | 6e 64 20 6f 66 20 27 74 |!.fi.# e|nd of 't|
|00001ba0| 70 69 70 65 2e 31 27 0a | 66 69 0a 69 66 20 74 65 |pipe.1'.|fi.if te|
|00001bb0| 73 74 20 2d 66 20 27 74 | 70 69 70 65 2e 63 27 20 |st -f 't|pipe.c' |
|00001bc0| 2d 61 20 22 24 7b 31 7d | 22 20 21 3d 20 22 2d 63 |-a "${1}|" != "-c|
|00001bd0| 22 20 3b 20 74 68 65 6e | 20 0a 20 20 65 63 68 6f |" ; then| . echo|
|00001be0| 20 73 68 61 72 3a 20 57 | 69 6c 6c 20 6e 6f 74 20 | shar: W|ill not |
|00001bf0| 63 6c 6f 62 62 65 72 20 | 65 78 69 73 74 69 6e 67 |clobber |existing|
|00001c00| 20 66 69 6c 65 20 5c 22 | 27 74 70 69 70 65 2e 63 | file \"|'tpipe.c|
|00001c10| 27 5c 22 0a 65 6c 73 65 | 0a 65 63 68 6f 20 73 68 |'\".else|.echo sh|
|00001c20| 61 72 3a 20 45 78 74 72 | 61 63 74 69 6e 67 20 5c |ar: Extr|acting \|
|00001c30| 22 27 74 70 69 70 65 2e | 63 27 5c 22 20 5c 28 31 |"'tpipe.|c'\" \(1|
|00001c40| 36 30 33 20 63 68 61 72 | 61 63 74 65 72 73 5c 29 |603 char|acters\)|
|00001c50| 0a 73 65 64 20 22 73 2f | 5e 58 2f 2f 22 20 3e 27 |.sed "s/|^X//" >'|
|00001c60| 74 70 69 70 65 2e 63 27 | 20 3c 3c 27 45 4e 44 5f |tpipe.c'| <<'END_|
|00001c70| 4f 46 5f 46 49 4c 45 27 | 0a 58 2f 2a 20 74 70 69 |OF_FILE'|.X/* tpi|
|00001c80| 70 65 2e 63 20 2d 2d 20 | 74 65 65 20 61 20 70 69 |pe.c -- |tee a pi|
|00001c90| 70 65 6c 69 6e 65 20 69 | 6e 74 6f 20 74 77 6f 20 |peline i|nto two |
|00001ca0| 70 69 70 65 6c 69 6e 65 | 73 2e 20 4c 69 6b 65 20 |pipeline|s. Like |
|00001cb0| 74 65 65 28 31 29 20 62 | 75 74 20 0a 58 20 20 20 |tee(1) b|ut .X |
|00001cc0| 61 72 67 75 6d 65 6e 74 | 20 69 73 20 61 20 63 6f |argument| is a co|
|00001cd0| 6d 6d 61 6e 64 20 6f 72 | 20 70 69 70 65 6c 69 6e |mmand or| pipelin|
|00001ce0| 65 20 72 61 74 68 65 72 | 20 74 68 61 6e 20 61 20 |e rather| than a |
|00001cf0| 66 69 6c 65 2e 0a 58 0a | 58 20 20 20 53 65 65 20 |file..X.|X See |
|00001d00| 74 68 65 20 6d 61 6e 20 | 70 61 67 65 20 74 70 69 |the man |page tpi|
|00001d10| 70 65 28 31 29 20 73 75 | 70 70 6c 69 65 64 20 77 |pe(1) su|pplied w|
|00001d20| 69 74 68 20 74 68 69 73 | 20 73 6f 66 74 77 61 72 |ith this| softwar|
|00001d30| 65 2e 0a 58 0a 58 20 20 | 20 54 68 69 73 20 76 65 |e..X.X | This ve|
|00001d40| 72 73 69 6f 6e 20 75 73 | 65 73 20 74 68 65 20 75 |rsion us|es the u|
|00001d50| 6e 69 78 20 73 79 73 74 | 65 6d 20 63 61 6c 6c 73 |nix syst|em calls|
|00001d60| 20 70 6f 70 65 6e 28 33 | 29 2c 20 72 65 61 64 28 | popen(3|), read(|
|00001d70| 32 29 2c 20 61 6e 64 0a | 58 20 20 20 77 72 69 74 |2), and.|X writ|
|00001d80| 65 28 32 29 2e 20 20 49 | 74 20 75 73 65 73 20 77 |e(2). I|t uses w|
|00001d90| 72 69 74 65 28 32 29 20 | 74 6f 20 77 72 69 74 65 |rite(2) |to write|
|00001da0| 20 64 69 72 65 63 74 6c | 79 20 74 6f 20 74 68 65 | directl|y to the|
|00001db0| 20 66 69 6c 65 6e 6f 28 | 29 20 6f 66 0a 58 20 20 | fileno(|) of.X |
|00001dc0| 20 6f 66 20 74 68 65 20 | 66 69 6c 65 20 70 6f 69 | of the |file poi|
|00001dd0| 6e 74 65 72 20 73 74 72 | 65 61 6d 20 72 65 74 75 |nter str|eam retu|
|00001de0| 72 6e 65 64 20 62 79 20 | 70 6f 70 65 6e 2e 0a 58 |rned by |popen..X|
|00001df0| 0a 58 20 20 20 49 27 76 | 65 20 74 72 69 65 64 20 |.X I'v|e tried |
|00001e00| 69 74 20 6f 75 74 20 75 | 6e 64 65 72 20 42 53 44 |it out u|nder BSD|
|00001e10| 2c 20 53 79 73 74 65 6d | 20 56 2c 20 61 6e 64 20 |, System| V, and |
|00001e20| 61 6e 20 6f 6c 64 65 72 | 20 76 65 72 73 69 6f 6e |an older| version|
|00001e30| 20 6f 66 20 75 6e 69 78 | 2c 0a 58 20 20 20 62 75 | of unix|,.X bu|
|00001e40| 74 3a 0a 58 0a 58 20 20 | 20 54 48 49 53 20 53 4f |t:.X.X | THIS SO|
|00001e50| 46 54 57 41 52 45 20 49 | 53 20 50 52 4f 56 49 44 |FTWARE I|S PROVID|
|00001e60| 45 44 20 22 41 53 20 49 | 53 22 20 41 4e 44 20 57 |ED "AS I|S" AND W|
|00001e70| 49 54 48 4f 55 54 20 45 | 58 50 52 45 53 53 20 4f |ITHOUT E|XPRESS O|
|00001e80| 52 20 49 4d 50 4c 49 45 | 44 20 0a 58 20 20 20 57 |R IMPLIE|D .X W|
|00001e90| 41 52 52 41 4e 54 59 2e | 0a 58 0a 58 20 20 20 56 |ARRANTY.|.X.X V|
|00001ea0| 65 72 73 69 6f 6e 20 31 | 2e 30 32 20 28 34 20 4d |ersion 1|.02 (4 M|
|00001eb0| 61 72 20 31 39 38 39 29 | 20 28 55 73 65 20 66 69 |ar 1989)| (Use fi|
|00001ec0| 6c 65 6e 6f 28 29 29 0a | 58 0a 58 2d 2d 0a 58 44 |leno()).|X.X--.XD|
|00001ed0| 61 76 69 64 20 42 20 52 | 6f 73 65 6e 2c 20 43 6f |avid B R|osen, Co|
|00001ee0| 67 6e 69 74 69 76 65 20 | 26 20 4e 65 75 72 61 6c |gnitive |& Neural|
|00001ef0| 20 53 79 73 74 65 6d 73 | 20 20 20 20 20 20 20 20 | Systems| |
|00001f00| 20 20 20 20 20 20 20 20 | 20 20 72 6f 73 65 6e 40 | | rosen@|
|00001f10| 62 75 63 61 73 62 2e 62 | 75 2e 65 64 75 0a 58 43 |bucasb.b|u.edu.XC|
|00001f20| 65 6e 74 65 72 20 66 6f | 72 20 41 64 61 70 74 69 |enter fo|r Adapti|
|00001f30| 76 65 20 53 79 73 74 65 | 6d 73 20 20 20 20 20 20 |ve Syste|ms |
|00001f40| 20 20 20 20 20 20 20 20 | 20 20 20 72 6f 73 65 6e | | rosen|
|00001f50| 25 62 75 63 61 73 62 40 | 7b 62 75 61 63 63 61 2c |%bucasb@|{buacca,|
|00001f60| 62 75 2d 69 74 7d 2e 62 | 75 2e 65 64 75 0a 58 42 |bu-it}.b|u.edu.XB|
|00001f70| 6f 73 74 6f 6e 20 55 6e | 69 76 65 72 73 69 74 79 |oston Un|iversity|
|00001f80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 6d | | {m|
|00001f90| 69 74 2d 65 64 64 69 65 | 2c 68 61 72 76 61 72 64 |it-eddie|,harvard|
|00001fa0| 2c 75 75 6e 65 74 7d 21 | 62 75 2e 65 64 75 21 74 |,uunet}!|bu.edu!t|
|00001fb0| 68 61 6c 61 6d 75 73 21 | 72 6f 73 65 6e 0a 58 0a |halamus!|rosen.X.|
|00001fc0| 58 2a 2f 0a 58 0a 58 23 | 69 6e 63 6c 75 64 65 20 |X*/.X.X#|include |
|00001fd0| 3c 73 74 64 69 6f 2e 68 | 3e 0a 58 0a 58 2f 2a 23 |<stdio.h|>.X.X/*#|
|00001fe0| 64 65 66 69 6e 65 20 4e | 4f 48 41 43 4b 2a 2f 0a |define N|OHACK*/.|
|00001ff0| 58 0a 58 23 69 66 6e 64 | 65 66 20 42 55 46 53 49 |X.X#ifnd|ef BUFSI|
|00002000| 5a 0a 58 23 64 65 66 69 | 6e 65 20 42 55 46 53 49 |Z.X#defi|ne BUFSI|
|00002010| 5a 20 32 30 34 38 0a 58 | 23 65 6e 64 69 66 20 2f |Z 2048.X|#endif /|
|00002020| 2a 42 55 46 53 49 5a 2a | 2f 0a 58 0a 58 69 6e 74 |*BUFSIZ*|/.X.Xint|
|00002030| 20 6d 61 69 6e 28 61 72 | 67 63 2c 20 61 72 67 76 | main(ar|gc, argv|
|00002040| 29 0a 58 20 20 20 20 20 | 69 6e 74 20 61 72 67 63 |).X |int argc|
|00002050| 3b 0a 58 20 20 20 20 20 | 63 68 61 72 20 2a 61 72 |;.X |char *ar|
|00002060| 67 76 5b 5d 3b 0a 58 7b | 0a 58 20 20 63 68 61 72 |gv[];.X{|.X char|
|00002070| 20 62 75 66 5b 42 55 46 | 53 49 5a 5d 3b 0a 58 20 | buf[BUF|SIZ];.X |
|00002080| 20 72 65 67 69 73 74 65 | 72 20 46 49 4c 45 20 2a | registe|r FILE *|
|00002090| 73 75 62 70 69 70 65 6c | 69 6e 65 20 3d 20 4e 55 |subpipel|ine = NU|
|000020a0| 4c 4c 3b 0a 58 20 20 72 | 65 67 69 73 74 65 72 20 |LL;.X r|egister |
|000020b0| 75 6e 73 69 67 6e 65 64 | 20 6e 3b 0a 58 0a 58 20 |unsigned| n;.X.X |
|000020c0| 20 69 66 20 28 61 72 67 | 63 20 3d 3d 20 32 29 7b | if (arg|c == 2){|
|000020d0| 0a 58 20 20 20 20 69 66 | 20 28 2a 61 72 67 76 5b |.X if| (*argv[|
|000020e0| 31 5d 29 20 7b 0a 58 20 | 20 20 20 20 20 69 66 20 |1]) {.X | if |
|000020f0| 28 28 73 75 62 70 69 70 | 65 6c 69 6e 65 20 3d 20 |((subpip|eline = |
|00002100| 70 6f 70 65 6e 28 61 72 | 67 76 5b 31 5d 2c 22 77 |popen(ar|gv[1],"w|
|00002110| 22 29 29 20 3d 3d 20 4e | 55 4c 4c 29 20 7b 0a 58 |")) == N|ULL) {.X|
|00002120| 09 66 70 72 69 6e 74 66 | 28 73 74 64 65 72 72 2c |.fprintf|(stderr,|
|00002130| 20 22 25 73 3a 20 63 61 | 6e 27 74 20 63 72 65 61 | "%s: ca|n't crea|
|00002140| 74 65 20 73 75 62 70 69 | 70 65 6c 69 6e 65 20 25 |te subpi|peline %|
|00002150| 73 5c 6e 22 2c 20 61 72 | 67 76 5b 30 5d 2c 20 61 |s\n", ar|gv[0], a|
|00002160| 72 67 76 5b 31 5d 29 3b | 0a 58 09 65 78 69 74 28 |rgv[1]);|.X.exit(|
|00002170| 31 29 3b 0a 58 20 20 20 | 20 20 20 7d 0a 58 20 20 |1);.X | }.X |
|00002180| 20 20 7d 0a 58 20 20 7d | 20 65 6c 73 65 20 69 66 | }.X }| else if|
|00002190| 20 28 61 72 67 63 20 3e | 20 32 29 20 7b 0a 58 20 | (argc >| 2) {.X |
|000021a0| 20 20 20 66 70 72 69 6e | 74 66 28 73 74 64 65 72 | fprin|tf(stder|
|000021b0| 72 2c 20 22 75 73 61 67 | 65 3a 20 25 73 20 5b 70 |r, "usag|e: %s [p|
|000021c0| 69 70 65 6c 69 6e 65 5d | 5c 6e 22 2c 20 61 72 67 |ipeline]|\n", arg|
|000021d0| 76 5b 30 5d 29 3b 0a 58 | 20 20 20 20 65 78 69 74 |v[0]);.X| exit|
|000021e0| 28 32 29 3b 0a 58 20 20 | 7d 0a 58 0a 58 20 20 77 |(2);.X |}.X.X w|
|000021f0| 68 69 6c 65 20 28 28 6e | 20 3d 20 72 65 61 64 28 |hile ((n| = read(|
|00002200| 30 2c 20 62 75 66 2c 20 | 42 55 46 53 49 5a 29 29 |0, buf, |BUFSIZ))|
|00002210| 20 3e 20 30 29 20 7b 0a | 58 20 20 20 20 77 72 69 | > 0) {.|X wri|
|00002220| 74 65 28 31 2c 20 62 75 | 66 2c 20 6e 29 3b 20 2f |te(1, bu|f, n); /|
|00002230| 2a 20 77 72 69 74 65 20 | 74 6f 20 73 74 61 6e 64 |* write |to stand|
|00002240| 61 72 64 20 6f 75 74 70 | 75 74 20 2a 2f 0a 58 20 |ard outp|ut */.X |
|00002250| 20 20 20 69 66 20 28 73 | 75 62 70 69 70 65 6c 69 | if (s|ubpipeli|
|00002260| 6e 65 29 20 7b 20 20 2f | 2a 20 77 72 69 74 65 20 |ne) { /|* write |
|00002270| 74 6f 20 73 75 62 70 69 | 70 65 6c 69 6e 65 3a 20 |to subpi|peline: |
|00002280| 2a 2f 0a 58 20 20 20 20 | 20 20 77 72 69 74 65 28 |*/.X | write(|
|00002290| 28 69 6e 74 29 66 69 6c | 65 6e 6f 28 73 75 62 70 |(int)fil|eno(subp|
|000022a0| 69 70 65 6c 69 6e 65 29 | 2c 20 62 75 66 2c 20 6e |ipeline)|, buf, n|
|000022b0| 29 3b 0a 58 20 20 20 20 | 7d 0a 58 20 20 7d 0a 58 |);.X |}.X }.X|
|000022c0| 0a 58 20 20 69 66 20 28 | 73 75 62 70 69 70 65 6c |.X if (|subpipel|
|000022d0| 69 6e 65 29 20 70 63 6c | 6f 73 65 28 73 75 62 70 |ine) pcl|ose(subp|
|000022e0| 69 70 65 6c 69 6e 65 29 | 3b 0a 58 20 20 72 65 74 |ipeline)|;.X ret|
|000022f0| 75 72 6e 20 30 3b 0a 58 | 7d 0a 45 4e 44 5f 4f 46 |urn 0;.X|}.END_OF|
|00002300| 5f 46 49 4c 45 0a 69 66 | 20 74 65 73 74 20 31 36 |_FILE.if| test 16|
|00002310| 30 33 20 2d 6e 65 20 60 | 77 63 20 2d 63 20 3c 27 |03 -ne `|wc -c <'|
|00002320| 74 70 69 70 65 2e 63 27 | 60 3b 20 74 68 65 6e 0a |tpipe.c'|`; then.|
|00002330| 20 20 20 20 65 63 68 6f | 20 73 68 61 72 3a 20 5c | echo| shar: \|
|00002340| 22 27 74 70 69 70 65 2e | 63 27 5c 22 20 75 6e 70 |"'tpipe.|c'\" unp|
|00002350| 61 63 6b 65 64 20 77 69 | 74 68 20 77 72 6f 6e 67 |acked wi|th wrong|
|00002360| 20 73 69 7a 65 21 0a 66 | 69 0a 23 20 65 6e 64 20 | size!.f|i.# end |
|00002370| 6f 66 20 27 74 70 69 70 | 65 2e 63 27 0a 66 69 0a |of 'tpip|e.c'.fi.|
|00002380| 65 63 68 6f 20 73 68 61 | 72 3a 20 45 6e 64 20 6f |echo sha|r: End o|
|00002390| 66 20 73 68 65 6c 6c 20 | 61 72 63 68 69 76 65 2e |f shell |archive.|
|000023a0| 0a 65 78 69 74 20 30 0a | 65 78 69 74 20 30 20 23 |.exit 0.|exit 0 #|
|000023b0| 20 4a 75 73 74 20 69 6e | 20 63 61 73 65 2e 2e 2e | Just in| case...|
|000023c0| 0a | |. | |
+--------+-------------------------+-------------------------+--------+--------+