1*84d4cbe5Sbluhm /* $OpenBSD: dup2.c,v 1.1.1.1 2018/04/10 23:00:53 bluhm Exp $ */
2*84d4cbe5Sbluhm /*
3*84d4cbe5Sbluhm * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
4*84d4cbe5Sbluhm *
5*84d4cbe5Sbluhm * Permission to use, copy, modify, and distribute this software for any
6*84d4cbe5Sbluhm * purpose with or without fee is hereby granted, provided that the above
7*84d4cbe5Sbluhm * copyright notice and this permission notice appear in all copies.
8*84d4cbe5Sbluhm *
9*84d4cbe5Sbluhm * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*84d4cbe5Sbluhm * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*84d4cbe5Sbluhm * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*84d4cbe5Sbluhm * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*84d4cbe5Sbluhm * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*84d4cbe5Sbluhm * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*84d4cbe5Sbluhm * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*84d4cbe5Sbluhm */
17*84d4cbe5Sbluhm
18*84d4cbe5Sbluhm #include <err.h>
19*84d4cbe5Sbluhm #include <unistd.h>
20*84d4cbe5Sbluhm
21*84d4cbe5Sbluhm #include "header.h"
22*84d4cbe5Sbluhm
23*84d4cbe5Sbluhm void
fdops(int fdpre,int fdpost)24*84d4cbe5Sbluhm fdops(int fdpre, int fdpost)
25*84d4cbe5Sbluhm {
26*84d4cbe5Sbluhm if (dup2(fdpre, 5) == -1)
27*84d4cbe5Sbluhm err(1, "dup2 pre");
28*84d4cbe5Sbluhm if (dup2(fdpost, 6) == -1)
29*84d4cbe5Sbluhm err(1, "dup2 post");
30*84d4cbe5Sbluhm if (dup2(fdpre, 7) == -1)
31*84d4cbe5Sbluhm err(1, "dup2 pepare post overwite");
32*84d4cbe5Sbluhm if (dup2(fdpost, 7) == -1)
33*84d4cbe5Sbluhm err(1, "dup2 post overwrite");
34*84d4cbe5Sbluhm if (dup2(fdpost, 8) == -1)
35*84d4cbe5Sbluhm err(1, "dup2 pepare pre overwrite");
36*84d4cbe5Sbluhm if (dup2(fdpre, 8) == -1)
37*84d4cbe5Sbluhm err(1, "dup2 pre overwite");
38*84d4cbe5Sbluhm if (dup2(fdpre, 9) == -1)
39*84d4cbe5Sbluhm err(1, "dup2 pepare pre equal");
40*84d4cbe5Sbluhm if (dup2(9, 9) == -1)
41*84d4cbe5Sbluhm err(1, "dup2 pre equal");
42*84d4cbe5Sbluhm if (dup2(fdpost, 10) == -1)
43*84d4cbe5Sbluhm err(1, "dup2 pepare post equal");
44*84d4cbe5Sbluhm if (dup2(10, 10) == -1)
45*84d4cbe5Sbluhm err(1, "dup2 post equal");
46*84d4cbe5Sbluhm }
47