コード例 #1
0
ファイル: setup.c プロジェクト: Cloudxtreme/ircd-3
int adns_init(adns_state *ads_r, adns_initflags flags, FBFILE *diagfile) {
  adns_state ads;
  const char *res_options, *adns_res_options;
  int r;
  
  r= init_begin(&ads, flags, diagfile);
  if (r) return r;
  
  res_options= instrum_getenv(ads,"RES_OPTIONS");
  adns_res_options= instrum_getenv(ads,"ADNS_RES_OPTIONS");
  ccf_options(ads,"RES_OPTIONS",-1,res_options);
  ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);

#ifndef VMS
  readconfig(ads,"/etc/resolv.conf",0);
  readconfig(ads,"/etc/resolv-adns.conf",0);
#else
  ilog(L_CRIT, "Opening IRCD$CONFDIR:RESOLV.CONF (VMS)");
  readconfig(ads,"IRCD$CONFDIR:RESOLV.CONF",0);
#endif
  readconfigenv(ads,"RES_CONF");
  readconfigenv(ads,"ADNS_RES_CONF");

  readconfigenvtext(ads,"RES_CONF_TEXT");
  readconfigenvtext(ads,"ADNS_RES_CONF_TEXT");

  ccf_options(ads,"RES_OPTIONS",-1,res_options);
  ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);

  ccf_search(ads,"LOCALDOMAIN",-1,instrum_getenv(ads,"LOCALDOMAIN"));
  ccf_search(ads,"ADNS_LOCALDOMAIN",-1,instrum_getenv(ads,"ADNS_LOCALDOMAIN"));

  if (ads->configerrno && ads->configerrno != EINVAL) {
    ilog(L_CRIT, "Failed at 1");
    r= ads->configerrno;
    init_abort(ads);
    return r;
  }

  r= init_finish(ads);
  if (r) return r;

  adns__consistency(ads,0,cc_entex);
  *ads_r= ads;
  return 0;
}
コード例 #2
0
ファイル: setup.c プロジェクト: AllanXiang/Source
int adns_init_strcfg(adns_state *ads_r, adns_initflags flags,
		     FILE *diagfile, const char *configtext) {
  adns_state ads;
  int r;

  r= init_begin(&ads, flags, diagfile);  if (r) return r;

  readconfigtext(ads,configtext,"<supplied configuration text>");
  if (ads->configerrno) {
    r= ads->configerrno;
    init_abort(ads);
    return r;
  }

  r= init_finish(ads);  if (r) return r;
  adns__consistency(ads,0,cc_entex);
  *ads_r= ads;
  return 0;
}
コード例 #3
0
int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile) {
  adns_state ads;
  const char *res_options, *adns_res_options;
  int r;
  
  r= init_begin(&ads, flags, diagfile ? diagfile : stderr);
  if (r) return r;
  
  res_options= instrum_getenv(ads,"RES_OPTIONS");
  adns_res_options= instrum_getenv(ads,"ADNS_RES_OPTIONS");
  ccf_options(ads,"RES_OPTIONS",-1,res_options);
  ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);

  readconfig(ads,"/etc/resolv.conf",1);
  readconfig(ads,"/etc/resolv-adns.conf",0);
  /* checking in the current dir for cygwin */
  readconfig(ads,"resolv.conf",0);
  readconfigenv(ads,"RES_CONF");
  readconfigenv(ads,"ADNS_RES_CONF");

  readconfigenvtext(ads,"RES_CONF_TEXT");
  readconfigenvtext(ads,"ADNS_RES_CONF_TEXT");

  ccf_options(ads,"RES_OPTIONS",-1,res_options);
  ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);

  ccf_search(ads,"LOCALDOMAIN",-1,instrum_getenv(ads,"LOCALDOMAIN"));
  ccf_search(ads,"ADNS_LOCALDOMAIN",-1,instrum_getenv(ads,"ADNS_LOCALDOMAIN"));

  if (ads->configerrno && ads->configerrno != EINVAL) {
    r= ads->configerrno;
    init_abort(ads);
    return r;
  }

  r= init_finish(ads);
  if (r) return r;

  adns__consistency(ads,0,cc_entex);
  *ads_r= ads;
  return 0;
}
コード例 #4
0
ファイル: SAM.cpp プロジェクト: SimonKagstrom/frodo
void SAM(C64 *the_c64)
{
	bool done = false;
	char c;

	TheCPU = the_c64->TheCPU;
	TheCPU1541 = the_c64->TheCPU1541;
	TheVIC = the_c64->TheVIC;
	TheSID = the_c64->TheSID;
	TheCIA1 = the_c64->TheCIA1;
	TheCIA2 = the_c64->TheCIA2;

	// Get CPU registers and current memory configuration
	TheCPU->GetState(&R64);
	TheCPU->ExtConfig = (~R64.ddr | R64.pr) & 7;
	TheCPU1541->GetState(&R1541);

#ifdef __riscos__
	Wimp_CommandWindow((int)"SAM");
#endif

#ifdef AMIGA
	if (!(fin = fout = ferr = fopen("CON:0/0/640/480/SAM", "w+")))
		return;
#else
	fin = stdin;
	fout = stdout;
	ferr = stdout;
#endif

	access_1541 = false;
	address = R64.pc;

	fprintf(ferr, "\n *** SAM - Simple Assembler and Monitor ***\n ***         Press 'h' for help         ***\n\n");
	init_abort();
	display_registers();

	while (!done) {
		if (access_1541)
			fprintf(ferr, "1541> ");
		else
			fprintf(ferr, "C64> ");
		fflush(ferr);
		read_line();
		while ((c = get_char()) == ' ') ;

		switch (c) {
			case 'a':		// Assemble
				get_token();
				assemble();
				break;

			case 'b':		// Binary dump
				get_token();
				binary_dump();
				break;

			case 'c':		// Compare
				get_token();
				compare();
				break;

			case 'd':		// Disassemble
				get_token();
				disassemble();
				break;

			case 'e':       // Interrupt vectors
				int_vectors();
				break;

			case 'f':		// Fill
				get_token();
				fill();
				break;

			case 'h':		// Help
				help();
				break;

			case 'i':		// ASCII dump
				get_token();
				ascii_dump();
				break;

			case 'k':		// Memory configuration
				get_token();
				mem_config();
				break;

			case 'l':		// Load data
				get_token();
				load_data();
				break;

			case 'm':		// Memory dump
				get_token();
				memory_dump();
				break;

			case 'n':		// Screen code dump
				get_token();
				screen_dump();
				break;

			case 'o':		// Redirect output
				get_token();
				redir_output();
				break;

			case 'p':		// Sprite dump
				get_token();
				sprite_dump();
				break;

			case 'r':		// Registers
				get_reg_token();
				registers();
				break;

			case 's':		// Save data
				get_token();
				save_data();
				break;

			case 't':		// Transfer
				get_token();
				transfer();
				break;

			case 'v':		// View machine state
				view_state();
				break;

			case 'x':		// Exit
				done = true;
				break;

			case ':':		// Change memory
				get_token();
				modify();
				break;

			case '1':		// Switch to 1541 mode
				access_1541 = true;
				break;

			case '6':		// Switch to C64 mode
				access_1541 = false;
				break;

			case '?':		// Compute expression
				get_token();
				print_expr();
				break;

			case '\n':		// Blank line
				break;

			default:		// Unknown command
				error("Unknown command");
				break;
		}
	}

	exit_abort();

#ifdef AMIGA
	fclose(fin);
#endif
	if (fout != ferr)
		fclose(fout);

#ifdef __riscos__
	Wimp_CommandWindow(-1);
#endif

	// Set CPU registers
	TheCPU->SetState(&R64);
	TheCPU1541->SetState(&R1541);
}
コード例 #5
0
ファイル: setup.c プロジェクト: anticlimactech/botnets
int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile) {
  adns_state ads;
  const char *res_options, *adns_res_options;
  int r;
#ifdef ADNS_JGAA_WIN32
  #define SECURE_PATH_LEN (MAX_PATH - 64)
  char PathBuf[MAX_PATH];
  struct in_addr addr;
  #define ADNS_PFIXED_INFO_BLEN (2048)
  PFIXED_INFO network_info = (PFIXED_INFO)alloca(ADNS_PFIXED_INFO_BLEN);
  ULONG network_info_blen = ADNS_PFIXED_INFO_BLEN;
  DWORD network_info_result;
  PIP_ADDR_STRING pip;
  const char *network_err_str = "";
#endif
  
  r= init_begin(&ads, flags, diagfile ? diagfile : stderr);
  if (r) return r;
  
  res_options= instrum_getenv(ads,"RES_OPTIONS");
  adns_res_options= instrum_getenv(ads,"ADNS_RES_OPTIONS");
  ccf_options(ads,"RES_OPTIONS",-1,res_options);
  ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);

