Beispiel #1
0
void cgibin_reg_general(WEBBLK *webblk)
{
int i;

    REGS *regs;

    regs = sysblk.regs[sysblk.pcpu];
    if (!regs) regs = &sysblk.dummyregs;

    html_header(webblk);

    hprintf(webblk->sock, "<H2>General Registers</H2>\n");
    hprintf(webblk->sock, "<PRE>\n");
    if(regs->arch_mode != ARCH_900)
        for (i = 0; i < 16; i++)
            hprintf(webblk->sock, "GR%2.2d=%8.8X%s", i, regs->GR_L(i),
                ((i & 0x03) == 0x03) ? "\n" : "\t");
    else
        for (i = 0; i < 16; i++)
            hprintf(webblk->sock, "GR%1.1X=%16.16" I64_FMT "X%s", i,
                (U64)regs->GR_G(i), ((i & 0x03) == 0x03) ? "\n" : " ");

    hprintf(webblk->sock, "</PRE>\n");

    html_footer(webblk);

}
Beispiel #2
0
void version(void)
{
  hprintf("%sRopGadget%s - " ROPGADGET_VERSION "\n", RED, ENDC);
  hprintf("Jonathan Salwan - twitter @JonathanSalwan\n");
  hprintf("Allan Wirth - allanwirth.com\n");
  hprintf("http://www.shell-storm.org\n");
}
Beispiel #3
0
/* If it's a "force 404" situation then display the error and bail. */
void do_404(void)
{
	hprintf("HTTP/1.1 404 Not found\r\n");
	hprintf("Content-Type: text/plain\r\n");
	wc_printf("Not found\r\n");
	end_burst();
}
static void RecordSystemInformation(HANDLE LogFile)
{
	FILETIME	CurrentTime;
	GetSystemTimeAsFileTime(&CurrentTime);
	char TimeBuffer[100];
	PrintTime(TimeBuffer, CurrentTime);
	hprintf(LogFile, "Error occurred at %s.\r\n", TimeBuffer);
	char	ModuleName[MAX_PATH];
	if (GetModuleFileName(0, ModuleName, sizeof(ModuleName)) <= 0) {
		lstrcpy(ModuleName, "Unknown");
	}
	char	UserName[200];
	DWORD UserNameSize = sizeof(UserName);
	if (!GetUserName(UserName, &UserNameSize)) {
		lstrcpy(UserName, "Unknown");
	}
	hprintf(LogFile, "%s, run by %s.\r\n", ModuleName, UserName);

	SYSTEM_INFO	SystemInfo;
	GetSystemInfo(&SystemInfo);
	hprintf(LogFile, "%d processor(s), type %d.\r\n",
				SystemInfo.dwNumberOfProcessors, SystemInfo.dwProcessorType);

	MEMORYSTATUS	MemInfo;
	MemInfo.dwLength = sizeof(MemInfo);
	GlobalMemoryStatus(&MemInfo);
	// Print out the amount of physical memory, rounded up.
	hprintf(LogFile, "%d MBytes physical memory.\r\n", (MemInfo.dwTotalPhys +
				ONEM - 1) / ONEM);
}
Beispiel #5
0
/*
 * This function is for uploading an ENTIRE calendar, not just one
 * component.  This would be for webcal:// 'publish' operations, not
 * for GroupDAV.
 */
