changeset 6643:0dfe02111e20

[gaim-migrate @ 7168] since it seems i cannot get Silvestrij's patch in for this release, bjoernv writes: " I found a number of bugs in src/gaim-remote.c. My patch contains: - parameter processing fix in gaim-remote (gaim-remote no longer segfaults on "gaim-remote uri") - gaim-remote now has correct error messages and return codes, if connection to gaim fails (gaim-remote is not longer silent, if gaim-remote uri 'aim:goim?screenname=Penguin&message=hello+world' failes, because gaim is not running)" committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 28 Aug 2003 14:39:27 +0000
parents 8e03e9b54440
children bfe961b7f58e
files src/gaim-remote.c
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaim-remote.c	Thu Aug 28 01:32:15 2003 +0000
+++ b/src/gaim-remote.c	Thu Aug 28 14:39:27 2003 +0000
@@ -111,20 +111,23 @@
 	else
 		return 1;
 
+	if(opts.help)
+		return 0;
+
 	/* And we can have another argument--the URI. */
-	if (optind < argc) {
-		/* but only if we're using the uri command. */
-		if (!strcmp(opts.command, "uri"))
+	/* but only if we're using the uri command. */
+	if (!strcmp(opts.command, "uri")) {
+		if(argc-optind==1)
 			opts.uri = g_strdup(argv[optind++]);
 		else
 			return 1;
-		
-		/* and we can't have any others. */
-		if (optind < argc)
-			return 1;
 	}
-	
-	return 0;
+	else if(optind==argc)
+		return 0;
+	else
+		return 1;
+
+	return 0;			
 }
 
 
@@ -132,7 +135,7 @@
 	int fd = 0;
 	GaimRemotePacket *p = NULL;
 	fd = gaim_remote_session_connect(0);
-	if (!fd) {
+	if (fd<0) {
 		fprintf(stderr, _("Gaim not running (on session 0)\n"));
 		return 1;
 	}
@@ -148,7 +151,7 @@
 	int fd = 0;
 	GaimRemotePacket *p = NULL;
 	fd = gaim_remote_session_connect(0);
-	if (!fd) {
+	if (fd<0) {
 		fprintf(stderr, _("Gaim not running (on session 0)\n"));
 		return 1;
 	}