⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zoo.c

📁 汇编源代码大全
💻 C
📖 第 1 页 / 共 2 页
字号:
         case 'L': 
            zoolist(&argv[2], option, argc-2); break;
         case 'e':
         case 'x': 
            zooext(zooname, option); break;
         case 'P':
            zoopack (zooname, option); break;
         case 'c':
            comment (zooname, option); break;
         default:
            goto give_list;
      }
zooexit (0);      /* don't fall through */

/* usage list including Novice commands */
show_usage:
   fprintf (stderr, "%s\n\n%s%s%s", version, usage, nov_usage, nov_cmds);
	zooexit (1);

/* brief usage list */
give_list:
	fprintf (stderr, usage); zooexit (1);

/* help screen */
bigusage:
printf("\n\n\n\n\n\n\n\n");
printf ("Zoo archiver, %s\n", version);
printf("(C) Copyright 1991 Rahul Dhesi -- Noncommercial use permitted\n");

printf (usage);
printf ("\nChoose a command from within {} and zero or more modifiers from within [].\n");

printf ("E.g.:  `zoo a save /bin/*' will archive all files in /bin into save.zoo.\n");
printf ("(Please see the user manual for a complete description of commands.)\n\n");
printf (nov_usage);
printf (nov_cmds);
printf ("\n\n\n\n");
wait_return();	/* print msg & wait for RETURN */

printf ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf (usage);

printf (" Commands in {} mean:         |Modifiers in [] mean:\n");

printf ("  a     add files             | a     show archive name(s) in listing\n");
printf ("  c     update comments       | A     apply g or c to archive\n");
printf ("  D     delete stored files   | c     add/list comments\n");
printf ("  e,x   extract files         | d     extract/list deleted files too\n");
printf ("  g     adj. gen. limit/count | dd    extract/list only deleted files\n");
printf ("  l,L,v,V list filenames      | E     erase backup after packing\n");
printf ("  P     pack archive          | f     fast add (no compression) or list\n");
printf ("  T     fix archive datestamp | M     move when adding (erase original)\n");
printf ("  u     add only newer files  | n     add only files not already in archive\n");
printf ("  U     undelete stored files | N     send extracted data to Nowhere\n");
#ifdef FILTER
printf ("  f     act as filter         | c/u   compress/uncompress as filter\n");
#endif /* FILTER */
printf (" -----------------------------  O     don't ask \"Overwrite?\"\n");
printf ("  q     be quiet                p     pipe extracted data to standard output\n");
printf ("  :     don't store dir names   /,//  extract full pathnames\n");
printf ("  .     pack to current dir     I     add filenames read from stdin\n");
printf ("  C     show file CRC value     +/-   enable/disable generations\n");
printf ("  S     overwrite newer files   g     list generation limits\n");
printf ("  P     pack after adding       @n    start extract/list at position n\n");

#ifdef FATTR
printf ("  m     list file modes         OO    overwrite read-only files\n");
#endif /* FATTR */
printf ("  C     change archive cmnt     h     use high-compression method\n");
#endif /* end of not OOZ */

/* NOTE:  if allowed to fall through and return without an exit() statement,
   it was printing garbage--corrupted stack?  Why--bug in Microsoft C? */
zooexit (1);
return 1;	/* keep lint & compilers happy */
}

/* multi-screen help facility thanks to Bill Davidsen */

/* help screens */
static char *scrn1[] = {
   "",
	"command line format:",
	"  zoo {command}[options] archive files(s)",
	"",
	"Commands:",
	" a  add files",
	"    u - update, replace only if file is newer than saved version",
	"    n - new, add if file is not in archive",
	"    f - fast, don't compress at all",
	"    h - high performance compressor, slower than default",
	"    M - move files to archive, delete after saving",
	"    c - add a comment to each file added",
	"    C - add a comment to the archive as a whole",
	"    : - strip directory names, save filenames only",
	"    q - quiet (qq suppresses warnings, qqq suppresses nonfatal errors too)",
	"    P - pack after adding, remove overwritten or deleted files",
	"        (leaves a .bak file, use PP to overwrite it)",
	"    I - read filenames from standard input",
	"    + - enable generations",
	(char *)NULL
};

