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

📄 xdefaults.c

📁 Mrxvt是一个小巧
💻 C
📖 第 1 页 / 共 3 页
字号:
	RSTRG(Rs_pointerBlankDelay, "pointerBlankDelay", "number", 0),#endif#ifdef CURSOR_BLINK	BOOL(Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor", 0),	STRG(Rs_cursorBlinkInterval, "cursorBlinkInterval", "bci",		"number", "cursor blinking interval (ms)", 0),#endif#ifndef NO_BACKSPACE_KEY	RSTRG(Rs_backspace_key, "backspaceKey", "string", 0),#endif#ifndef NO_DELETE_KEY	RSTRG(Rs_delete_key, "deleteKey", "string", 0),#endif	RSTRG(Rs_selectstyle, "selectStyle",		"select style mode = old|oldword", 0),#ifdef PRINTPIPE	RSTRG(Rs_print_pipe, "printPipe", "string", 0),#endif	BOOL(Rs2_noSysConfig, "noSysConfig", "nsc",		Opt2_noSysConfig, "reading /etc/mrxvt/mrxvtrc.", 0),	BOOL(Rs2_disableMacros, "disableMacros", "dm",		Opt2_disableMacros, "all keyboard shortcuts (macros)", 0),	BOOL(Rs2_linuxHomeEndKey, "linuxHomeEndKey", "lk",		Opt2_linuxHomeEndKey, "enable Linux console Home/End keys", 0),	STRG(Rs_modifier, "modifier", "mod", "modifier",		"meta modifier = alt|meta|hyper|super|mod1|...|mod5", 0),	INFO("xrm", "string", "X resource"),#ifdef CUTCHAR_RESOURCE	RSTRG(Rs_cutchars, "cutChars", "string", 0),#endif	/* CUTCHAR_RESOURCE */#ifdef ACS_ASCII	RSTRG(Rs_acs_chars, "acsChars", "string", 0),#endif	/* ACS_ASCII */	RSTRG(Rs_answerbackstring, "answerbackString", "string", 0),#ifdef HAVE_X11_SM_SMLIB_H	BOOL(Rs2_enableSessionMgt, "sessionMgt", "sm",		Opt2_enableSessionMgt, "enabling X session management", 0),	STRG(Rs_smClientID, "smClientID", "sid", "string",		"client id of mrxvt for X session management", 0),#endif	/* HAVE_X11_SM_SMLIB_H */	/* Initial number of terminals */	STRG( Rs_init_term_num, "initTermNumber", "tnum", "number",		"Initial number of tabs/terminals", 0),	STRG( Rs_initProfiles, "initProfileList", "ip", "profile list",		"List of profiles to load on startup", 0 ),	INFO("e", "command arg ...", "command to execute")};#undef INFO#undef STRG#undef RSTRG#undef SWCH#undef BOOL/*}}} */static const char releasestring[] = "Mrxvt v" VERSION "\n";static const char optionsstring[] = "Options: "#if defined(BACKGROUND_IMAGE)# ifdef HAVE_LIBXPM	"XPM,"# endif# ifdef USE_JPEG	"Jpeg,"# endif# ifdef USE_JPEG	"PNG,"# endif#endif#if defined(TRANSPARENT)	"transparent,"#endif#if defined(OFF_FOCUS_FADING)	"fade,"#endif#if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT)# if defined(TINTING_SUPPORT)	"tint,"# endif#endif#if defined(TEXT_SHADOW)	"textshadow,"#endif#if defined(UTMP_SUPPORT)	"utmp,"#endif#if defined(HAVE_MENUBAR)	"menubar,"#endif#if defined(USE_XIM)	"XIM,"#endif#if defined(MULTICHAR_SET)	"multichar_languages,"#endif	"scrollbars="#if !defined(HAVE_SCROLLBARS)	"NONE"#else# if defined(RXVT_SCROLLBAR)	"rxvt"#  if defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(SGI_SCROLLBAR) || defined(PLAIN_SCROLLBAR)	"+"#  endif# endif	/* RXVT_SCROLLBAR */# if defined(NEXT_SCROLLBAR)	"NeXT"#  if defined(XTERM_SCROLLBAR) || defined(SGI_SCROLLBAR) || defined(PLAIN_SCROLLBAR)	"+"#  endif# endif	/* NEXT_SCROLLBAR */# if defined(XTERM_SCROLLBAR)	"xterm"#  if defined(SGI_SCROLLBAR) || defined(PLAIN_SCROLLBAR)    "+"#  endif# endif	/* XTERM_SCROLLBAR */# if defined(SGI_SCROLLBAR)	"sgi"#  if defined(PLAIN_SCROLLBAR)	"+"#  endif# endif	/* SGI_SCROLLBAR */# if defined(PLAIN_SCROLLBAR)	"plain"# endif	/* PLAIN_SCROLLBAR */#endif	/* HAVE_SCROLLBARS */	","#ifdef XFT_SUPPORT	"xft,"#endif#if defined(GREEK_SUPPORT)	"Greek,"#endif#if defined(NO_BACKSPACE_KEY)	"no_backspace,"#endif#if defined(NO_DELETE_KEY)	"no_delete,"#endif#ifdef OUR_STRINGS	"strings,"#endif#if !defined(NO_FRILLS)	"frills,"#endif#if !defined(NO_LINESPACE)	"linespace,"#endif#if defined(PREFER_24BIT)	"24bit,"#endif#if defined(SELECTION_SCROLLING)	"selectionscrolling,"#endif#if defined(TTY_256COLOR)	"256colour,"#endif#if defined(CURSOR_BLINK)	"cursorBlink,"#endif#if defined(POINTER_BLANK)	"pointerBlank,"#endif#ifdef HAVE_X11_SM_SMLIB_H	"session management,"#endif#if defined(NO_RESOURCES)	"NoResources"#else	"Resources"#endif	"\nUsage: ";		/* Usage */#define INDENT 24/* * Print usage and exit. *//* EXTPROTO */voidrxvt_usage(int type){	unsigned int	i, col;	write(STDOUT_FILENO, releasestring, sizeof(releasestring) - 1);	write(STDOUT_FILENO, optionsstring, sizeof(optionsstring) - 1);	write(STDOUT_FILENO, APL_NAME, sizeof(APL_NAME) - 1);	switch (type)	{		case 0:			/* brief listing */			fprintf(stdout, " [-help] [--help]\n");			for (col = 1, i = 0; i < optList_size(); i++)				if (optList[i].desc != NULL)				{					int			 len = 0;					if (!optList_isBool(i))					{						len = optList_STRLEN(i);						if (len > 0)							len++;	/* account for space */					}					assert(optList[i].opt != NULL);					len += 4 + STRLEN(optList[i].opt) +						(optList_isBool(i) ? 2: 0);					col += len;					if (col > 79)			/* assume regular width */					{						putc('\n', stdout);						col = 1 + len;					}					fprintf(stdout, " [-%s%s", (optList_isBool(i) ?						"/+" : ""), optList[i].opt);					if (optList_STRLEN(i))						fprintf(stdout, " %s]", optList[i].arg);					else						fprintf(stdout, "]");				}			break;		case 1:			/* full command-line listing */			fprintf(stdout, " [options] [-e command args]\n\n"				"where options include:\n");			for (i = 0; i < optList_size(); i++)				if (optList[i].desc != NULL)				{					assert(optList[i].opt != NULL);					fprintf(stdout, "  %s%s %-*s%s%s\n",						(optList_isBool(i) ? "-/+" : "-"), optList[i].opt,						(INDENT - STRLEN(optList[i].opt)						 + (optList_isBool(i) ? 0 : 2)),						(optList[i].arg ? optList[i].arg : ""),						(optList_isBool(i) ? "turn on/off " : ""),						optList[i].desc);				}			fprintf(stdout, "\n  --help to list long-options");			break;		case 2:			/* full resource listing */			fprintf(stdout,				" [options] [-e command args]\n\n"				"where resources (long-options) include:\n");#ifdef DEBUG_VERBOSE			/*			 * Print short options, long options and descriptions so we can generate			 * man page.			 */			for (i = 0; i < optList_size(); i++)				fprintf( stdout, "%3d. %s	%s	%s	%s	%d\n", i,						optList[i].kw ? optList[i].kw : "NullKW",						optList[i].opt ? optList[i].opt : "NullOpt",						!optList_isBool(i) ? optList[i].arg : "boolean",						optList[i].desc ? optList[i].desc : "NullDsc",						optList[i].multiple);#else			for (i = 0; i < optList_size(); i++)				if (optList[i].kw != NULL)					fprintf(stdout, "  %s: %*s%s\n",						optList[i].kw,						(INDENT - STRLEN(optList[i].kw)), "", /* XXX */						(optList_isBool(i) ? "boolean" : optList[i].arg));#endif			fprintf(stdout, "\n  -help to list options");			break;	}	/* switch */	fprintf(stdout, "\n\n");	exit(EXIT_FAILURE);	/* NOTREACHED */}/* INTPROTO */intnum_tabs( int len ){	return (len >=0 && len < 40) ? (40 - (len - (len%8)) ) / 8 : 0;}/* EXTPROTO */intrxvt_save_options (rxvt_t* r, const char* filename){	int			i;	FILE*		pf = fopen (filename, "w");	const char	*name = r->h->rs[Rs_name] ?: APL_NAME;	char		*tabs="\t\t\t\t\t";	if (NULL == pf)		return 0;		for (i = 0; i < optList_size(); i ++)	{		if (NULL == optList[i].kw)			continue;		if (-1 == optList[i].doff)			continue;		if( optList[i].multiple)		{			register int	j;			for (j = 0; j < MAX_PROFILES; j ++)			{				if (r->h->rs[optList[i].doff + j])					fprintf( pf, "%s.profile%d.%s:%.*s%s\n", name,						j, optList[i].kw,						num_tabs( STRLEN(name) + sizeof(".profile") + 2									+ STRLEN( optList[i].kw ) ), tabs,						r->h->rs[optList[i].doff +j]);			}		}		else if (optList_isBool(i))		{			int		bval;			char*	OnOff[2] = {"False", "True"};			if (optList[i].doff < Rs_options2)				bval = (r->Options & optList[i].flag) ? 1 : 0;			else				bval = (r->Options2 & optList[i].flag) ? 1 : 0;			if (optList_isReverse(i))				bval = !bval;			fprintf( pf, "%s.%s:%.*s%s\n", name,				optList[i].kw,				num_tabs( STRLEN(name) + 1 + STRLEN(optList[i].kw) + 1 ), tabs,				OnOff[bval] );		}		else if (r->h->rs[optList[i].doff])		{			fprintf( pf, "%s.%s:%.*s%s\n", name,				optList[i].kw,				num_tabs( STRLEN(name) + 1 + STRLEN(optList[i].kw) + 1 ), tabs,				r->h->rs[optList[i].doff] );		}	}	fputs( "\n\n# vim: set ft=mrxvtrc :\n", pf );	fclose (pf);	return 1;}/* * Process command line options. *//* EXTPROTO */voidrxvt_get_options(rxvt_t *r, int argc, const char *const *argv){	DBG_MSG( 2, (stderr, "rxvt_get_options()\n") );	int			 i, bad_option = 0;	static const char On[3] = "ON", Off[4] = "OFF";	for (i = 1; i < argc; i++)	{		unsigned int	entry, longopt = 0;		const char		*flag, *opt;		int				profileNum;		opt = argv[i];		profileNum = 0;	/* initialize profileNum to 0 by default */		DBG_MSG(1, (stderr, "argv[%d] = %s: ", i, opt));		if (*opt == '-')		{			flag = On;			if (*++opt == '-')				longopt = *opt++;	/* long option */		}		else if (*opt == '+')		{			flag = Off;			if (*++opt == '+')				longopt = *opt++;	/* long option */		}		else		{			bad_option = 1;			rxvt_print_error("bad option \"%s\"", opt);			continue;		}		if (!STRCMP(opt, "help"))			rxvt_usage(longopt ? 2 : 1);		if (!STRCMP(opt, "h"))			rxvt_usage(0);		/* feature: always try to match long-options */		for (entry = 0; entry < optList_size(); entry++)		{			char			buflong[256];			char			bufshort[128];			/* initialize it to empty string */			buflong[0]	= '\0';			bufshort[0] = '\0';			/*			 * Get the long option name in buflong, or the short option name in			 * bufshort.			 */			if ( optList[entry].multiple )			{				int offset = 0;				/*				 * For backward compatibility, accept vt%d style options.				 */				offset = rxvt_str_match( opt, "vt" );				if( offset == 0 )					offset = rxvt_str_match( opt, "profile" );				/*				 * Copy --profile%d.resource or --vt%d.resource into buflong and				 * bufshort.				 */				if( offset )				{					profileNum = atoi( opt + offset );					if( profileNum < 0 || profileNum >= MAX_PROFILES )					{						entry = optList_size();						break;	/* out of range, jump to bad option */					}					snprintf( buflong, sizeof(buflong)-1, "%.*s%d.%s",							offset, opt, profileNum, optList[entry].kw );					buflong[sizeof(buflong)-1] = '\0';					snprintf( bufshort, sizeof(bufshort)-1, "%.*s%d.%s",							offset, opt, profileNum, optList[entry].opt );					bufshort[sizeof(bufshort)-1] = '\0';					DBG_MSG( 3, ( stderr,								"Matched profile=%d buflong=%s bufshort=%s\n",								profileNum, buflong, bufshort ) );				}				/* If no profile number is specified, use 0 by default */				else				{					STRNCPY( buflong, optList[entry].kw, sizeof(buflong) - 1 );					buflong[ sizeof(buflong)-1 ] = '\0';					STRNCPY( bufshort, optList[entry].opt, sizeof(bufshort)-1 );					bufshort[ sizeof(bufshort)-1 ] = '\0';					profileNum = 0;					DBG_MSG( 3, ( stderr,								"Matched default buflong=%s bufshort=%s\n",								buflong, bufshort ) );				}			}			else if (optList[entry].kw)			{				STRNCPY (buflong, optList[entry].kw, sizeof(buflong)-1);				buflong[sizeof(buflong)-1] = '\0';				if (optList[entry].opt)				{					STRNCPY (bufshort, optList[entry].opt,						sizeof(bufshort)-1);					bufshort[sizeof(bufshort)-1] = '\0';				}			}			else if (optList[entry].opt)			{				/* here NULL == optList[entry].kw */

⌨️ 快捷键说明

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