void dav_put_bigics(void)
{
	wcsession *WCC = WC;
	char buf[1024];

	/*
	 * Tell the server that when we save a calendar event, we
	 * do *not* want the server to generate invitations. 
	 */
	serv_puts("ICAL sgi|0");
	serv_getln(buf, sizeof buf);

	serv_puts("ICAL putics");
	serv_getln(buf, sizeof buf);
	if (buf[0] != '4') {
		hprintf("HTTP/1.1 502 Bad Gateway\r\n");
		dav_common_headers();
		hprintf("Content-type: text/plain\r\n");
		begin_burst();
		wc_printf("%s\r\n", &buf[4]);
		end_burst();
		return;
	}

	serv_putbuf(WCC->upload);
	serv_printf("\n000");

	/* Report success and not much else. */
	hprintf("HTTP/1.1 204 No Content\r\n");
	syslog(LOG_DEBUG, "HTTP/1.1 204 No Content\r\n");
	dav_common_headers();
	begin_burst();
	end_burst();
}
static int cmd_get(connection_context *c)
{
	static const char* var_version = "version";
	static const char* var_codepage = "codepage";
	char *cmdline;
	int res = 0;

	cmdline = strchr(c->cmd, ' ');
	if (!cmdline) {
		goto finish;
	}
	++cmdline;
	int l;
	if ((strstr(cmdline, var_version) == cmdline) &&
            (cmdline[l = strlen(var_version)] == 0)) {
		hprintf(c->pipe, "version 0x%04X\n", VERSION);
	} else if ((strstr(cmdline, var_codepage) == cmdline) &&
	            (cmdline[l = strlen(var_codepage)] == 0)) {
		hprintf(c->pipe, "codepage %d\n", GetOEMCP());
	} else {
		hprintf(c->pipe, "error Unknown argument (%s)\n", c->cmd);
	    goto finish;
	}
	res = 1;
finish:
	return res;
}
static int rma1_gic_get_pendding_irq(void)
{
	//u32 status;
	//int i;
	//int irq = 199;
	//unsigned int gic_irqs = 321;
	//write32(GIC_DIST_CTRL, 0);
	//gic_irqs = read32(GIC_DIST_CTR) & 0x1f;
	//gic_irqs = 321;//(gic_irqs + 1) * 32;

#if 1
	u32 status = read32(GIC_CPU_INTACK);
	int irq = status & 0x3ff;
	//hprintf("INTACK: %p\n", status);
	irq = (irq == 0x3ff ? -1 : irq);
	//hprintf("%s(): %d\n", __func__, irq);
#endif

	//status = read32(GIC_CPU_HIGHPRI);
	//hprintf("HIGHPRI: %d\n", status);

#if 0
	for (i = 32; i < gic_irqs; i += 32) {
		status = read32(GIC_DIST_PENDING_SET + i * 4 / 32);
		hprintf("PENDING_SET: i=%d: %p\n", i, status);
	}
#if 1
	for (i = 32; i < gic_irqs; i += 32) {
		status = read32(GIC_DIST_ACTIVE_BIT + i * 4 / 32);
		hprintf("ACTIVE_BIT: i=%d: %p\n", i, status);
	}
#endif
#endif
	return irq;
}
Beispiel #8
0
/*
 * Authorization required page (sends a 401, causing the browser to request login credentials)
 */
void authorization_required(void)
{
	wcsession *WCC = WC;
	const char *message = "";

	hprintf("HTTP/1.1 401 Authorization Required\r\n");
	hprintf(
		"Server: %s / %s\r\n"
		"Connection: close\r\n",
		PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software)
	);
	hprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", ChrPtr(WC->serv_info->serv_humannode));

	/* if this is a false cookie authentication, remove it to avoid endless loops. */
	if (StrLength(WCC->Hdr->HR.RawCookie) > 0)
		stuff_to_cookie(1);

	hprintf("Content-Type: text/html\r\n");
	begin_burst();
	wc_printf("<h1>");
	wc_printf(_("Authorization Required"));
	wc_printf("</h1>\r\n");

	if (WCC->ImportantMsg != NULL) {
		message = ChrPtr(WCC->ImportantMsg);
	}

	wc_printf(
		_("The resource you requested requires a valid username and password. "
		"You could not be logged in: %s\n"),
		message
	);
	wDumpContent(0);
}
int help_cmdfunc(int argc, char *argv[])
{
	const command_list_t *cmdlist = get_current_commands();
	const command_t *cmd;
	const char *name = 0;
	int found, i, spaces;
	char abbrev;

	if (argc > 2)
		return -H_EUSAGE;
	if (argc == 2)
		name = *++argv;

	for (found=0, i=0; (cmd = cmdlist->commands[i]); ++i) {
		if (name && strcmp(name, cmd->name))
			continue;
		found = 1;
		spaces = 30;
		if ((abbrev = find_abbrev(cmdlist, cmd)))
			spaces -= hprintf("%c ", abbrev);
		else
			spaces -= hprint("  ");
		spaces -= hprint(cmd->name);
		if (cmd->arghelp)
			spaces -= hprintf(" %s", cmd->arghelp);
		for (/* nothing */; spaces > 0; --spaces)
			hputchar(' ');
		hprintf(": %s\n", cmd->cmdhelp);
	}
	if (name && !found)
		return -H_ENOCMD;
	return 0;
}
Beispiel #10
0
/*
 * Handle processor traps/faults. Most of these are reflected
 * to the current partition except for page fault events, these
 * we handle ourselves.
 */
