void dormdir (int argc, char **argv) { int n; firqb f; word ne; if (argc == 0) { printf ("Usage: %s rmdir dir...\n", progname); return; } rmountrw (); for (n = 0; n < argc; n++) { if (!parse (argv[n], &f) || (f.flags & ~f_ppnw) != f_ppn) { printf ("Invalid PPN %s\n", argv[n]); continue; } if ((ne = initfilescan (&f, gfdatrtbl)) == 0) { printf ("No PPNs matching "); printfqbppn (&f); continue; } do { if (remdir (&f, ne) && sw.verbose != NULL) printf ("Account [%d,%d] deleted\n", f.cproj, f.cprog); } while ((ne = nextppn (&f, gfdatrtbl)) != 0); } rumountrw (); }
int FileCommands::analyze(string command, FileSystemUser* fileSystem) { vector<string> args = StringService::commandSplit(command); if(args.size() == 0) { notFoundCommand(command); return DEFAULT; } if(args[0] == commands[MKDIR]) { mkdir(fileSystem, args[1]); return DEFAULT; } if(args[0] == commands[EXIT]){ return SHUTDOWN; } if(args[0] == commands[MKFILE]) { mkfile(fileSystem, args[1]); return DEFAULT; } if(args[0] == commands[REMDIR]) { remdir(fileSystem, args[1]); return DEFAULT; } if(args[0] == commands[REMFILE]) { remfile(fileSystem, args[1]); return DEFAULT; } if(args[0] == commands[CD]) { cd(fileSystem, args[1]); return DEFAULT; } if(args[0] == commands[LS]) { ls(fileSystem); return DEFAULT; } if(args[0] == commands[LSDIR]) { lsdir(fileSystem); return DEFAULT; } if(args[0] == commands[LSFILE]) { lsfile(fileSystem); return DEFAULT; } if(args[0] == commands[EDIT]) { edit(fileSystem, args[1]); return DEFAULT; } if(args[0] == commands[SHOW]) { show(fileSystem, args[1]); return DEFAULT; } if(args[0] == commands[HELP]) { help(); return DEFAULT; } notFoundCommand(args[0]); return DEFAULT; }