static char *scrn2[] = {
   "",
	" e  extract files",
	" x  extract files",
	"    : - extract to current directory (ignore pathnames)",
   "    . - make absolute pathnames relative to current directory",
	"        (name /etc/hosts becomes ./etc/hosts)",
	"    / - extract to subdirs, // create subdirs as needed - default",
	"        (the sequence :/ may be used to use but not create subdirs)",
	"    q - quiet",
	"    d - extract deleted files, too. dd extract *only* deleted files",
	"    N - extract to nowhere. Used to test the archive with xN or xNq",
	"    p - extract for pipe to standard output. Use q to avoid header",
	"",
#ifdef FATTR
	"    O - overwrite without asking, OO overwrites readonly files",
#else
	"    O - overwrite without asking",
#endif
	"    S - overwrite superceded (newer) files",
	(char *)NULL
};

static char *scrn3[] = {
   "",
	" l  list archive info",
	" L  list info for multiple archives",
	" v  list verbose file info and archive comment",
	" V  list verbose file info, archive and file comments",
	"    v - verbose (same as v command, used with L for multiple files",
	"    V - verbose with file comments",
	"    C - show CRC",
	"    a - show archive name in file listing (useful with L)",
#ifdef FATTR
	"    m - mode, show file modes in octal",
#endif
	"    d - show deleted files",
	"    q - quiet, shows only file info, no comments or headers",
	"    f - fast, lists only filename, no pathname, multiple columns",
	"    1 - one column output (for the f option)",
	"",
	" c  comment changes, change or add comments to listed files",
	"    (changes all file comments if no files given)",
	"    A - only change archive comment",
	(char *)NULL
};

static char *scrn4[] = {
   "",
	" P  pack archive, remove deleted or overwritten files",
	"    E - erase the .bak file when done",
	"",
	" D  delete files by name",
	"    P - pack after deletion, use PP if .bak file exists",
	"    q - quiet",
	"",
	" T  timestamp adjust, make archive age of newest file",
	"",
	" g  generation commands",
	"    l - set generation limit on files",
	"    A - apply limit to archive rather than a file (with gl)",
	"",
	" f  filter, copy stdin to stdout with [de]compression",
	"    c - compress",
	"    u - uncompress",
	"    h - use the high compression method",
	(char *)NULL
};

static char *scrn5[] = {
   "",
	"Examples:",
	"",
	"# just add a few files",
	"    zoo a arch file1 files",
	"# add C source files in subdirectories",
	"    zoo a test part1/*.c part2/*.c",
	"# add documentation files with high compression",
	"    zoo ah test *.doc",
	"",
	"# extract all files",
	"    zoo x test",
	"# extract files into the current directory",
	"    zoo x: test",
	"# extract a single file and sort before listing",
	"    zoo xp test users.lst | sort",
	"",
	"# list the contents and archive comments",
	"    zoo v arch",
	"# list all files in all archives",
	"    zoo L xxx.zoo /doc/*.zoo ../*.zoo",
	(char *)NULL
};

static char **screens[] = {
	scrn1,		/* intro and add */
	scrn2,		/* extract */
	scrn3,		/* list commands */
	scrn4,		/* other commands */
	scrn5,		/* add and extract examples */
	(char **)NULL
};

/* multi-screen help routine */
static void ms_help(options)
char *options;
{
#ifndef SZ_SCREEN			/* screen size can be overridden in options.h */
# define SZ_SCREEN 24
#endif
	int scrnlen = SZ_SCREEN;
	char ***curscreen, **curline;
	int linecount;

	/* if "Hnn" output in nn line format */
	if (++options) sscanf(options, "%d", &scrnlen);
	if (scrnlen < 2)
		scrnlen = SZ_SCREEN;

	/* loop thru screens */
	for (curscreen = screens; *curscreen != NULL; ++curscreen) {
		printf("\n\n\n\n");
		linecount = scrnlen;
		curline = *curscreen;
		while (*curline != NULL) {
			printf("%s\n", *(curline++));
			--linecount;
		}

		/* slew page */
		while (--linecount != 0) putchar('\n');
		wait_return();	/* print msg & wait for RETURN */
	}

	exit(0);
}

/* wait_return prints a message, then waits until user hits RETURN key,
then returns.  Special cases:  (a) if not interactive (as tested with
isatty() if available), it returns immediately; (b) while waiting for
RETURN, if EOF occurs, it causes zooexit(0) */

static void wait_return() 
{
#ifdef HAVE_ISATTY
	if (!isatty(fileno(stdout)) || !isatty(fileno(stdin)))
		return;
#endif
	(void) printf("Hit RETURN (or ENTER) key to continue...");
	for ( ; ;) {
		int key; 
		key = getchar();
		if (key == EOF)
			zooexit(0);
		if (key == '\n' || key == '\r')
			return;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -