Restart DHCP client when a wireles driver connects to a new network.
[AROS.git] / test / pipe / autopipe.c
blobcdf062d824a7c805b20f801f022a9803adbf8cb5
1 /*
2 * Copyright (C) 2012, The AROS Development Team. All rights reserved.
3 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
5 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
6 */
8 #include <proto/alib.h>
9 #include <proto/exec.h>
10 #include <proto/dos.h>
12 __startup int _main(void)
14 struct Library *DOSBase;
15 int err = RETURN_FAIL;
17 if ((DOSBase = OpenLibrary("dos.library", 0))) {
18 BPTR fhw;
19 if ((fhw = Open("PIPE:*", MODE_NEWFILE))) {
20 TEXT name[64];
22 if (NameFromFH(fhw, name, sizeof(name)) != 0) {
23 BPTR fhr;
25 Printf("PIPE:* => %s\n", name);
26 if ((fhr = Open(name, MODE_OLDFILE))) {
27 Write(fhw, "Hello", 5);
28 Read(fhr, name, 5);
29 name[5] = 0;
30 Close(fhr);
31 Printf("Hello => %s\n", name);
32 err = 0;
34 } else {
35 Printf("Can't get name, Error %d\n", IoErr());
37 Close(fhw);
38 } else {
39 Printf("Can't open PIPE:*\n");
41 CloseLibrary(DOSBase);
44 return err;