Example #1
0
static void printList(void)
{
	int i, nNum;

	printLine();
	nNum = g_MountProg.GetMountNumber();
	for (i = 0; i < nNum; i++)
		printf("%s\n", g_MountProg.GetClientAddr(i));
	printCount();
	printLine();
}
Example #2
0
static void printCount(void)
{
	int nNum;

	nNum = g_MountProg.GetMountNumber();
	if (nNum == 0)
		printf("There is no client mounted.\n");
	else if (nNum == 1)
		printf("There is 1 client mounted.\n");
	else
		printf("There are %d clients mounted.\n", nNum);
}
Example #3
0
static void inputCommand(void)
{
	char command[20];

	printf("Type 'help' to see help\n\n");

	while (true) {
		fgets(command, 20, stdin);

		if (command[strlen(command) - 1] == '\n') {
			command[strlen(command) - 1] = '\0';
		}

		if (_stricmp(command, "about") == 0) {
			printAbout();
		} else if (_stricmp(command, "help") == 0) {
			printHelp();
		} else if (_stricmp(command, "log on") == 0) {
			g_RPCServer.SetLogOn(true);
		} else if (_stricmp(command, "log off") == 0) {
			g_RPCServer.SetLogOn(false);
		} else if (_stricmp(command, "list") == 0) {
			printList();
		} else if (_stricmp(command, "quit") == 0) {
			if (g_MountProg.GetMountNumber() == 0) {
				break;
			} else {
				printConfirmQuit();
				fgets(command, 20, stdin);

				if (command[0] == 'y' || command[0] == 'Y') {
					break;
				}
			}
		} else if (_stricmp(command, "refresh") == 0) {
			g_MountProg.Refresh();
		} else if (_stricmp(command, "reset") == 0) {
			g_RPCServer.Set(PROG_NFS, NULL);
		} else if (strcmp(command, "") != 0) {
			printf("Unknown command: '%s'\n", command);
			printf("Type 'help' to see help\n");
		}
	}
}