Exemplo n.º 1
0
void removeUIManagerInterface(Renderer* pRenderer, UIManager* pUIManager)
{
	UNREF_PARAM(pRenderer);
	pUIManager->pUIRenderer->~UIRenderer();
	conf_free(pUIManager->pUIRenderer);

	conf_free(pUIManager);
}
Exemplo n.º 2
0
void removeGui(UIManager* pUIManager, Gui* pGui)
{
	ASSERT(pUIManager);
	ASSERT(pGui);
	pGui->pGui->unload();
	pGui->pGui->~UIAppComponentGui();
	conf_free(pGui->pGui);
	pGui->pUI->~UI();
	conf_free(pGui->pUI);
	conf_free(pGui);
}
Exemplo n.º 3
0
static void free_val(void *val) {
    conf_value_t *cv = (conf_value_t *)val;
    conf_entry_t *he, *next;
    if (cv->type == CONF_TYPE_ENTRY) {
        he = (conf_entry_t *)cv->value;
        while (he) {
            next = he->next;
            free(he->value);
            free(he);
            he = next;
        }
        free(cv);
    } else if (cv->type == CONF_TYPE_BLOCK) {
        conf_block_t *next_cb, *cb = (conf_block_t*)(cv->value);
        while (cb) {
            next_cb = cb->next;
            conf_free(&cb->block);
            free(cb);
            cb = next_cb;
        }
        free(cv);
    } else {
        /* never get here */
        exit (1);
    }
}
Exemplo n.º 4
0
bool HasGSSAPI(const UnicodeString & CustomPath)
{
  static int has = -1;
  if (has < 0)
  {
    Conf * conf = conf_new();
    ssh_gss_liblist * List = nullptr;
    {
      SCOPE_EXIT
      {
        ssh_gss_cleanup(List);
        conf_free(conf);
      };
      Filename * filename = filename_from_str(UTF8String(CustomPath).c_str());
      conf_set_filename(conf, CONF_ssh_gss_custom, filename);
      filename_free(filename);
      List = ssh_gss_setup(conf);
      for (intptr_t Index = 0; (has <= 0) && (Index < List->nlibraries); ++Index)
      {
        ssh_gss_library * library = &List->libraries[Index];
        Ssh_gss_ctx ctx;
        ::ZeroMemory(&ctx, sizeof(ctx));
        has =
          ((library->acquire_cred(library, &ctx) == SSH_GSS_OK) &&
           (library->release_cred(library, &ctx) == SSH_GSS_OK)) ? 1 : 0;
      }
    }

    if (has < 0)
    {
      has = 0;
    }
  }
Exemplo n.º 5
0
void test2() {
	struct aug_conf c;
	int argc = 1;
	char *argv[] = {g_argv[0], NULL};
	const char *path = "/tmp/augrc";
	dictionary *ini;
	FILE *f = fopen(path, "w");
	if(f == NULL)
		err(1, "file: %s", path);
	fclose(f);

	diag("blank ini file and no args");
	ini = ciniparser_load(path);
	ok1(ini != NULL);

	conf_init(&c);
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(opt_set_amt(&c) == 0);
	conf_merge_ini(&c, ini);	
	ok1( compare_conf_vals(&c, &g_default_conf) == 0);

	conf_free(&c);
#define TEST2AMT 4
	
	ciniparser_freedict(ini);
	unlink(path);
}
Exemplo n.º 6
0
//---------------------------------------------------------------------------
bool __fastcall HasGSSAPI(UnicodeString CustomPath)
{
  static int has = -1;
  if (has < 0)
  {
    Conf * conf = conf_new();
    ssh_gss_liblist * List = NULL;
    try
    {
      Filename * filename = filename_from_str(UTF8String(CustomPath).c_str());
      conf_set_filename(conf, CONF_ssh_gss_custom, filename);
      filename_free(filename);
      List = ssh_gss_setup(conf);
      for (int Index = 0; (has <= 0) && (Index < List->nlibraries); Index++)
      {
        ssh_gss_library * library = &List->libraries[Index];
        Ssh_gss_ctx ctx;
        memset(&ctx, 0, sizeof(ctx));
        has =
          ((library->acquire_cred(library, &ctx) == SSH_GSS_OK) &&
           (library->release_cred(library, &ctx) == SSH_GSS_OK)) ? 1 : 0;
      }
    }
    __finally
    {
      ssh_gss_cleanup(List);
      conf_free(conf);
    }

    if (has < 0)
    {
      has = 0;
    }
  }
Exemplo n.º 7
0
int mwConference_destroy(struct mwConference *conf,
			 guint32 reason, const char *text) {

  struct mwServiceConference *srvc;
  struct mwOpaque info = { 0, 0 };
  int ret = 0;

  g_return_val_if_fail(conf != NULL, -1);

  srvc = conf->service;
  g_return_val_if_fail(srvc != NULL, -1);

  /* remove conference from the service */
  srvc->confs = g_list_remove_all(srvc->confs, conf);

  /* close the channel if applicable */
  if(conf->channel) {
    if(text && *text) {
      info.len = strlen(text);
      info.data = (guchar *) text;
    }

    ret = mwChannel_destroy(conf->channel, reason, &info);
  }
  
  /* free the conference */
  conf_free(conf);

  return ret;
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
	plan(TESTS_COUNT + 1);

	mm_ctx_t mm;
	mm_ctx_mempool(&mm, MM_DEFAULT_BLKSIZE);

	conf_remote_t remote;
	memset(&remote, 0, sizeof(conf_remote_t));
	sockaddr_set(&remote.addr, AF_INET, "127.0.0.1", 0);
	sockaddr_set(&remote.via, AF_INET, "127.0.0.1", 0);

	/* Create fake server environment. */
	server_t server;
	int ret = create_fake_server(&server, &mm);
	ok(ret == KNOT_EOK, "requestor: initialize fake server");

	/* Initialize requestor. */
	struct knot_requestor requestor;
	knot_requestor_init(&requestor, &mm);
	knot_requestor_overlay(&requestor, &dummy_module, NULL);

	/* Test requestor in disconnected environment. */
	test_disconnected(&requestor, &remote);

	/* Bind to random port. */
	int origin_fd = net_bound_socket(SOCK_STREAM, &remote.addr, 0);
	assert(origin_fd > 0);
	socklen_t addr_len = sockaddr_len((struct sockaddr *)&remote.addr);
	getsockname(origin_fd, (struct sockaddr *)&remote.addr, &addr_len);
	ret = listen(origin_fd, 10);
	assert(ret == 0);

	/* Responder thread. */
	pthread_t thread;
	pthread_create(&thread, 0, responder_thread, &origin_fd);

	/* Test requestor in connected environment. */
	test_connected(&requestor, &remote);

	/*! \todo #243 TSIG secured requests test should be implemented. */

	/* Terminate responder. */
	int responder = net_connected_socket(SOCK_STREAM, &remote.addr, NULL, 0);
	assert(responder > 0);
	tcp_send_msg(responder, (const uint8_t *)"", 1, NULL);
	(void) pthread_join(thread, 0);
	close(responder);

	/* Close requestor. */
	knot_requestor_clear(&requestor);
	close(origin_fd);

	/* Cleanup. */
	mp_delete((struct mempool *)mm.ctx);
	server_deinit(&server);
	conf_free(conf(), false);

	return 0;
}
Exemplo n.º 9
0
static void raw_free(void *handle)
{
    Raw raw = (Raw) handle;

    if (raw->s)
	sk_close(raw->s);
    conf_free(raw->conf);
    sfree(raw);
}
Exemplo n.º 10
0
int main(int argc, char **argv)
{
	struct sigaction sig_stop;
	struct sigaction sig_time;

	_main = main_init(argc, argv);
	_log = log_init();
	_main->conf = conf_init(argc, argv);
	_main->work = work_init();

	_main->tcp = tcp_init();
	_main->node = node_init();
	_main->mime = mime_init();

	/* Check configuration */
	conf_print();

	/* Catch SIG INT */
	unix_signal(&sig_stop, &sig_time);

	/* Fork daemon */
	unix_fork(log_console(_log));

	/* Increase limits */
	unix_limits(_main->conf->cores, CONF_EPOLL_MAX_EVENTS);

	/* Load mime types */
	mime_load();
	mime_hash();

	/* Prepare TCP daemon */
	tcp_start();

	/* Drop privileges */
	unix_dropuid0();

	/* Start worker threads */
	work_start();

	/* Stop worker threads */
	work_stop();

	/* Stop TCP daemon */
	tcp_stop();

	mime_free();
	node_free();
	tcp_free();

	work_free();
	conf_free();
	log_free(_log);
	main_free();

	return 0;
}
Exemplo n.º 11
0
void log_free(void *handle)
{
    struct LogContext *ctx = (struct LogContext *)handle;

    logfclose(ctx);
    bufchain_clear(&ctx->queue);
    if (ctx->currlogfilename)
        filename_free(ctx->currlogfilename);
    conf_free(ctx->conf);
    sfree(ctx);
}
Exemplo n.º 12
0
static void clear(struct mwServiceConference *srvc) {
  struct mwConferenceHandler *h;

  while(srvc->confs)
    conf_free(srvc->confs->data);

  h = srvc->handler;
  if(h && h->clear)
    h->clear(srvc);
  srvc->handler = NULL;
}
Exemplo n.º 13
0
static void rlogin_free(void *handle)
{
    Rlogin rlogin = (Rlogin) handle;

    if (rlogin->prompt)
        free_prompts(rlogin->prompt);
    if (rlogin->s)
	sk_close(rlogin->s);
    conf_free(rlogin->conf);
    sfree(rlogin);
}
Exemplo n.º 14
0
END_TEST

START_TEST (test_conf_add_group)
{
  configuration *conf;
  int ret;

  conf = conf_create ();
  fail_unless (conf != 0);

  ret = conf_add_group (conf, NULL, head_group);
  fail_unless (ret == 0);
  conf_free (conf);

  conf = conf_create ();
  fail_unless (conf != 0);
  ret = conf_add_group (conf, "agroup", head_group);
  fail_unless (ret == 0);

  conf_free (conf);
}
Exemplo n.º 15
0
void test5() {
	struct aug_conf c;
	char *argv[] = {g_argv[0], "--no-color", NULL};
	int argc = AUG_ARRAY_SIZE(argv) - 1;

	diag("does the no color flag work?");
	conf_init(&c);
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(c.nocolor != false);
	ok1(opt_set_amt(&c) == 1);
	
#define TEST5AMT 3
	conf_free(&c);
}
Exemplo n.º 16
0
void test1() {
	struct aug_conf c;
	int argc = 1;
	char *argv[] = {g_argv[0], NULL};

	conf_init(&c);
	diag("no ini file and no args");
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(opt_set_amt(&c) == 0);
	ok1( compare_conf_vals(&c, &g_default_conf) == 0);

	conf_free(&c);
#define TEST1AMT 3
}
Exemplo n.º 17
0
static int reload_from_client_confs(struct cstat **clist, struct conf *conf)
{
	struct cstat *c;
	static struct conf *cconf=NULL;

	if(!cconf && !(cconf=conf_alloc())) goto error;

	for(c=*clist; c; c=c->next)
	{
		// Look at the client conf files to see if they have changed,
		// and reload bits and pieces if they have.
		struct stat statp;

		if(!c->conffile) continue;

		if(stat(c->conffile, &statp)
		  || !S_ISREG(statp.st_mode))
		{
			cstat_remove(clist, &c);
			continue;
		}
		if(statp.st_mtime==c->conf_mtime)
		{
			// conf file has not changed - no need to do anything.
			continue;
		}
		c->conf_mtime=statp.st_mtime;

		conf_free_content(cconf);
		if(!(cconf->cname=strdup_w(c->name, __func__)))
			goto error;
		if(conf_set_client_global(conf, cconf)
		  || conf_load(c->conffile, cconf, 0))
		{
			cstat_remove(clist, &c);
			continue;
		}

		if(set_cstat_from_conf(c, cconf))
			goto error;
	}
	return 0;
error:
	conf_free(cconf);
	cconf=NULL;
	return -1;
}
Exemplo n.º 18
0
struct conf_entry *conf_parse(FILE *f)
{
  struct conf_entry *head = NULL;
  struct conf_entry *tail = NULL;
  char buf[CONF_MAX_LINE];

  while (fgets(buf, sizeof(buf), f)) {
    struct conf_entry *e;
    char *start = buf;
    char *key;
    char *val;

    strip_newlines(start);
    start = eat_whitespace(start);
    if (is_ignored_line(start))
      continue;

    key = strtok(start, " \t");
    val = strtok(NULL, "");
    if (val)
      val = eat_whitespace(val);
    e = (struct conf_entry *) malloc(sizeof *e);
    if (!e)
      goto fail;
    e->next = NULL;
    e->key = strdup(key);
    e->value = val ? strdup(val) : NULL;
    if (!e->key || (val && !e->value)) {
      free(e->key);
      free(e->value);
      free(e);
      goto fail;
    }
    if (!head) {
      head = e;
      tail = e;
    } else {
      tail->next = e;
      tail = e;
    }
  }

  return head;
fail:
  conf_free(head);
  return NULL;
}
Exemplo n.º 19
0
void kadnode_loop(void)
{
	if (gconf && gconf->is_running == 0) {
		conf_check();

		main_setup();

		// Loop over all sockets and file descriptors
		net_loop();

		// Export peers if a file is provided
		peerfile_export();

		main_free();

		conf_free();
	}
}
Exemplo n.º 20
0
void test3() {
	struct aug_conf c;
	int argc = 1;
	char *argv[] = {g_argv[0], NULL};
	const char *path = "/tmp/augrc";
	dictionary *ini;
	const char *ncterm;
	FILE *f = fopen(path, "w");
	if(f == NULL)
		err(1, "file: %s", path);

	fprintf(f, "[" CONF_CONFIG_SECTION_CORE "]\n\n");
	fprintf(f, "ncterm = screen ;\n");
	fclose(f);
	diag("ini file overrides default");
	ini = ciniparser_load(path);
	ok1(ini != NULL);

	conf_init(&c);
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(opt_set_amt(&c) == 0);
	ok1( compare_conf_vals(&c, &g_default_conf) == 0);
	ncterm = NULL;
	ncterm = ciniparser_getstring(ini, CONF_CONFIG_SECTION_CORE ":ncterm", NULL);
	ok1( ncterm != NULL);
	if(ncterm == NULL)
		return;
	ok1( strcmp(ncterm, "screen") == 0 );

	conf_merge_ini(&c, ini);
	ok1( c.ncterm != NULL );
	if(c.ncterm == NULL)
		return;
	ok1( strcmp(c.ncterm, "screen") == 0 );
	c.ncterm = CONF_NCTERM_DEFAULT;
	ok1( compare_conf_vals(&c, &g_default_conf) == 0);
	
	conf_free(&c);
#define TEST3AMT 9

	ciniparser_freedict(ini);
	unlink(path);
}
Exemplo n.º 21
0
void
server_free(server *s) {
	int i;

	/* shutdown worker threads */
	for(i=0; i<s->cfg->workers; i++) {
		worker_free(s->w[i]);
	}

	/* free */
	event_del(s->signal);
	event_free(s->signal);
	event_base_free(s->base);
	close(s->fd);
	free(s->w);
	conf_free(s->cfg);
	log_free(s->log);
	free(s);
}
Exemplo n.º 22
0
/* gcc conf.c hash.c -DCONF_TEST_MAIN -I../inc */
int main(int argc, char *argv[]) {
    conf_t   conf = {};

    if (argc < 2) {
        fprintf(stderr, "usage: ./a.out <conf_file>\n");
        exit(1);
    }

    if (conf_init(&conf, argv[1]) != 0) {
        fprintf(stderr, "conf_init error\n");
        exit(1);
    }
    conf_dump(&conf);

    printf("PORT: %d\n", conf_get_int_value(&conf, "porta", 7777));
    printf("LOG_NAME: %s\n", conf_get_str_value(&conf, "log_name", "NULL"));

    conf_free(&conf);
    exit(0);
}
Exemplo n.º 23
0
static void
internal_cleanup(
#ifndef HAVE_GMODULE
		G_GNUC_UNUSED
#endif /* !HAVE_GMODULE */
		bool signaled)
{
#ifdef HAVE_GMODULE
	module_close(signaled ? 0 : 1);
#endif /* HAVE_GMODULE */
	conf_free();
	if (cfd != NULL) {
		g_key_file_free(cfd);
		cfd = NULL;
	}
	if (loop != NULL) {
		g_main_loop_quit(loop);
		g_main_loop_unref(loop);
		loop = NULL;
	}
}
Exemplo n.º 24
0
static void
resv_remove(struct Client *source_p, const char *name)
{
  unsigned int type_int = CONF_CRESV;
  const char *type_str = "channel";
  struct MaskItem *conf = NULL;

  if (!IsChanPrefix(*name))
  {
    type_int = CONF_NRESV;
    type_str = "nick";
  }

  if ((conf = find_exact_name_conf(type_int, NULL, name, NULL, NULL)) == NULL)
  {
    if (IsClient(source_p))
     sendto_one_notice(source_p, &me, ":A RESV does not exist for %s: %s", type_str, name);

    return;
  }

  if (!IsConfDatabase(conf))
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":The RESV for %s: %s is in ircd.conf and must be removed by hand.",
                        type_str, name);
    return;
  }

  conf_free(conf);

  if (IsClient(source_p))
    sendto_one_notice(source_p, &me, ":The RESV has been removed on %s: %s", type_str, name);

  sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
                       "%s has removed the RESV for %s: %s",
                       get_oper_name(source_p), type_str, name);
  ilog(LOG_TYPE_RESV, "%s removed RESV for [%s]",
       get_oper_name(source_p), name);
}
Exemplo n.º 25
0
int main(void) {
    int width = 0;
    int height = 0;
    int fullscreen = 0;
    int image_count = 0;
    int i = 0;
    int ret = 0;
    char expr[64] = {0};
    const char *image;

    ret = conf_init("config.lua");

    printf("ret: %d\n", ret);

    ret = conf_get_int("settings.resolution.width", &width);

    printf("ret: %d, width: %d\n", ret, width);

    ret = conf_get_int("settings.resolution.height", &height);

    printf("ret: %d, height: %d\n", ret, height);

    ret = conf_get_bool("settings.resolution.fullscreen", &fullscreen);

    printf("ret: %d, fullscreen: %d\n", ret, fullscreen);

    ret = conf_get_int("#settings.images", &image_count);

    printf("ret: %d, image_count: %d\n", ret, image_count);

    for (i = 0; i < image_count; ++i) {
        memset(expr, 0, sizeof(expr));
        snprintf(expr, sizeof(expr), "settings.images[%d]", i + 1);
        ret = conf_get_string(expr, &image);
        printf("ret: %d, settings.images[%d] = %s\n", ret, i + 1, image);
    }
    conf_free();

    return 0;
}
Exemplo n.º 26
0
static int run_status_server(int *rfd, int *cfd,
		int status_rfd, const char *conffile)
{
	int ret=-1;
	struct conf *conf=NULL;

	close_fd(rfd);

	// Reload global config, in case things have changed. This means that
	// the server does not need to be restarted for most conf changes.
	if(!(conf=conf_alloc())) goto end;
	conf_init(conf);
	if(conf_load(conffile, conf, 1)) goto end;

	ret=status_server(cfd, status_rfd, conf);

	close_fd(cfd);
end:
	logp("exit status server\n");
	conf_free(conf);
	return ret;
}
Exemplo n.º 27
0
static void
dfs_destroy(void *arg)
{
        LOG(LOG_DEBUG, "%p", arg);

        profile_fini();

        if (hash) {
                LOG(LOG_DEBUG, "removing cache files");
                g_hash_table_foreach(hash, cb_hash_unlink, NULL);
                LOG(LOG_DEBUG, "releasing hashtable memory");
                g_hash_table_remove_all(hash);
        }

        if (conf) {
                LOG(LOG_DEBUG, "releasing config memory");
                conf_free(conf);
        }

        LOG(LOG_DEBUG, "freeing libdroplet context");
	dpl_free();

}
Exemplo n.º 28
0
void log_reconfig(void *handle, Conf *conf)
{
  struct LogContext *ctx = (struct LogContext *)handle;
  int reset_logging;

  if (!filename_equal(conf_get_filename(ctx->conf, CONF_logfilename),
                      conf_get_filename(conf, CONF_logfilename)) ||
      conf_get_int(ctx->conf, CONF_logtype) != conf_get_int(conf, CONF_logtype))
    reset_logging = TRUE;
  else
    reset_logging = FALSE;

  if (reset_logging)
    logfclose(ctx);

  conf_free(ctx->conf);
  ctx->conf = conf_copy(conf);

  ctx->logtype = conf_get_int(ctx->conf, CONF_logtype);

  if (reset_logging)
    logfopen(ctx);
}
Exemplo n.º 29
0
static void
resv_remove(struct Client *source_p, const char *name)
{
  unsigned int type = CONF_CRESV;
  struct MaskItem *conf = NULL;

  if (!IsChanPrefix(*name))
    type = CONF_NRESV;

  if ((conf = find_exact_name_conf(type, NULL, name, NULL, NULL)) == NULL)
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":No RESV for %s", name);

    return;
  }

  if (!IsConfDatabase(conf))
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":The RESV for %s is in ircd.conf and must be removed by hand",
                        name);
    return;
  }

  conf_free(conf);

  if (IsClient(source_p))
    sendto_one_notice(source_p, &me, ":RESV for [%s] is removed", name);

  sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
                       "%s has removed the RESV for: [%s]",
                       get_oper_name(source_p), name);
  ilog(LOG_TYPE_RESV, "%s removed RESV for [%s]",
       get_oper_name(source_p), name);
}
Exemplo n.º 30
0
int plink_main(int argc, char **argv)
{
    int sending;
    int portnumber = -1;
    SOCKET *sklist;
    int skcount, sksize;
    int exitcode;
    int errors;
    int got_host = FALSE;
    int use_subsystem = 0;
    unsigned long now, next, then;
	
    IsPortableMode() ;
    //if( IsPortableMode() ) { printf( "Portable mode on\n" ) ; }

#else

int main(int argc, char **argv)
{
    int sending;
    int portnumber = -1;
    SOCKET *sklist;
    int skcount, sksize;
    int exitcode;
    int errors;
    int got_host = FALSE;
    int use_subsystem = 0;
    unsigned long now, next, then;
#endif

    sklist = NULL;
    skcount = sksize = 0;
    /*
     * Initialise port and protocol to sensible defaults. (These
     * will be overridden by more or less anything.)
     */
    default_protocol = PROT_SSH;
    default_port = 22;

    flags = FLAG_STDERR;
    /*
     * Process the command line.
     */
    conf = conf_new();
    do_defaults(NULL, conf);
    loaded_session = FALSE;
    default_protocol = conf_get_int(conf, CONF_protocol);
    default_port = conf_get_int(conf, CONF_port);
    errors = 0;
    {
	/*
	 * Override the default protocol if PLINK_PROTOCOL is set.
	 */
	char *p = getenv("PLINK_PROTOCOL");
	if (p) {
	    const Backend *b = backend_from_name(p);
	    if (b) {
		default_protocol = b->protocol;
		default_port = b->default_port;
		conf_set_int(conf, CONF_protocol, default_protocol);
		conf_set_int(conf, CONF_port, default_port);
	    }
	}
    }
    while (--argc) {
	char *p = *++argv;
	if (*p == '-') {
	    int ret = cmdline_process_param(p, (argc > 1 ? argv[1] : NULL),
					    1, conf);
	    if (ret == -2) {
		fprintf(stderr,
			"plink: option \"%s\" requires an argument\n", p);
		errors = 1;
	    } else if (ret == 2) {
		--argc, ++argv;
	    } else if (ret == 1) {
		continue;
	    } else if (!strcmp(p, "-batch")) {
		console_batch_mode = 1;
	    } else if (!strcmp(p, "-s")) {
		/* Save status to write to conf later. */
		use_subsystem = 1;
	    } else if (!strcmp(p, "-V") || !strcmp(p, "--version")) {
                version();
	    } else if (!strcmp(p, "--help")) {
                usage();
            } else if (!strcmp(p, "-pgpfp")) {
                pgp_fingerprints();
                exit(1);
	    } else {
		fprintf(stderr, "plink: unknown option \"%s\"\n", p);
		errors = 1;
	    }
	} else if (*p) {
	    if (!conf_launchable(conf) || !(got_host || loaded_session)) {
		char *q = p;
		/*
		 * If the hostname starts with "telnet:", set the
		 * protocol to Telnet and process the string as a
		 * Telnet URL.
		 */
		if (!strncmp(q, "telnet:", 7)) {
		    char c;

		    q += 7;
		    if (q[0] == '/' && q[1] == '/')
			q += 2;
		    conf_set_int(conf, CONF_protocol, PROT_TELNET);
		    p = q;
		    while (*p && *p != ':' && *p != '/')
			p++;
		    c = *p;
		    if (*p)
			*p++ = '\0';
		    if (c == ':')
			conf_set_int(conf, CONF_port, atoi(p));
		    else
			conf_set_int(conf, CONF_port, -1);
		    conf_set_str(conf, CONF_host, q);
		    got_host = TRUE;
		} else {
		    char *r, *user, *host;
		    /*
		     * Before we process the [user@]host string, we
		     * first check for the presence of a protocol
		     * prefix (a protocol name followed by ",").
		     */
		    r = strchr(p, ',');
		    if (r) {
			const Backend *b;
			*r = '\0';
			b = backend_from_name(p);
			if (b) {
			    default_protocol = b->protocol;
			    conf_set_int(conf, CONF_protocol,
					 default_protocol);
			    portnumber = b->default_port;
			}
			p = r + 1;
		    }

		    /*
		     * A nonzero length string followed by an @ is treated
		     * as a username. (We discount an _initial_ @.) The
		     * rest of the string (or the whole string if no @)
		     * is treated as a session name and/or hostname.
		     */
		    r = strrchr(p, '@');
		    if (r == p)
			p++, r = NULL; /* discount initial @ */
		    if (r) {
			*r++ = '\0';
			user = p, host = r;
		    } else {
			user = NULL, host = p;
		    }

		    /*
		     * Now attempt to load a saved session with the
		     * same name as the hostname.
		     */
		    {
			Conf *conf2 = conf_new();
			do_defaults(host, conf2);
			if (loaded_session || !conf_launchable(conf2)) {
			    /* No settings for this host; use defaults */
			    /* (or session was already loaded with -load) */
			    conf_set_str(conf, CONF_host, host);
			    conf_set_int(conf, CONF_port, default_port);
			    got_host = TRUE;
			} else {
			    conf_copy_into(conf, conf2);
			    loaded_session = TRUE;
			}
			conf_free(conf2);
		    }

		    if (user) {
			/* Patch in specified username. */
			conf_set_str(conf, CONF_username, user);
		    }

		}
	    } else {
		char *command;
		int cmdlen, cmdsize;
		cmdlen = cmdsize = 0;
		command = NULL;

		while (argc) {
		    while (*p) {
			if (cmdlen >= cmdsize) {
			    cmdsize = cmdlen + 512;
			    command = sresize(command, cmdsize, char);
			}
			command[cmdlen++]=*p++;
		    }
		    if (cmdlen >= cmdsize) {
			cmdsize = cmdlen + 512;
			command = sresize(command, cmdsize, char);
		    }
		    command[cmdlen++]=' '; /* always add trailing space */
		    if (--argc) p = *++argv;
		}
		if (cmdlen) command[--cmdlen]='\0';
				       /* change trailing blank to NUL */
		conf_set_str(conf, CONF_remote_cmd, command);
		conf_set_str(conf, CONF_remote_cmd2, "");
		conf_set_int(conf, CONF_nopty, TRUE);  /* command => no tty */

		break;		       /* done with cmdline */
	    }
	}