#ifdef ADNS_JGAA_WIN32
  GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
  strcat(PathBuf,"\\resolv.conf");
  readconfig(ads,PathBuf,1);
  GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
  strcat(PathBuf,"\\resolv-adns.conf");
  readconfig(ads,PathBuf,0);
  GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
  strcat(PathBuf,"\\System32\\Drivers\\etc\\resolv.conf");
  readconfig(ads,PathBuf,1);
  GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
  strcat(PathBuf,"\\System32\\Drivers\\etc\\resolv-adns.conf");
  readconfig(ads,PathBuf,0);
  network_info_result = GetNetworkParams(network_info, &network_info_blen);
  if (network_info_result != ERROR_SUCCESS){
    switch(network_info_result) {
    case ERROR_BUFFER_OVERFLOW: network_err_str = "ERROR_BUFFER_OVERFLOW"; break;
    case ERROR_INVALID_PARAMETER: network_err_str = "ERROR_INVALID_PARAMETER"; break;
    case ERROR_NO_DATA: network_err_str = "ERROR_NO_DATA"; break;
    case ERROR_NOT_SUPPORTED: network_err_str = "ERROR_NOT_SUPPORTED"; break;}
    adns__diag(ads,-1,0,"GetNetworkParams() failed with error [%d] %s",
      network_info_result,network_err_str);
    }
  else {
    for(pip = &(network_info->DnsServerList); pip; pip = pip->Next) {
      addr.s_addr = inet_addr(pip->IpAddress.String);
      if ((addr.s_addr != INADDR_ANY) && (addr.s_addr != INADDR_NONE))
        addserver(ads, addr); 
    }
  }
#else
  readconfig(ads,"/etc/resolv.conf",1);
  readconfig(ads,"/etc/resolv-adns.conf",0);
#endif

  readconfigenv(ads,"RES_CONF");
  readconfigenv(ads,"ADNS_RES_CONF");

  readconfigenvtext(ads,"RES_CONF_TEXT");
  readconfigenvtext(ads,"ADNS_RES_CONF_TEXT");

  ccf_options(ads,"RES_OPTIONS",-1,res_options);
  ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);

  ccf_search(ads,"LOCALDOMAIN",-1,instrum_getenv(ads,"LOCALDOMAIN"));
  ccf_search(ads,"ADNS_LOCALDOMAIN",-1,instrum_getenv(ads,"ADNS_LOCALDOMAIN"));

  if (ads->configerrno && ads->configerrno != EINVAL) {
    r= ads->configerrno;
    init_abort(ads);
    return r;
  }

  r= init_finish(ads);
  if (r) return r;

  adns__consistency(ads,0,cc_entex);
  *ads_r= ads;
  return 0;
}