void
exception(struct cpu_thread *thread, uval32 trapno, uval32 error_code)
{
	switch (trapno) {
	case PF_VECTOR:
		page_fault(thread, error_code, get_cr2());
		break;
	case GP_VECTOR:
		gen_prot_fault(thread, trapno, error_code);
		break;
	case DF_VECTOR:
	case TS_VECTOR:
	case NP_VECTOR:
	case SS_VECTOR:
	case AC_VECTOR:
#ifdef DEBUG
		hprintf("Exception: trapno 0x%x\n", trapno);
		dump_cpu_state(thread);
#endif
		raise_fault(thread, trapno, error_code);
		break;
	default:
#ifdef DEBUG
		hprintf("Exception: trapno 0x%x\n", trapno);
		dump_cpu_state(thread);
#endif
		raise_exception(thread, trapno);
		break;
	}
}
Beispiel #11
0
/*
 * Entry point for RSS feed generator
 */
void feed_rss(void) {
	char buf[1024];

	output_headers(0, 0, 0, 0, 1, 0);
	hprintf("Content-type: text/xml; charset=utf-8\r\n");
	hprintf(
		"Server: %s / %s\r\n"
		"Connection: close\r\n"
	,
		PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software)
	);
	begin_burst();

	wc_printf("<?xml version=\"1.0\"?>"
		"<rss version=\"2.0\">"
		"<channel>"
	);

	wc_printf("<title>");
	escputs(ChrPtr(WC->CurRoom.name));
	wc_printf("</title>");

	wc_printf("<link>");
	escputs(ChrPtr(site_prefix));
	wc_printf("/</link>");

	serv_puts("RINF");
	serv_getln(buf, sizeof buf);
	if (buf[0] == '1') {
		wc_printf("<description>\r\n");
		while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
			escputs(buf);
			wc_printf("\r\n");
		}
		wc_printf("</description>");
	}

	wc_printf("<image><title>");
	escputs(ChrPtr(WC->CurRoom.name));
	wc_printf("</title><url>");
	escputs(ChrPtr(site_prefix));
	wc_printf("/roompic?room=");
	urlescputs(ChrPtr(WC->CurRoom.name));
	wc_printf("</url><link>");
	escputs(ChrPtr(site_prefix));
	wc_printf("/</link></image>\r\n");

	feed_rss_do_room_info_as_description();
	feed_rss_do_messages();

	wc_printf("</channel>"
		"</rss>"
		"\r\n\r\n"
	);

	wDumpContent(0);
}
Beispiel #12
0
static uval
launch_partition(struct partition_status *ps, struct load_file_entry* lf,
		 uval ofd)
{
	uval ret[1];
	uval rc;
	const uval defslot = 0x1;
	uval schedvals[3];
	sval rot;

	uval magic = lf->loaderSegmentTable[0].file_start;
	magic += 0x10;

	if (*(uval64*)magic == HYPE_PARTITION_INFO_MAGIC_NUMBER) {
		magic = *((uval*)(magic + 8));
	} else {
		magic = INVALID_LOGICAL_ADDRESS;
	}

	hputs("Creating partition\n");
	rc = hcall_create_partition(ret, ps->init_mem, ps->init_mem_size,
				    magic);
	assert(rc == H_Success,
	       "hcall_create_partition() failed rc= 0x%lx\n", rc);

	hprintf("Created partition  ID %ld\n"
		"  starting it @ pc = 0x%llx.\n",
		ret[0], lf->va_entry);
	ps->lpid = ret[0];

	vty_setup(ps);

	rot = hcall_set_sched_params(schedvals, ps->lpid,
				     THIS_CPU, defslot, 0);
	assert(rot >= 0, "set_sched failed\n");
	hprintf("Scheduled 0x%lx: rot: %ld (0x%016lx, 0x%016lx 0x%016lx)\n",
		ps->lpid, rot, schedvals[0], schedvals[1], schedvals[2]);


	curslots = schedvals[0];
	ps->slot = schedvals[2];

	register_partition(ps, ofd);

	if (!start_partition(ps, lf, ofd)) {
		return 0;
	}

	hprintf("%s: yielding to sysId: 0x%lx now\n", __func__, ps->lpid);
	hcall_yield(NULL, ps->lpid);
	hprintf("%s: back from yielding to sysId: 0x%lx\n",
		__func__, ps->lpid);


	return ps->lpid;
}
static int peek_cmdfunc(int argc, char *argv[])
{
	/* previous addr and width are remembered for "peeknext" */
	static addr_t addr;
	static size_t width = sizeof (word_t);
	u32 flags;

	if (argc > 2)
		return -H_EUSAGE;
	if (!strcmp(*argv, "peeknext"))
		addr += width;
	else {
		if (!strcmp(*argv, "peek8"))
			width = 1;
		else if (!strcmp(*argv, "peek16"))
			width = 2;
		else
			width = sizeof (word_t);
		if (argc > 1)
			if (scan(*++argv, &addr)) return -H_EADDR;
	}

	addr &= ~(addr_t)(width - 1);	/* align pointer */
	hprintf("*%p == 0x", addr);
	switch (width) {
	case 1:
		{
			uint8_t v;
			boost_off_save(&flags);
			v = *(uint8_t*)addr;
			boost_restore(flags);
			hprintf("%b", v);
			hprintf((v >= 32 && v < 127) ? " '%c'\n" : "\n", v);
		}
		break;
	case 2:
		{
			uint16_t v;
			boost_off_save(&flags);
			v = *(uint16_t*)addr;
			boost_restore(flags);
			hprintf("%h\n", v);
		}
		break;
	case (sizeof (word_t)):
		{
			word_t v;
			boost_off_save(&flags);
			v = *(word_t*)addr;
			boost_restore(flags);
			hprintf("%x\n", v);
		}
		break;
	}
	return 0;
}
Beispiel #14
0
DLL_EXPORT void html_header(WEBBLK *webblk)
{
    if (webblk->request_type != REQTYPE_POST)
        hprintf(webblk->sock,"Expires: 0\n");

    hprintf(webblk->sock,"Content-type: text/html\n\n");

    if (!html_include(webblk,HTML_HEADER))
        hprintf(webblk->sock,"<HTML>\n<HEAD>\n<TITLE>Hercules</TITLE>\n</HEAD>\n<BODY>\n\n");
}
Beispiel #15
0
int
bm_printboard(struct boardmanager *bm, void *farg)
{
	if (getboard(bm->board)){
		printf("<a href=%s%s target=f3>", showByDefMode(), bm->board);
		hprintf("%s", bm->board);
		printf("</a> ");
		hprintf(" ");
	} 
	return 0;
}
Beispiel #16
0
/*
 * Creating a new shadow page table context is achieved through H_PAGE_DIR().
 * This call also controls the context switching between shadow page table
 * maps and potential prefetching of the shadow page tables kept by the
 * hypervisor. Prefetching is prefered over faulting page mappings in on
 * individual hypervisor page faults.
 *
 * ``flags'' are defined as:
 *
 *	H_PAGE_DIR_FLUSH	Flush all shadow (cached) page table entries
 *				for this ``lp_pgdir_laddr''. If this is the
 *				current map, the map is guaranteed to stay
 *				active until the next H_PAGE_DIR_ACTIVATE.
 *
 *	H_PAGE_DIR_PREFETCH     Prefetch all the shadow (cached) page table
 *				entries for this ``lp_pgdir_laddr'' from the
 *				guest partition.
 *
 *	H_PAGE_DIR_ACTIVATE	Activate the current context, as indicated
 *				by the page table root ``lp_pgdir_laddr''.
 *
 *	Bitwise combinations of these flags are allowed.
 *
 * ``lp_pgdir_laddr'' is defined as the logical address of the partition's
 * page table root directory.
 */
