コード例 #1
0
ファイル: complete.c プロジェクト: brentdax/fishfish
/**
   Locate the specified entry. Create it if it doesn't exist.
*/
static complete_entry_t *complete_get_exact_entry( const wchar_t *cmd,
												   int cmd_type )
{
	complete_entry_t *c;

	complete_init();

	c = complete_find_exact_entry( cmd, cmd_type );

	if( c == 0 )
	{
		if( !(c = malloc( sizeof(complete_entry_t) )))
		{
			DIE_MEM();
		}

		c->next = first_entry;
		first_entry = c;

		c->first_option = 0;

		c->cmd = intern( cmd );
		c->cmd_type = cmd_type;
		c->short_opt_str = wcsdup(L"");
		c->authoritative = 1;
	}

	return c;
}
コード例 #2
0
void fuzix_main(void)
{
	/* setup state */
	inint = false;
	udata.u_insys = true;

#ifdef PROGTOP		/* FIXME */
	ramtop = (uaddr_t)PROGTOP;
#endif

	tty_init();

	if (d_open(TTYDEV, 0) != 0)
		panic(PANIC_NOTTY);

	/* Sign on messages */
	kprintf(
			"FUZIX version %s\n"
			"Copyright (c) 1988-2002 by H.F.Bower, D.Braun, S.Nitschke, H.Peraza\n"
			"Copyright (c) 1997-2001 by Arcady Schekochikhin, Adriano C. R. da Cunha\n"
			"Copyright (c) 2013-2015 Will Sowerbutts <*****@*****.**>\n"
			"Copyright (c) 2014-2015 Alan Cox <*****@*****.**>\nDevboot\n",
			sysinfo.uname);

#ifndef SWAPDEV
#ifdef PROC_SIZE
	maxproc = procmem / PROC_SIZE;
	/* Check we don't exceed the process table size limit */
	if (maxproc > PTABSIZE) {
		kprintf("WARNING: Increase PTABSIZE to %d to use available RAM\n",
				maxproc);
		maxproc = PTABSIZE;
	}
#else
	maxproc = PTABSIZE;
#endif
#else
	maxproc = PTABSIZE;
#endif
	/* Used as a stop marker to make compares fast on process
	   scheduling and the like */
	ptab_end = &ptab[maxproc];

	/* Parameters message */
	kprintf("%dkB total RAM, %dkB available to processes (%d processes max)\n", ramsize, procmem, maxproc);
	bufinit();
	fstabinit();
	pagemap_init();
	create_init();

	/* runtime configurable, defaults to build time setting */
	ticks_per_dsecond = TICKSPERSEC / 10;

	kputs("Enabling interrupts ... ");
	__hard_ei();		/* Physical interrupts on */
	kputs("ok.\n");

	/* get the root device */
	root_dev = get_root_dev();

	/* finish building argv */
	complete_init();

	/* initialise hardware devices */
	device_init();

	/* Mount the root device */
	kprintf("Mounting root fs (root_dev=%d, r%c): ", root_dev,
		ro ? 'o' : 'w');

	if (fmount(root_dev, NULLINODE, ro))
		panic(PANIC_NOFILESYS);
	root = i_open(root_dev, ROOTINODE);
	if (!root)
		panic(PANIC_NOROOT);

	kputs("OK\n");

	udata.u_cwd = i_ref(root);
	udata.u_root = i_ref(root);
	rdtime32(&udata.u_time);
	exec_or_die();
}