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

📄 info-utils.c

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 C
📖 第 1 页 / 共 2 页
字号:
    return (ref2);  else if (!ref2)    return (ref1);  /* Get the total size of the slots that we will need. */  for (i = 0; ref1[i]; i++);  size = i;  for (i = 0; ref2[i]; i++);  size += i;  result = (REFERENCE **)xmalloc ((1 + size) * sizeof (REFERENCE *));  /* Copy the contents over. */  for (i = 0; ref1[i]; i++)    result[i] = ref1[i];  j = i;  for (i = 0; ref2[i]; i++)    result[j++] = ref2[i];  result[j] = (REFERENCE *)NULL;  free (ref1);  free (ref2);  return (result);}/* Free the data associated with REFERENCES. */voidinfo_free_references (references)     REFERENCE **references;{  register int i;  REFERENCE *entry;  if (references)    {      for (i = 0; references && (entry = references[i]); i++)        {          maybe_free (entry->label);          maybe_free (entry->filename);          maybe_free (entry->nodename);          free (entry);        }      free (references);    }}/* Search for sequences of whitespace or newlines in STRING, replacing   all such sequences with just a single space.  Remove whitespace from   start and end of string. */voidcanonicalize_whitespace (string)     char *string;{  register int i, j;  int len, whitespace_found, whitespace_loc;  char *temp;  if (!string)    return;  len = strlen (string);  temp = (char *)xmalloc (1 + len);  /* Search for sequences of whitespace or newlines.  Replace all such     sequences in the string with just a single space. */  whitespace_found = 0;  for (i = 0, j = 0; string[i]; i++)    {      if (whitespace_or_newline (string[i]))        {          whitespace_found++;          whitespace_loc = i;          continue;        }      else        {          if (whitespace_found && whitespace_loc)            {              whitespace_found = 0;              /* Suppress whitespace at start of string. */              if (j)                temp[j++] = ' ';            }          temp[j++] = string[i];        }    }  /* Kill trailing whitespace. */  if (j && whitespace (temp[j - 1]))    j--;  temp[j] = '\0';  strcpy (string, temp);  free (temp);}/* String representation of a char returned by printed_representation (). */static char the_rep[10];/* Return a pointer to a string which is the printed representation   of CHARACTER if it were printed at HPOS. */char *printed_representation (character, hpos)     unsigned char character;     int hpos;{  register int i = 0;  int printable_limit;  if (ISO_Latin_p)    printable_limit = 160;  else    printable_limit = 127;  if (character == '\177')    {      the_rep[i++] = '^';      the_rep[i++] = '?';    }  else if (iscntrl (character))    {      switch (character)        {        case '\r':        case '\n':          the_rep[i++] = character;          break;        case '\t':          {            int tw;            tw = ((hpos + 8) & 0xf8) - hpos;            while (i < tw)              the_rep[i++] = ' ';          }          break;        default:          the_rep[i++] = '^';          the_rep[i++] = (character | 0x40);        }    }  else if (character > printable_limit)    {      sprintf (the_rep + i, "\\%0o", character);      i = strlen (the_rep);    }  else    the_rep[i++] = character;  the_rep[i] = '\0';  return (the_rep);}/* **************************************************************** *//*                                                                  *//*                  Functions Static To This File                   *//*                                                                  *//* **************************************************************** *//* Amount of space allocated to INFO_PARSED_FILENAME via xmalloc (). */static int parsed_filename_size = 0;/* Amount of space allocated to INFO_PARSED_NODENAME via xmalloc (). */static int parsed_nodename_size = 0;static void save_string (), saven_string ();/* Remember FILENAME in PARSED_FILENAME.  An empty FILENAME is translated   to a NULL pointer in PARSED_FILENAME. */static voidsave_filename (filename)     char *filename;{  save_string (filename, &info_parsed_filename, &parsed_filename_size);}/* Just like save_filename (), but you pass the length of the string. */static voidsaven_filename (filename, len)     char *filename;     int len;{  saven_string (filename, len,                &info_parsed_filename, &parsed_filename_size);}/* Remember NODENAME in PARSED_NODENAME.  An empty NODENAME is translated   to a NULL pointer in PARSED_NODENAME. */static voidsave_nodename (nodename)     char *nodename;{  save_string (nodename, &info_parsed_nodename, &parsed_nodename_size);}/* Just like save_nodename (), but you pass the length of the string. */static voidsaven_nodename (nodename, len)     char *nodename;     int len;{  saven_string (nodename, len,                &info_parsed_nodename, &parsed_nodename_size);}/* Remember STRING in STRING_P.  STRING_P should currently have STRING_SIZE_P   bytes allocated to it.  An empty STRING is translated to a NULL pointer   in STRING_P. */static voidsave_string (string, string_p, string_size_p)     char *string;     char **string_p;     int *string_size_p;{  if (!string || !*string)    {      if (*string_p)        free (*string_p);      *string_p = (char *)NULL;      *string_size_p = 0;    }  else    {      if (strlen (string) >= *string_size_p)        *string_p = (char *)xrealloc          (*string_p, (*string_size_p = 1 + strlen (string)));      strcpy (*string_p, string);    }}/* Just like save_string (), but you also pass the length of STRING. */static voidsaven_string (string, len, string_p, string_size_p)     char *string;     int len;     char **string_p;     int *string_size_p;{  if (!string)    {      if (*string_p)        free (*string_p);      *string_p = (char *)NULL;      *string_size_p = 0;    }  else    {      if (len >= *string_size_p)        *string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len));      strncpy (*string_p, string, len);      (*string_p)[len] = '\0';    }}/* Return a pointer to the part of PATHNAME that simply defines the file. */char *filename_non_directory (pathname)     char *pathname;{  char *filename;  filename = (char *) strrchr (pathname, '/');  if (filename)    filename++;  else    filename = pathname;  return (filename);}/* Return non-zero if NODE is one especially created by Info. */intinternal_info_node_p (node)     NODE *node;{#if defined (NEVER)  if (node &&      (node->filename && !*node->filename) &&      !node->parent && node->nodename)    return (1);  else    return (0);#else  return ((node != (NODE *)NULL) && ((node->flags & N_IsInternal) != 0));#endif /* !NEVER */}/* Make NODE appear to be one especially created by Info. */voidname_internal_node (node, name)     NODE *node;     char *name;{  if (!node)    return;  node->filename = "";  node->parent = (char *)NULL;  node->nodename = name;  node->flags |= N_IsInternal;}/* Return the window displaying NAME, the name of an internally created   Info window. */WINDOW *get_internal_info_window (name)     char *name;{  WINDOW *win;  for (win = windows; win; win = win->next)    if (internal_info_node_p (win->node) &&        (strcmp (win->node->nodename, name) == 0))      break;  return (win);}

⌨️ 快捷键说明

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