sval
h_page_dir(struct cpu_thread *thread, uval flags, uval lp_pgdir_laddr)
{
	struct pgcache *pgc = &thread->cpu->os->pgcache;
	union pgframe *pgd = pgc_lookup(pgc, lp_pgdir_laddr, PGC_PGDIR);

#ifdef PGF_DEBUG
	hprintf("H_PAGE_DIR: flags {");
	if (flags & H_PAGE_DIR_FLUSH)
		hprintf(" FLUSH");
	if (flags & H_PAGE_DIR_PREFETCH)
		hprintf(" PREFETCH");
	if (flags & H_PAGE_DIR_ACTIVATE)
		hprintf(" ACTIVATE");
	hprintf(" }, pgdir 0x%lx\n", lp_pgdir_laddr);
#endif

	/* the most frequent operation is a simple context switch */
	if (likely(pgd && flags == H_PAGE_DIR_ACTIVATE)) {
		activate(thread, pgd);
		return H_Success;
	}

	/* if necessary, allocate a page cache entry for this pgdir */
	if (pgd == NULL) {
		pgd = pgc_alloc(thread, lp_pgdir_laddr, PGC_PGDIR);
		if (pgd == NULL)
			return H_Parameter;
		pgc_hypervisor_mapping(pgd);
		flags |= H_PAGE_DIR_PREFETCH;
	}

	/* process flush/prefetch hints, if any */
	switch (flags & (H_PAGE_DIR_FLUSH | H_PAGE_DIR_PREFETCH)) {
	case H_PAGE_DIR_FLUSH:
		/* flush the entire pgdir on the next activate */
		if (thread->flushed && thread->flushed != pgd)
			pgc_free(pgc, thread->flushed, PGC_PGDIR);
		thread->flushed = pgd;
		break;

	case H_PAGE_DIR_PREFETCH:
	case H_PAGE_DIR_FLUSH | H_PAGE_DIR_PREFETCH:
		/* prefetch any entries if so desired */
		pgc_prefetch(thread, pgd, PGC_PGDIR);
		break;
	}

	/* activate this page directory */
	if (flags & H_PAGE_DIR_ACTIVATE)
		activate(thread, pgd);

	return H_Success;
}
Beispiel #17
0
/*
 * Generic function to do an HTTP redirect.  Easy and fun.
 */
