* MimeType.h is not a BeOS header.

* Honor 80 char/line limit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27822 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-10-01 14:00:07 +00:00
parent 0fecbff55f
commit 78068f1f76
+15 -7
View File
@@ -1,7 +1,7 @@
/* /*
* Copyright 2003-2007, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2007, Axel Dörfler, [email protected].
* Copyright 2005-2007, François Revol, [email protected]. * Copyright 2005-2007, François Revol, [email protected].
* Distributed under the terms of the MIT License. * All rights reserved. Distributed under the terms of the MIT License.
*/ */
/*! Launches an application/document from the shell */ /*! Launches an application/document from the shell */
@@ -9,7 +9,11 @@
#include <Entry.h> #include <Entry.h>
#include <List.h> #include <List.h>
#include <MimeType.h> #ifdef __HAIKU__
# include <MimeType.h>
#else
# include <Mime.h>
#endif
#include <Roster.h> #include <Roster.h>
#include <String.h> #include <String.h>
@@ -56,8 +60,10 @@ main(int argc, char **argv)
if (strrchr(progName, '/')) if (strrchr(progName, '/'))
progName = strrchr(progName, '/') + 1; progName = strrchr(progName, '/') + 1;
if (argc < 2) if (argc < 2) {
fprintf(stderr,"usage: %s <file[:line[:column]] or url or application signature> ...\n", progName); fprintf(stderr,"usage: %s <file[:line[:column]] or url or application "
"signature> ...\n", progName);
}
while (*++argv) { while (*++argv) {
status_t status = B_OK; status_t status = B_OK;
@@ -93,7 +99,8 @@ main(int argc, char **argv)
// if not there is likely no supporting app anyway // if not there is likely no supporting app anyway
if (BMimeType::IsValid(mimeType.String())) { if (BMimeType::IsValid(mimeType.String())) {
char *args[2] = { *argv, NULL }; char *args[2] = { *argv, NULL };
status = be_roster->Launch(openWith ? openWith : mimeType.String(), 1, args); status = be_roster->Launch(openWith ? openWith
: mimeType.String(), 1, args);
if (status == B_OK) if (status == B_OK)
continue; continue;
} }
@@ -130,7 +137,8 @@ main(int argc, char **argv)
status = B_ENTRY_NOT_FOUND; status = B_ENTRY_NOT_FOUND;
if (status != B_OK && status != B_ALREADY_RUNNING) { if (status != B_OK && status != B_ALREADY_RUNNING) {
fprintf(stderr, "%s: \"%s\": %s\n", progName, *argv, strerror(status)); fprintf(stderr, "%s: \"%s\": %s\n", progName, *argv,
strerror(status));
// make sure the shell knows this // make sure the shell knows this
exitcode = EXIT_FAILURE; exitcode = EXIT_FAILURE;
} }