comparison libpurple/example/nullclient.c @ 22067:3684c9d16f6f

Part of a large patch from o_sukhodolsky to fix some build warnings. Refs #1344
author Richard Laager <rlaager@wiktel.com>
date Sun, 13 Jan 2008 20:46:18 +0000
parents c38d72677c8a
children 68f8adb67470
comparison
equal deleted inserted replaced
22066:542d35f101ff 22067:3684c9d16f6f
266 char name[128]; 266 char name[128];
267 char *password; 267 char *password;
268 GMainLoop *loop = g_main_loop_new(NULL, FALSE); 268 GMainLoop *loop = g_main_loop_new(NULL, FALSE);
269 PurpleAccount *account; 269 PurpleAccount *account;
270 PurpleSavedStatus *status; 270 PurpleSavedStatus *status;
271 char *res;
271 272
272 /* libpurple's built-in DNS resolution forks processes to perform 273 /* libpurple's built-in DNS resolution forks processes to perform
273 * blocking lookups without blocking the main process. It does not 274 * blocking lookups without blocking the main process. It does not
274 * handle SIGCHLD itself, so if the UI does not you quickly get an army 275 * handle SIGCHLD itself, so if the UI does not you quickly get an army
275 * of zombie subprocesses marching around. 276 * of zombie subprocesses marching around.
288 printf("\t%d: %s\n", i++, info->name); 289 printf("\t%d: %s\n", i++, info->name);
289 names = g_list_append(names, info->id); 290 names = g_list_append(names, info->id);
290 } 291 }
291 } 292 }
292 printf("Select the protocol [0-%d]: ", i-1); 293 printf("Select the protocol [0-%d]: ", i-1);
293 fgets(name, sizeof(name), stdin); 294 res = fgets(name, sizeof(name), stdin);
295 if (!res) {
296 fprintf(stderr, "Failed to gets protocol selection.");
297 abort();
298 }
294 sscanf(name, "%d", &num); 299 sscanf(name, "%d", &num);
295 prpl = g_list_nth_data(names, num); 300 prpl = g_list_nth_data(names, num);
296 301
297 printf("Username: "); 302 printf("Username: ");
298 fgets(name, sizeof(name), stdin); 303 res = fgets(name, sizeof(name), stdin);
304 if (!res) {
305 fprintf(stderr, "Failed to read user name.");
306 abort();
307 }
299 name[strlen(name) - 1] = 0; /* strip the \n at the end */ 308 name[strlen(name) - 1] = 0; /* strip the \n at the end */
300 309
301 /* Create the account */ 310 /* Create the account */
302 account = purple_account_new(name, prpl); 311 account = purple_account_new(name, prpl);
303 312