void http_redirect(const char *whichpage) {
	hprintf("HTTP/1.1 302 Moved Temporarily\n");
	hprintf("Location: %s\r\n", whichpage);
	hprintf("URI: %s\r\n", whichpage);
	hprintf("Content-type: text/html; charset=utf-8\r\n");
	stuff_to_cookie(0);
	begin_burst();
	wc_printf("<html><body>");
	wc_printf("Go <a href=\"%s\">here</A>.", whichpage);
	wc_printf("</body></html>\n");
	end_burst();
}
static void
setclock_usage(char **clocks)
{
	int i;

	hprintf("Usage: setclock [clock]\n\n"
		"  set CPU frequency.\n\n"
		"support clocks:\n");
	for (i=1; clocks[i]; i++)
		hprintf("  %s%s\n", clocks[i],
			clocks[0] == clocks[i] ? "(default)" : "");
}
Beispiel #19
0
static void
ask_debug_flags(void)
{
	char buf[17] = { 0, };
	int x;
	hprintf("Enter debug flags value:\n");
	get_input(buf);
	x = strtoul(buf, NULL, 0);

	hprintf("Debug value: %x\n", x);

	uval rets[5];
	hcall_debug(rets, H_SET_DEBUG_LEVEL, x, 0, 0, 0);

}
Beispiel #20
0
DLL_EXPORT int html_include(WEBBLK *webblk, char *filename)
{
    FILE *inclfile;
    char fullname[HTTP_PATH_LENGTH];
    char buffer[HTTP_PATH_LENGTH];
    int ret;

    strlcpy( fullname, http_serv.httproot, sizeof(fullname) );
    strlcat( fullname, filename,           sizeof(fullname) );

    inclfile = fopen(fullname,"rb");

    if (!inclfile)
    {
        WRMSG(HHC01800,"E","fopen()",strerror(errno));
        hprintf(webblk->sock,MSG(HHC01800,"E","fopen()",strerror(errno)));
        return FALSE;
    }

    while (!feof(inclfile))
    {
        ret = (int)fread(buffer, 1, sizeof(buffer), inclfile);
        if (ret <= 0) break;
        hwrite(webblk->sock,buffer, ret);
    }

    fclose(inclfile);
    return TRUE;
}
static int cmd_set(connection_context *c)
{
	static const char* var_system = "system";
	static const char* var_implevel = "implevel";
	static const char* var_runas = "runas";
	static const char* var_profile = "profile";
	char *cmdline;
	int res = 0;

	cmdline = strchr(c->cmd, ' ');
	if (!cmdline) {
		goto finish;
	}
	++cmdline;
	int l;
	if ((strstr(cmdline, var_system) == cmdline) &&
            (cmdline[l = strlen(var_system)] == ' ')) {
		c->system = atoi(cmdline + l + 1);
	} else if ((strstr(cmdline, var_implevel) == cmdline) &&
            (cmdline[l = strlen(var_implevel)] == ' ')) {
		c->implevel = atoi(cmdline + l + 1);
	} else if ((strstr(cmdline, var_profile) == cmdline) &&
            (cmdline[l = strlen(var_profile)] == ' ')) {
		c->profile = atoi(cmdline + l + 1);
	} else if ((strstr(cmdline, var_runas) == cmdline) &&
            (cmdline[l = strlen(var_runas)] == ' ')) {
		c->runas = strdup(cmdline + l + 1);
	} else {
	    hprintf(c->pipe, "error Unknown commad (%s)\n", c->cmd);
	    goto finish;
	}
	res = 1;
finish:
	return res;
}
Beispiel #22
0
int
bbsmsg_main()
{	//modify by mintbaggio 20040829 for new www
	char buf[MAX_MSG_SIZE];
	char msgbuf[MAX_MSG_SIZE*2];
	int count, i;
	struct msghead head;
	html_header(1);
	check_msg();
	printf("<body>");
	printf("<div class=rhead>%s -- 查看信息</div><hr>\n", BBSNAME);
	if (!loginok || isguest)
		http_fatal("匆匆过客无法查看讯息, 请先登录");
	changemode(LOOKMSGS);
	count =  get_msgcount(0, currentuser.userid);
	if (count == 0)
		http_fatal("没有任何讯息");
	for (i=0; i<count; i++) {
                        load_msghead(0, currentuser.userid, &head, i);
                        load_msgtext(currentuser.userid, &head, buf);
			translate_msg(buf, &head, msgbuf, 0);
		hprintf("%s", msgbuf);
	}
	u_info->unreadmsg = 0;
        printf("<a onclick='return confirm(\"你真的要清除所有讯息吗?\")' href=bbsdelmsg>清除所有讯息</a> ");
	printf("<a href=bbsmailmsg>寄回所有信息</a>");
	http_quit();
	return 0;
}
static void rma1_gic_free_irq(int irq)
{
	u32 mask = 1 << (irq % 32);
	hprintf("%s(): %d\n", __func__, irq);
	/* mask */
	write32(GIC_DIST_ENABLE_CLEAR + irq / 32 * 4, mask);
}
Beispiel #24
0
uval
load_in_lpar(struct partition_status* ps, uval offset,
	     uval istart, uval isize)
{
	uval ra;
	uval ea;
	uval size;
	ra = ALIGN_DOWN(ps->init_mem + offset, 1 << LOG_CHUNKSIZE);
	size = ALIGN_UP(ps->init_mem + offset - ra + isize, PGSIZE);

	ea = ra;

	map_pages(ra, ea, 1 << LOG_CHUNKSIZE);

	ea += offset;

	hprintf("Copying partition img: 0x%lx[0x%lx] -> 0x%lx\n",
		istart, isize, ea);

	memcpy((void *)ea, (void *)istart, isize);

	isize = ALIGN_UP(isize, PGSIZE);
	while (isize) {
		icache_invalidate_page(ea >> LOG_PGSIZE, LOG_PGSIZE);
		isize -= PGSIZE;
	}

	return 1;
}
Beispiel #25
0
static void
load_image(struct partition_status* ps,
	   struct load_file_entry* lf, uval load_offset)
{
	struct loader_segment_entry *le;
	int segno = lf->numberOfLoaderSegments;
	uval istart;
	uval isize;
	uval offset;
	int i;

