[BACK]Return to dump_entry.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tic

Diff for /src/usr.bin/tic/dump_entry.c between version 1.1 and 1.2

version 1.1, 1998/07/27 03:26:10 version 1.2, 1998/11/03 21:59:53
Line 1 
Line 1 
   /*      $OpenBSD$       */
   
 /****************************************************************************  /****************************************************************************
  * Copyright (c) 1998 Free Software Foundation, Inc.                        *   * Copyright (c) 1998 Free Software Foundation, Inc.                        *
  *                                                                          *   *                                                                          *
Line 38 
Line 40 
 #include <termsort.c>           /* this C file is generated */  #include <termsort.c>           /* this C file is generated */
 #include <parametrized.h>       /* so is this */  #include <parametrized.h>       /* so is this */
   
 MODULE_ID("$Id$")  MODULE_ID("$From: dump_entry.c,v 1.29 1998/09/26 13:15:00 tom Exp $")
   
 #define INDENT                  8  #define INDENT                  8
   
   #define DISCARD(string) string = ABSENT_STRING
   
 static int tversion;            /* terminfo version */  static int tversion;            /* terminfo version */
 static int outform;             /* output format to use */  static int outform;             /* output format to use */
 static int sortmode;            /* sort mode to use */  static int sortmode;            /* sort mode to use */
Line 451 
Line 455 
 int fmt_entry(TERMTYPE *tterm,  int fmt_entry(TERMTYPE *tterm,
                            int (*pred)(int type, int idx),                             int (*pred)(int type, int idx),
                            bool suppress_untranslatable,                             bool suppress_untranslatable,
                            bool infodump)                             bool infodump,
                              bool numbers)
 {  {
 int     i, j;  int     i, j;
 char    buffer[MAX_TERMINFO_LENGTH];  char    buffer[MAX_TERMINFO_LENGTH];
Line 557 
Line 562 
          * them to be output as defined and empty.           * them to be output as defined and empty.
          */           */
         if (outform==F_TERMCAP)          if (outform==F_TERMCAP)
           {
 #undef CUR  #undef CUR
 #define CUR tterm->  #define CUR tterm->
             if (insert_character || parm_ich)              if (insert_character || parm_ich)
Line 576 
Line 582 
                 }                  }
             }              }
   
               if (init_3string != 0
                && termcap_reset != 0
                && !strcmp(init_3string, termcap_reset))
                   DISCARD(init_3string);
   
               if (reset_2string != 0
                && termcap_reset != 0
                && !strcmp(reset_2string, termcap_reset))
                   DISCARD(reset_2string);
           }
   
         predval = pred(STRING, i);          predval = pred(STRING, i);
         buffer[0] = '\0';          buffer[0] = '\0';
         if (predval != FAIL) {          if (predval != FAIL) {
Line 586 
Line 603 
                 sprintf(buffer, "%s@", str_names[i]);                  sprintf(buffer, "%s@", str_names[i]);
             else if (outform == F_TERMCAP || outform == F_TCONVERR)              else if (outform == F_TERMCAP || outform == F_TCONVERR)
             {              {
                 char *srccap = _nc_tic_expand(tterm->Strings[i], FALSE);                  char *srccap = _nc_tic_expand(tterm->Strings[i], FALSE, numbers);
                 char *cv = _nc_infotocap(str_names[i], srccap, parametrized[i]);                  char *cv = _nc_infotocap(str_names[i], srccap, parametrized[i]);
   
                 if (cv == 0)                  if (cv == 0)
Line 604 
Line 621 
             }              }
             else              else
             {              {
                 char *src = _nc_tic_expand(tterm->Strings[i], outform==F_TERMINFO);                  char *src = _nc_tic_expand(tterm->Strings[i], outform==F_TERMINFO, numbers);
                 sprintf(buffer, "%s=", str_names[i]);                  sprintf(buffer, "%s=", str_names[i]);
                 if (pretty && outform==F_TERMINFO)                  if (pretty && outform==F_TERMINFO)
                     fmt_complex(buffer + strlen(buffer), src, 1);                      fmt_complex(buffer + strlen(buffer), src, 1);
Line 663 
Line 680 
             if (box_ok)              if (box_ok)
             {              {
                 (void) strcpy(buffer, "box1=");                  (void) strcpy(buffer, "box1=");
                 (void) strcat(buffer, _nc_tic_expand(boxchars, outform==F_TERMINFO));                  (void) strcat(buffer, _nc_tic_expand(boxchars, outform==F_TERMINFO, numbers));
                 WRAP_CONCAT;                  WRAP_CONCAT;
             }              }
         }          }
Line 708 
Line 725 
     return(infodump ? len : termcap_length(outbuf));      return(infodump ? len : termcap_length(outbuf));
 }  }
   
 int dump_entry(TERMTYPE *tterm, bool limited, int (*pred)(int type, int idx))  int dump_entry(TERMTYPE *tterm, bool limited, bool numbers, int (*pred)(int type, int idx))
 /* dump a single entry */  /* dump a single entry */
 {  {
     int len, critlen;      int len, critlen;
Line 729 
Line 746 
         infodump = TRUE;          infodump = TRUE;
     }      }
   
     if (((len = fmt_entry(tterm, pred, FALSE, infodump)) > critlen) && limited)      if (((len = fmt_entry(tterm, pred, FALSE, infodump, numbers)) > critlen) && limited)
     {      {
         (void) printf("# (untranslatable capabilities removed to fit entry within %d bytes)\n",          (void) printf("# (untranslatable capabilities removed to fit entry within %d bytes)\n",
                       critlen);                        critlen);
         if ((len = fmt_entry(tterm, pred, TRUE, infodump)) > critlen)          if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen)
         {          {
             /*              /*
              * We pick on sgr because it's a nice long string capability that               * We pick on sgr because it's a nice long string capability that
Line 743 
Line 760 
             set_attributes = ABSENT_STRING;              set_attributes = ABSENT_STRING;
             (void) printf("# (sgr removed to fit entry within %d bytes)\n",              (void) printf("# (sgr removed to fit entry within %d bytes)\n",
                           critlen);                            critlen);
             if ((len = fmt_entry(tterm, pred, TRUE, infodump)) > critlen)              if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen)
             {              {
                 int oldversion = tversion;                  int oldversion = tversion;
   
Line 751 
Line 768 
                 (void) printf("# (terminfo-only capabilities suppressed to fit entry within %d bytes)\n",                  (void) printf("# (terminfo-only capabilities suppressed to fit entry within %d bytes)\n",
                               critlen);                                critlen);
   
                 if ((len = fmt_entry(tterm, pred, TRUE, infodump)) > critlen)                  if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen)
                 {                  {
                     (void) fprintf(stderr,                      (void) fprintf(stderr,
                                "warning: %s entry is %d bytes long\n",                                 "warning: %s entry is %d bytes long\n",

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2