improve comments and make man page documentation correction.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25758 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-12-19 11:20:47 +00:00
parent 4279b4aa75
commit 8d3b2f926e
3 changed files with 32 additions and 29 deletions

View file

@ -1,3 +1,10 @@
2007-12-19 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/gopen.m: slight tidyup, improve comments,no functional changes.
* Documentation/gopen.1: correct the derscription of the -a option to
say that this opens the specified application when used without a
file to open.
2007-12-17 Adam Fedor <fedor@gnu.org>
* Tools/GNUmakefile, configure.ac: Don't try to run make_services if

View file

@ -37,7 +37,7 @@ specifing the
.B -a
flag on the command line you can tell
.B gopen
to open the file with anther application.
to open the file with another application.
.PP
You can also directly print a file without (
.B -p
@ -97,19 +97,14 @@ however, not work with applications employing the NSDocument architecture
as they will only receive filenames whose types the application has registered.
To circumvent this limitation, applications may advertise their ability to open
all kinds of files through the "*" filetype.
When
.B gopen
fails when only the
is used with only the
.B -a
.I application
argument but no
.I filename
is present. Thus, to simply launch an application, please use
.B openapp(1)
instead of
.B gopen
or
.B gopen -a
.IR application
present, the application is simply launched without opening a specific file.
.P
.SH SEE ALSO
GNUstep(7), openapp(1)

View file

@ -56,18 +56,16 @@ int
main(int argc, char** argv, char **env_c)
{
CREATE_AUTORELEASE_POOL(pool);
NSEnumerator *argEnumerator = nil;
NSWorkspace *workspace = nil;
NSEnumerator *argEnumerator = nil;
NSWorkspace *workspace = nil;
NSFileManager *fm = nil;
NSString *arg = nil;
NSString
*editor = nil,
*terminal = nil;
NSString
*application = nil,
*filetoopen = nil,
*filetoprint = nil,
*nxhost = nil;
NSString *arg = nil;
NSString *editor = nil;
NSString *terminal = nil;
NSString *application = nil;
NSString *filetoopen = nil;
NSString *filetoprint = nil;
NSString *nxhost = nil;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env_c];
@ -90,7 +88,9 @@ main(int argc, char** argv, char **env_c)
if (application)
{
// Don't start the application itself but use it for file opening.
/* Start the application now,
* later on we will use it for file opening.
*/
[workspace launchApplication: application];
}
@ -116,12 +116,13 @@ main(int argc, char** argv, char **env_c)
{
NSFileHandle *fh = [NSFileHandle fileHandleWithStandardInput];
NSData *data = [fh readDataToEndOfFile];
NSString *tempFile = [NSTemporaryDirectory()
stringByAppendingPathComponent: @"openfiletmp"];
NSNumber *processId = [NSNumber numberWithInt:
[[NSProcessInfo processInfo] processIdentifier]];
NSString *tempFile;
int processId;
tempFile = [tempFile stringByAppendingString: [processId stringValue]];
tempFile = NSTemporaryDirectory();
tempFile = [tempFile stringByAppendingPathComponent: @"openfiletmp"];
processId = [[NSProcessInfo processInfo] processIdentifier];
tempFile = [tempFile stringByAppendingFormat: @"%d", processId];
tempFile = [tempFile stringByAppendingString: @".txt"];
[data writeToFile: tempFile atomically: YES];
[workspace openFile: tempFile withApplication: editor];
@ -132,9 +133,9 @@ main(int argc, char** argv, char **env_c)
{
NSString *ext = [arg pathExtension];
if ([arg isEqualToString: @"-a"] ||
[arg isEqualToString: @"-o"] ||
[arg isEqualToString: @"-NXHost"])
if ([arg isEqualToString: @"-a"]
|| [arg isEqualToString: @"-o"]
|| [arg isEqualToString: @"-NXHost"])
{
// skip since this is handled above...
arg = [argEnumerator nextObject];