Example #1
0
void interp(void)
{

	char line[256];
	char *p;

	while(1)
	{
		putchar('>');
		putchar(' ');
		flushall();
		gets(line);

		// p points to next word after verb on command line
		p = line;
		while (*p && *p!=' ')
			p++;
		if (!*p)
			p = 0;
		else
		{
			while(*p && *p==' ')
				p++;
		}

		switch(toupper(line[0]))
		{
		case 'B':
			vVerbose(p);
			break;
		case 'C':
			vCreate(p);
			break;
		case 'D':
			vDisplay(p);
			break;
		case 'F':
			vFind(p);
			break;
		case 'H':
		default:
			vHelp(line);
			break;
		case 'I':
			vInstall(p);
			break;
		case 'K':
			vPack(p);
			break;
		case 'P':
			vPretend(p);
			break;
		case 'R':
			vRemove(p);
			break;
		case 'S':
			vSave(p);
			break;
		case 'T':
			vTest(p);
			break;
		case 'U':
			vUpdate(p);
			break;
		case 'V':
			vVerify(p);
			break;
		case 'Q':
		case 'X':
			vSave(0);
			return;
		}	// switch
	}	// while

	assert(0);
	return;	// shouldn't get here

}	// interp
Example #2
0
void interp(void)
{

	char line[256];
	char *p;

	while(1)
	{
		putchar('>');
		putchar(' ');
		fflush(stdin); fflush(stdout); fflush(stderr);
		gets(line);

		/* p points to next word after verb on command line */
		p = line;
		while (*p && *p!=' ')
			p++;
		if (!*p)
			p = 0;
		else
		{
			while(*p && *p==' ')
				p++;
		}

		switch(toupper(line[0]))
		{
		case 'N':
			vCreate(p);
			break;
        case 'A':
            error("VR_SetRegDirectory", VR_SetRegDirectory(p));
            break;
        case 'C':
            error("VR_Close", VR_Close());
            break;

		case 'I':
			vInstall(p);
			break;
		case 'R':
        	error("VR_Remove", VR_Remove(p));
			break;
        case 'X':
        	error("VR_InRegistry", VR_InRegistry(p));
            break;
        case 'T':
        	error("VR_ValidateComponent", VR_ValidateComponent(p));
            break;

#if  LATER
        case 'E':
            vEnum(p);
            break;

        case 'V':
            vVersion(p);
            break;
        case 'P':
            vPath(p);
            break;
        case 'F':
            vGetRefCount(p);
            break;
        case 'D':
            vGetDir(p);
            break;
        
        case 'S':
            puts("--Unsupported--");
#endif

		case 'H':
		default:
			vHelp(line);
			break;
		case 'Q':
			return;
		}	/* switch */
	}	/* while */

	assert(0);
	return;	/* shouldn't get here */

}	/* interp */