HaikuDepot: notify work status from main window
[haiku.git] / src / apps / terminal / HyperLink.cpp
blobe3eab2843a66dde696cbd5b9319a88fc6d650397
1 /*
2 * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
7 #include "HyperLink.h"
9 #include <errno.h>
10 #include <stdlib.h>
12 #include "TermConst.h"
15 HyperLink::HyperLink()
17 fAddress(),
18 fType(TYPE_URL)
23 HyperLink::HyperLink(const BString& address, Type type)
25 fText(address),
26 fAddress(address),
27 fType(type)
32 HyperLink::HyperLink(const BString& text, const BString& address, Type type)
34 fText(text),
35 fAddress(address),
36 fType(type)
41 status_t
42 HyperLink::Open()
44 if (!IsValid())
45 return B_BAD_VALUE;
47 // open with the "open" program
48 BString address(fAddress);
49 address.CharacterEscape(kShellEscapeCharacters, '\\');
50 BString commandLine;
51 commandLine.SetToFormat("/bin/open %s", address.String());
52 return system(commandLine) == 0 ? B_OK : errno;