- canon("/", curdir);
-loop:
- getcmd(curdir, cmd, name);
- switch (cmd[0]) {
- /*
- * Add elements to the extraction list.
- */
- case 'a':
- ino = dirlookup(name);
- if (ino == 0)
- break;
- if (mflag)
- pathcheck(name);
- treescan(name, ino, addfile);
- break;
- /*
- * Change working directory.
- */
- case 'c':
- ino = dirlookup(name);
- if (ino == 0)
- break;
- if (inodetype(ino) == LEAF) {
- fprintf(stderr, "%s: not a directory\n", name);
- break;
- }
- (void) strcpy(curdir, name);
- break;
- /*
- * Delete elements from the extraction list.
- */
- case 'd':
- np = lookupname(name);
- if (np == NIL || (np->e_flags & NEW) == 0) {
- fprintf(stderr, "%s: not on extraction list\n", name);
- break;
- }
- treescan(name, np->e_ino, deletefile);
- break;
- /*
- * Extract the requested list.
- */
- case 'e':
- createfiles();
- createlinks();
- setdirmodes();
- if (dflag)
- checkrestore();
- volno = 0;
- break;
- /*
- * List available commands.
- */
- case 'h':
- case '?':
- fprintf(stderr, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- "Available commands are:\n",
- "\tls [arg] - list directory\n",
- "\tcd arg - change directory\n",
- "\tpwd - print current directory\n",
- "\tadd [arg] - add `arg' to list of",
- " files to be extracted\n",
- "\tdelete [arg] - delete `arg' from",
- " list of files to be extracted\n",
- "\textract - extract requested files\n",
- "\tquit - immediately exit program\n",
- "\tverbose - toggle verbose flag",
- " (useful with ``ls'')\n",
- "\thelp or `?' - print this list\n",
- "If no `arg' is supplied, the current",
- " directory is used\n");
- break;
- /*
- * List a directory.
- */
- case 'l':
- ino = dirlookup(name);
- if (ino == 0)
- break;
- printlist(name, ino);
- break;
- /*
- * Print current directory.
- */
- case 'p':
- if (curdir[1] == '\0')
- fprintf(stderr, "/\n");
- else
- fprintf(stderr, "%s\n", &curdir[1]);
- break;
- /*
- * Quit.
- */
- case 'q':