	for (i = 0; i < segno; i++) {
		le = &lf->loaderSegmentTable[i];
		istart = le->file_start;
		isize = le->file_size;
		offset = le->va_start;
		if (le->file_size > 0) {
			hprintf("%s: copying bits from %s: to 0x%lx[0x%lx]\n",
				__func__, ps->name,
				ps->init_mem + offset + load_offset,
				isize);

			load_in_lpar(ps, offset + load_offset, istart, isize);
		}
	}
	lf->va_entry += load_offset;
	lf->va_tocPtr+= load_offset;
}
Beispiel #26
0
DLL_EXPORT int html_include(WEBBLK *webblk, char *filename)
{
    FILE *inclfile;
    char fullname[HTTP_PATH_LENGTH];
    char buffer[HTTP_PATH_LENGTH];
    int ret;

    strlcpy( fullname, sysblk.httproot, sizeof(fullname) );
    strlcat( fullname, filename,        sizeof(fullname) );

    inclfile = fopen(fullname,"rb");

    if (!inclfile)
    {
        logmsg(_("HHCHT011E html_include: Cannot open %s: %s\n"),
          fullname,strerror(errno));
        hprintf(webblk->sock,_("ERROR: Cannot open %s: %s\n"),
          filename,strerror(errno));
        return FALSE;
    }

    while (!feof(inclfile))
    {
        ret = fread(buffer, 1, sizeof(buffer), inclfile);
        if (ret <= 0) break;
        hwrite(webblk->sock,buffer, ret);
    }

    fclose(inclfile);
    return TRUE;
}
Beispiel #27
0
int
emotion_print(char *msg)
{
    char *sstart, *ptr;
    int i, j;
    sstart = msg;
    for (i = 0; my_emotion[i].filename != NULL; i++) {
        for (j = 0; my_emotion[i].smilename[j] != NULL; j++) {
            ptr = strstr(sstart, my_emotion[i].smilename[j]);
            if (NULL == ptr)
                continue;
            *ptr = 0;
            emotion_print(sstart);
            sstart = ptr + strlen(my_emotion[i].smilename[j]);
            printf("<img src=/%s.gif></img>",
                   my_emotion[i].filename);
            i = 0;
            break;
            if (*sstart == 0)
                return 0;
        }
    }
    if (*sstart != 0)
        hprintf("%s", sstart);
    return 0;
}
Beispiel #28
0
void cgibin_debug_device_list(WEBBLK *webblk)
{
DEVBLK *dev;
char   *class;

    html_header(webblk);

    hprintf(webblk->sock,"<h2>Attached Device List</h2>\n"
                          "<table>\n"
                          "<tr><th>Number</th>"
                          "<th>Subchannel</th>"
                          "<th>Class</th>"
                          "<th>Type</th>"
                          "<th>Status</th></tr>\n");

    for(dev = sysblk.firstdev; dev; dev = dev->nextdev)
        if(dev->pmcw.flag5 & PMCW5_V)
        {
             (dev->hnd->query)(dev, &class, 0, NULL);

             hprintf(webblk->sock,"<tr>"
                                   "<td>%4.4X</td>"
                                   "<td><a href=\"detail?subchan=%4.4X\">%4.4X</a></td>"
                                   "<td>%s</td>"
                                   "<td>%4.4X</td>"
                                   "<td>%s%s%s</td>"
                                   "</tr>\n",
                                   dev->devnum,
                                   dev->subchan,dev->subchan,
                                   class,
                                   dev->devtype,
                                   (dev->fd > 2 ? "open " : ""),
                                   (dev->busy ? "busy " : ""),
                                   (IOPENDING(dev) ? "pending " : ""));
        }
Beispiel #29
0
sval
h_get_tce(struct cpu_thread *thread, uval32 liobn, uval ioba)
{
    thread = thread;
    hprintf("%s: liobn: 0x%x ioba: 0x%lx \n", __func__, liobn, ioba);
    return (H_Function);
}
Beispiel #30
0
int main()
{
        char word[80], buf[256];
        int type;
        int has=1;	//wzk
        init_all();
        modify_mode(u_info,DICT+20000);	//bluetent
        type=atoi(getparm("type"));
        strcpy(word, getparm("word"));
        printf("%s -- 字典查询<hr color=green>\n", BBSNAME);
        if(type==0 || word[0]==0) {
                printf("<form name=dict method=post action=bbsdict?type=1><pre>\n");
                hprintf("本字典 CDICT5.0 收录单词近 40000 , 一般较常见的单词和缩写均已收录,\n");
                printf("中英文输入均可, 支持'*'后缀通配符.\n\n");
                printf("请输入要查询的中英文单词: <input type=text name=word>\n");
                printf("<input type=submit>\n");
                printf("</pre></form><script language=javascript>dict.word.focus()</script>\n");
        } else {
                char file[80];
                FILE *fp;
                printf("查询单词: [%s]<br>\n", nohtml(word));
                sprintf(file, "tmp/%d.tmp", getpid());
                check(word);
                sprintf(buf, "bin/dict '%s' > %s", word, file);
                system(buf);
                fp=fopen(file, "r");
                if(fp==0)
                        http_fatal("内部错误");

                printf("<table width=610 border=0><tr><td><pre>\n");
                fgets(buf, 255, fp);		//wzk
                printf("<br>");			//wzk
                while(1) {
                        if(fgets(buf, 255, fp)==0) {
                                if (has)
                                        printf("单词\"%s\"没有找到", word);
                                break;
                        }
                        has=0;		//wzk
                        hprintf("%s", buf);
                }
                printf("</pre></table>");
                unlink(file);
        }
        check_msg();//bluetent 2002.10.31
        http_quit();
}