📄 rcfile.c
字号:
fprintf(stderr,"bad or missing arg.\n"); exit(1); }}void get_jis(char *arg,void *data){int *jisp=(int *)data;get_int(arg,data);if(*jisp<1) *jisp=1;if(*jisp>3) *jisp=3;}void do_allmodesbad(char *arg,void *data){int f;for(f=0;f<256;f++) cfg.mode_allowed[f]=0;}void do_allmodesgood(char *arg,void *data){int f;/* we still disallow ones it hasn't got */for(f=0;f<=GLASTMODE;f++) cfg.mode_allowed[f]=vga_hasmode(f)?1:0;}void do_badmode(char *arg,void *data){int f;if(get_modenumber(arg,&f,0)==-1) { CONFIG_ERR_PREFIX(); fprintf(stderr,"bad or unsupported mode.\n"); exit(1); }cfg.mode_allowed[f]=0;}void do_goodmode(char *arg,void *data){int f;if(get_modenumber(arg,&f,0)==-1) { CONFIG_ERR_PREFIX(); fprintf(stderr,"bad or unsupported mode.\n"); exit(1); }cfg.mode_allowed[f]=1;}/* used for both startmode and fs_startmode. */void do_startmode(char *arg,void *data){int *mp=(int *)data;int f;int bpp_force=0;/* fairly kludgey... */if(mp==&cfg.fs_startmode) bpp_force=8; /* make sure file-sel modes are 8-bit */if(get_modenumber(arg,&f,bpp_force)==-1) { CONFIG_ERR_PREFIX(); fprintf(stderr,"bad or unsupported mode.\n"); exit(1); }*mp=f;}void do_warn(char *arg,void *data){char *ptr=(char *)data;CONFIG_ERR_PREFIX();fprintf(stderr, "warning: the `%s' option is obsolete,\n" "\t\t\tand is being ignored.\n", ptr);}/* returns mode number which matches x,y,bpp or -1 if none did. * put `-1' in x,y or bpp to wildcard them. * * maybe this routine should be somewhere else? */int modematch(int x,int y,int bpp){int numcols,f;vga_modeinfo *vminfo;if((bpp>24)||(bpp==2)) /* they must have used numcols, not bpp. hmm, let 'em get away with it. */ numcols=bpp;else numcols=(1<<bpp);/* we check 0 - 255 at the most */for(f=0;f<256;f++) { vminfo=vga_getmodeinfo(f); if(vminfo!=NULL) if(((x==-1)||(x==vminfo->width))&& ((y==-1)||(y==vminfo->height))&& ((numcols==-1)||(numcols==vminfo->colors))) break; }if(f<255) return(f);else return(-1);}int parsecommandline(int argc,char *argv[]){const char *name; /* const needed because of struct option declaration */int entry,ret,f,c,namec,found;do { /* the GNU libc docs don't make it clear whether optarg is set to NULL * when a *short* option doesn't have an arg, so I play it safe here. */ optarg=NULL; /* SHORTOPT_STRING is defined in rcfile_short.h, as gen'd from options.src */ ret=getopt_long(argc,argv,SHORTOPT_STRING,long_opts,&entry); if(ret=='?') { /* no need for error message, it's already been done */ exit(1); } if(ret!=-1) { /* if we have a short option, it returns char code; find relevant * long-option entry. It also returns char code for long options * with equivalent short option - it doesn't hurt to look * it up in that case as well though. It's not like this takes huge * amounts of CPU... ;-) */ if(isalnum(ret)) { found=0; for(f=0;long_opts[f].name;f++) { if(long_opts[f].val==ret) { entry=f; found=1; break; } } if(!found) { fprintf(stderr, "short option not found in long_opts[] - can't happen!\n"); continue; } } /* now we have a valid entry in long_opts[], lookup name in * cfglookup to get funcptr/dataptr and run the function. */ name=long_opts[entry].name; namec=*name; found=0; for(f=0;(c=cfglookup[f].name[0]);f++) if(namec==c && strcmp(name,cfglookup[f].name)==0) { (*cfglookup[f].funcptr)(optarg,cfglookup[f].dataptr); found=1; break; } if(!found) fprintf(stderr, "long option not found in cfglookup[] - can't happen!\n"); } }while(ret!=-1);return(argc-optind);}void print_version(char *arg,void *dataptr){printf("zgv " ZGV_VER "\n");exit(0);}void usage_help(char *arg,void *dataptr){printf("zgv " ZGV_VER " - copyright (C) 1993-2001 Russell Marks.\n\n");puts("usage: zgv [options] [dir | file ...]\n""\n"" -A --auto-animate\n"" automatically animate multiple-image GIFs.\n"" This greatly limits how such images can be viewed,\n"" but can be useful for slideshows.\n"" --auto-mode-fit\n"" automatically switch modes to suit image size.\n"" -p --avoid-single-progress\n"" don't show progress indicator when loading a\n"" single file from the command-line.\n"" --black-background\n"" try to use a black background in the viewer when\n"" displaying an 8-bit image.\n"" -b --block-cursor use a blocky outline cursor, which is rather\n"" unsubtle but more obvious.\n"" --brightness adjust_val\n"" specify how much to add to colour values to\n"" change brightness (default 0).\n"" --centre (or --center)\n"" (normally enabled, use --centre=off to disable)\n"" if *disabled*, don't centre images onscreen.\n"" --clear-screen-on-exit\n"" clear text console's contents on exit.\n"" --col-black \"r g b\"\n"" set colour used for `black' (text) in selector;\n"" RGB values should be in the range 0-63 for this\n"" and the other colour settings below, and the\n"" three numbers should be quoted as shown.\n"" --col-dark \"r g b\"\n"" set colour used for lowlights in selector.\n"" --col-light \"r g b\"\n"" set colour used for highlights in selector.\n"" --col-medium \"r g b\"\n"" set colour used for background in selector.\n"" --col-tagged \"r g b\"\n"" set colour used for tagged files in selector.\n"" --contrast multiplier\n"" specify how much to multiply colour values by\n"" to change contrast (default 1.0).\n"" --delete-single-prompt\n"" (normally enabled, use --delete-single-prompt=off to\n"" disable) if *disabled*, don't prompt for confirmation\n"" when deleting a single file (with the Delete key).\n"" --delete-tagged-prompt\n"" (normally enabled, use --delete-tagged-prompt=off to\n"" disable) if *disabled*, don't prompt for confirmation\n"" when deleting tagged files (with `D').\n"" --dither-16col-fast\n"" (normally enabled, use --dither-16col-fast=off to\n"" disable) if *disabled*, use (much) slower but\n"" more accurate dithering in the viewer's 16-colour\n"" mode.\n"" --fake-cols (normally enabled, use --fake-cols=off to disable)\n"" if *disabled*, don't fake extra greyscales and\n"" colour depth in 8-bit modes.\n"" --force-fs-16col\n"" force the use of 16-colour mode for the selector.\n"" -j --force-viewer-8bit\n"" force all images to be loaded as 8-bit. Normally\n"" zgv will load 24-bit images (e.g. colour JPEGs)\n"" as 24-bit if you have any modes capable of\n"" displaying it in 15, 16, 24, or 32-bit colour.\n"" --fs-16col-colour-thumbnails (or --fs-16col-color-thumbnails)\n"" if using 16-colour mode for the selector,\n"" show dithered colour thumbnails (rather than mono).\n"" --fs-ignore-old-pos\n"" don't recall previous cursor position in a\n"" directory when returning to it later.\n"" --fs-magic use a slow, but precise (magic-number-based)\n"" method to identify picture files to list\n"" in the selector.\n"" --fs-perfect-cols\n"" don't tweak thumbnail colours to make the rest of\n"" the selector look right.\n"" --fs-slow-thumbnail-update\n"" show current cursor position at all times when\n"" updating thumbnails, which in most cases will\n"" make it markedly slower.\n"" --fs-small-text\n"" use smaller text than usual in the selector.\n"" --fs-start-mode modespec\n"" specify initial mode for the selector; the `modespec'\n"" should be the width, height, and depth in\n"" quotes, e.g. \"640 480 8\". Note that the depth\n"" specified is actually ignored (and forced to 8).\n"" -t --fs-thick-text\n"" use bold text in selector, which may be useful\n"" for those with mildly impaired vision (especially\n"" when combined with the `-b' option).\n"" -G --gamma val set gamma adjustment. The default is 1.0, i.e.\n"" no adjustment. (See info file or man page for\n"" details, and a discussion of gamma issues.)\n"" --gnulitically-correct\n"" GNU has POSIXLY_CORRECT for compatibility with\n"" silly POSIX misfeatures, and zgv has...\n"" -i --ignore-errors\n"" when loading a single file from the command-line,\n"" ignore (some) errors.\n"" --jpeg-index-style style\n"" specify how to read JPEGs when creating\n"" thumbnails (default 2):\n"" 1 = the quickest (but this sometimes generates\n"" rather fuzzy/blocky thumbnails);\n"" 2 = fairly cautious, but still quite fast;\n"" 3 = an extremely cautious and slow method.\n"" -J --jpeg-speed type\n"" set JPEG speed/quality tradeoff (default 2):\n"" 1 = floating-point - slow but accurate;\n"" 2 = slow integer - faster but not as accurate;\n"" 3 = fast integer - fastest but least accurate.\n"" -h --help give this usage help.\n"" --line-text use old line-based text.\n"" -M --mouse enable mouse support; this uses svgalib's mouse\n"" configuration, see the libvga.config(5) man page\n"" for details.\n"" --mouse-scale scale\n"" set the ratio of `mouse pixels' to onscreen pixels.\n"" In effect, sets the mouse speed. Defaults to 16.\n"" --pcd-res resnum\n"" set Photo-CD resolution to use, if support was\n"" enabled at compile-time. (See info file/man page\n"" for further details.)\n"" -g --pgm-truecol treat PGM files as 24-bit, ensuring that\n"" 256 separate greyscales can be shown if a 24-bit\n"" mode is available.\n"" --reverse-bc-order\n"" apply brightness modification before contrast.\n"" --revert-orient (normally enabled, use --revert-orient=off to disable)\n"" if *disabled*, orientation (flip/mirror/rotate) state\n"" is retained between pictures.\n"" --revert-scale (normally enabled, use --revert-scale=off to disable)\n"" if *disabled*, scaling is retained between pictures.\n"" --scrollbar show a scrollbar below the selector.\n"" --show-xvpics-dir\n"" show any `.xvpics' directory, so you can view\n"" thumbnails there even if the pictures they\n"" represent have been deleted.\n"" -T --show-tagged show names of tagged files on exit (they're listed\n"" to stdout).\n"" -S --slideshow-delay delay\n"" set the delay (in seconds) for which one picture\n"" in a slideshow is shown before reading the next.\n"" The default is 4.\n"" -l --slideshow-loop\n"" loop in slideshows `forever' (until you exit).\n"" -R --slideshow-randomise (or --slideshow-randomize)\n"" randomise order of pictures in slideshows.\n"" --viewer-16col-colour (or --viewer-16col-color)\n"" use a dithered colour display (rather than mono)\n"" in the viewer's 16-colour mode.\n"" -m --viewer-start-mode modespec\n"" specify initial mode for the viewer; the `modespec'\n"" should be the width, height, and depth in\n"" quotes, e.g. \"640 480 8\".\n"" --visual (normally enabled, use --visual=off to disable)\n"" if *disabled*, no thumbnails are shown.\n"" -k --vkludge smooth image when zoom mode is reducing a\n"" picture to fit the screen, and when in virtual\n"" modes.\n"" --version report version number.\n"" --xzgv-keys remap keys to (mostly) match those used in xzgv.\n"" -z --zoom fit picture to the full screen size, whatever the\n"" picture's actual size.\n"" --zoom-reduce-only\n"" when zooming, only *reduce* pictures to fit; i.e.\n"" make big pictures viewable all-at-once while leaving\n"" small pictures intact.\n""\n"" dir start zgv on a certain directory.\n"" file ... view (only) the file(s) specified. If more than\n"" one file is given, the files are viewed as a\n"" slideshow.\n""\n""All options are processed after any ~/.zgvrc or /etc/zgv.conf file.\n""Most long options (minus the `--') can used in either file with e.g.\n""`zoom on'. (But be sure to omit any quoting mentioned above in config\n""files.)\n""\n""On/off settings (such as zoom) are enabled by e.g. `-z' or `--zoom';\n""however, the long-option form `--option=off' can be used to disable\n""them (needed when they are enabled by default - revert-scale, for\n""example - or to override them being enabled in a config file).\n""\n""(This syntax actually lets you both disable *and* enable options,\n""using (for the arg after `=') on/off, y/n, yes/no, or 1/0.)");if(isatty(1)) printf("\n" "If this ridiculously long help text has just flown past :-), try\n" "`zgv -h |less' or similar.\n");exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -