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

📄 sltermin.c

📁 一个C格式的脚本处理函数库源代码,可让你的C程序具有执行C格式的脚本文件
💻 C
📖 第 1 页 / 共 4 页
字号:
   {"es", 16		UNTIC_COMMENT("escape can be used on the status line")},   {"gn", 6		UNTIC_COMMENT("generic line type")},   {"hc", 7		UNTIC_COMMENT("hardcopy terminal")},   {"hl", 29		UNTIC_COMMENT("terminal uses only HLS color notation (tektronix)")},   {"hs", 9		UNTIC_COMMENT("has extra status line")},   {"hz", 18		UNTIC_COMMENT("can't print ~'s (hazeltine)")},   {"in", 10		UNTIC_COMMENT("insert mode distinguishes nulls")},   {"km", 8		UNTIC_COMMENT("Has a meta key, sets msb high")},   {"mi", 13		UNTIC_COMMENT("safe to move while in insert mode")},   {"ms", 14		UNTIC_COMMENT("safe to move while in standout mode")},   {"nc", 39		UNTIC_COMMENT("no way to go to start of line")},   {"ns", 38		UNTIC_COMMENT("crt cannot scroll")},   {"nx", 21		UNTIC_COMMENT("padding won't work, xon/xoff required")},   {"os", 15		UNTIC_COMMENT("terminal can overstrike")},   {"pt", 42		UNTIC_COMMENT("has 8-char tabs invoked with ^I")},   {"ul", 19		UNTIC_COMMENT("underline character overstrikes")},   {"ut", 28		UNTIC_COMMENT("screen erased with background color")},   {"xb", 2		UNTIC_COMMENT("beehive (f1=escape, f2=ctrl C)")},   {"xn", 4		UNTIC_COMMENT("newline ignored after 80 cols (concept)")},   {"xo", 20		UNTIC_COMMENT("terminal uses xon/xoff handshaking")},   {"xr", 43		UNTIC_COMMENT("return clears the line")},   {"xs", 3		UNTIC_COMMENT("standout not erased by overwriting (hp)")},   {"xt", 17		UNTIC_COMMENT("tabs destructive, magic so char (t1061)")},   {"", -1		UNTIC_COMMENT(NULL)}};int _SLtt_tigetflag (SLterminfo_Type *t, char *cap){   int offset;   if (t == NULL) return -1;   if (t->flags == SLTERMCAP) return tcap_getflag (cap, t);   offset = compute_cap_offset (cap, t, Tgetflag_Map, t->boolean_section_size);   if (offset < 0) return -1;   return (int) *(t->boolean_flags + offset);}/* These are my termcap routines.  They only work with the TERMCAP environment * variable.  This variable must contain the termcap entry and NOT the file. */static int tcap_getflag (char *cap, SLterminfo_Type *t){   char a, b;   char *f = (char *) t->boolean_flags;   char *fmax;   if (f == NULL) return 0;   fmax = f + t->boolean_section_size;   a = *cap;   b = *(cap + 1);   while (f < fmax)     {	if ((a == f[0]) && (b == f[1]))	  return 1;	f += 2;     }   return 0;}static char *tcap_get_cap (unsigned char *cap, unsigned char *caps, unsigned int len){   unsigned char c0, c1;   unsigned char *caps_max;   c0 = cap[0];   c1 = cap[1];   if (caps == NULL) return NULL;   caps_max = caps + len;   while (caps < caps_max)     {	if ((c0 == caps[0]) && (c1 == caps[1]))	  {	     return (char *) caps + 3;	  }	caps += (int) caps[2];     }   return NULL;}static int tcap_getnum (char *cap, SLterminfo_Type *t){   cap = tcap_get_cap ((unsigned char *) cap, t->numbers, t->num_numbers);   if (cap == NULL) return -1;   return atoi (cap);}static char *tcap_getstr (char *cap, SLterminfo_Type *t){   return tcap_get_cap ((unsigned char *) cap, (unsigned char *) t->string_table, t->string_table_size);}static int tcap_extract_field (unsigned char *t0){   register unsigned char ch, *t = t0;   while (((ch = *t) != 0) && (ch != ':')) t++;   if (ch == ':') return (int) (t - t0);   return -1;}int SLtt_Try_Termcap = 1;static int tcap_getent (char *term, SLterminfo_Type *ti){   unsigned char *termcap, ch;   unsigned char *buf, *b;   unsigned char *t;   int len;   if (SLtt_Try_Termcap == 0) return -1;#if 1   /* XFREE86 xterm sets the TERMCAP environment variable to an invalid    * value.  Specifically, it lacks the tc= string.    */   if (!strncmp (term, "xterm", 5))     return -1;#endif   termcap = (unsigned char *) getenv ("TERMCAP");   if ((termcap == NULL) || (*termcap == '/')) return -1;   /* SUN Solaris 7&8 have bug in tset program under tcsh,    * eval `tset -s -A -Q` sets value of TERMCAP to ":",    *  under other shells it works fine.    *  SUN was informed, they marked it as duplicate of bug 4086585    *  but didn't care to fix it... <mikkopa@cs.tut.fi>     */   if ((termcap[0] == ':') && (termcap[1] == 0))     return -1;         /* We have a termcap so lets use it provided it does not have a reference    * to another terminal via tc=.  In that case, use terminfo.  The alternative    * would be to parse the termcap file which I do not want to do right now.    * Besides, this is a terminfo based system and if the termcap were parsed    * terminfo would almost never get a chance to run.  In addition, the tc=    * thing should not occur if tset is used to set the termcap entry.    */   t = termcap;   while ((len = tcap_extract_field (t)) != -1)     {	if ((len > 3) && (t[0] == 't') && (t[1] == 'c') && (t[2] == '='))	  return -1;	t += (len + 1);     }   /* malloc some extra space just in case it is needed. */   len = strlen ((char *) termcap) + 256;   if (NULL == (buf = (unsigned char *) SLmalloc ((unsigned int) len))) return -1;   b = buf;   /* The beginning of the termcap entry contains the names of the entry.    * It is terminated by a colon.    */   ti->terminal_names = (char *) b;   t = termcap;   len = tcap_extract_field (t);   if (len < 0)     {	SLfree ((char *)buf);	return -1;     }   strncpy ((char *) b, (char *) t, (unsigned int) len);   b[len] = 0;   b += len + 1;   ti->name_section_size = len;   /* Now, we are really at the start of the termcap entries.  Point the    * termcap variable here since we want to refer to this a number of times.    */   termcap = t + (len + 1);   /* Process strings first. */   ti->string_table = (char *) b;   t = termcap;   while (-1 != (len = tcap_extract_field (t)))     {	unsigned char *b1;	unsigned char *tmax;	/* We are looking for: XX=something */	if ((len < 4) || (t[2] != '=') || (*t == '.'))	  {	     t += len + 1;	     continue;	  }	tmax = t + len;	b1 = b;	while (t < tmax)	  {	     ch = *t++;	     if ((ch == '\\') && (t < tmax))	       {		  t = (unsigned char *) _SLexpand_escaped_char ((char *) t, (char *) &ch);	       }	     else if ((ch == '^') && (t < tmax))	       {		  ch = *t++;		  if (ch == '?') ch = 127;		  else ch = (ch | 0x20) - ('a' - 1);	       }	     *b++ = ch;	  }	/* Null terminate it. */	*b++ = 0;	len = (int) (b - b1);	b1[2] = (unsigned char) len;    /* replace the = by the length */	/* skip colon to next field. */	t++;     }   ti->string_table_size = (int) (b - (unsigned char *) ti->string_table);   /* Now process the numbers. */   t = termcap;   ti->numbers = b;   while (-1 != (len = tcap_extract_field (t)))     {	unsigned char *b1;	unsigned char *tmax;	/* We are looking for: XX#NUMBER */	if ((len < 4) || (t[2] != '#') || (*t == '.'))	  {	     t += len + 1;	     continue;	  }	tmax = t + len;	b1 = b;	while (t < tmax)	  {	     *b++ = *t++;	  }	/* Null terminate it. */	*b++ = 0;	len = (int) (b - b1);	b1[2] = (unsigned char) len;    /* replace the # by the length */	t++;     }   ti->num_numbers = (int) (b - ti->numbers);   /* Now process the flags. */   t = termcap;   ti->boolean_flags = b;   while (-1 != (len = tcap_extract_field (t)))     {	/* We are looking for: XX#NUMBER */	if ((len != 2) || (*t == '.') || (*t <= ' '))	  {	     t += len + 1;	     continue;	  }	b[0] = t[0];	b[1] = t[1];	t += 3;	b += 2;     }   ti->boolean_section_size = (int) (b - ti->boolean_flags);   ti->flags = SLTERMCAP;   return 0;}/* These routines are provided only for backward binary compatability. * They will vanish in V2.x */char *SLtt_tigetent (char *s){   return (char *) _SLtt_tigetent (s);}extern char *SLtt_tigetstr (char *s, char **p){   if (p == NULL)     return NULL;   return _SLtt_tigetstr ((SLterminfo_Type *) *p, s);}extern int SLtt_tigetnum (char *s, char **p){   if (p == NULL)     return -1;   return _SLtt_tigetnum ((SLterminfo_Type *) *p, s);}

⌨️ 快捷键说明

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