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

Diff for /src/usr.bin/man/Attic/man.c between version 1.28 and 1.29

version 1.28, 2004/02/23 14:14:14 version 1.29, 2005/10/17 19:08:46
Line 187 
Line 187 
         if (p_path == NULL)          if (p_path == NULL)
                 p_path = getenv("MANPATH");                  p_path = getenv("MANPATH");
         if (p_path != NULL) {          if (p_path != NULL) {
                 while ((e_defp = defp->list.tqh_first) != NULL) {                  while ((e_defp = TAILQ_FIRST(&defp->list)) != NULL) {
                         free(e_defp->s);                          free(e_defp->s);
                         TAILQ_REMOVE(&defp->list, e_defp, q);                          TAILQ_REMOVE(&defp->list, e_defp, q);
                 }                  }
Line 195 
Line 195 
                     p != NULL; p = strtok(NULL, ":")) {                      p != NULL; p = strtok(NULL, ":")) {
                         slashp = p[strlen(p) - 1] == '/' ? "" : "/";                          slashp = p[strlen(p) - 1] == '/' ? "" : "/";
                         e_subp = (subp = getlist("_subdir")) == NULL ?                          e_subp = (subp = getlist("_subdir")) == NULL ?
                             NULL : subp->list.tqh_first;                              NULL : TAILQ_FIRST(&subp->list);
                         for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {                          for (; e_subp != NULL; e_subp = TAILQ_NEXT(e_subp, q)) {
                                 (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",                                  (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
                                     p, slashp, e_subp->s, machine);                                      p, slashp, e_subp->s, machine);
                                 if ((ep = malloc(sizeof(ENTRY))) == NULL ||                                  if ((ep = malloc(sizeof(ENTRY))) == NULL ||
Line 221 
Line 221 
         }          }
         if (p_path == NULL && section == NULL) {          if (p_path == NULL && section == NULL) {
                 defnewp = addlist("_default_new");                  defnewp = addlist("_default_new");
                 e_defp =                  e_defp = TAILQ_FIRST(&defp->list);
                     defp->list.tqh_first == NULL ? NULL : defp->list.tqh_first;                  for (; e_defp != NULL; e_defp = TAILQ_NEXT(e_defp, q)) {
                 for (; e_defp != NULL; e_defp = e_defp->q.tqe_next) {  
                         slashp =                          slashp =
                             e_defp->s[strlen(e_defp->s) - 1] == '/' ? "" : "/";                              e_defp->s[strlen(e_defp->s) - 1] == '/' ? "" : "/";
                         e_subp = (subp = getlist("_subdir")) == NULL ?                          e_subp = (subp = getlist("_subdir")) == NULL ?
                             NULL : subp->list.tqh_first;                              NULL : TAILQ_FIRST(&subp->list);
                         for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {                          for (; e_subp != NULL; e_subp = TAILQ_NEXT(e_subp, q)) {
                                 (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",                                  (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
                                 e_defp->s, slashp, e_subp->s, machine);                                  e_defp->s, slashp, e_subp->s, machine);
                                 if ((ep = malloc(sizeof(ENTRY))) == NULL ||                                  if ((ep = malloc(sizeof(ENTRY))) == NULL ||
Line 238 
Line 237 
                         }                          }
                 }                  }
                 defp = getlist("_default");                  defp = getlist("_default");
                 while ((e_defp = defp->list.tqh_first) != NULL) {                  while ((e_defp = TAILQ_FIRST(&defp->list)) != NULL) {
                         free(e_defp->s);                          free(e_defp->s);
                         TAILQ_REMOVE(&defp->list, e_defp, q);                          TAILQ_REMOVE(&defp->list, e_defp, q);
                 }                  }
Line 260 
Line 259 
                 for (p = strtok(p_add, ":"); p != NULL; p = strtok(NULL, ":")) {                  for (p = strtok(p_add, ":"); p != NULL; p = strtok(NULL, ":")) {
                         slashp = p[strlen(p) - 1] == '/' ? "" : "/";                          slashp = p[strlen(p) - 1] == '/' ? "" : "/";
                         e_subp = (subp = getlist("_subdir")) == NULL ?                          e_subp = (subp = getlist("_subdir")) == NULL ?
                             NULL : subp->list.tqh_first;                              NULL : TAILQ_FIRST(&subp->list);
                         for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {                          for (; e_subp != NULL; e_subp = TAILQ_NEXT(e_subp, q)) {
                                 (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",                                  (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
                                     p, slashp, e_subp->s, machine);                                      p, slashp, e_subp->s, machine);
                                 if ((ep = malloc(sizeof(ENTRY))) == NULL ||                                  if ((ep = malloc(sizeof(ENTRY))) == NULL ||
Line 280 
Line 279 
                 }                  }
                 if (e_sectp != NULL) { /* entries added, fix order */                  if (e_sectp != NULL) { /* entries added, fix order */
                         /* save original head */                          /* save original head */
                         ep->q.tqe_next = defp->list.tqh_first;                          TAILQ_NEXT(ep, q) = TAILQ_FIRST(&defp->list);
                         /* first added entry, new top */                          /* first added entry, new top */
                         defp->list.tqh_first = e_sectp;                          TAILQ_FIRST(&defp->list) = e_sectp;
                         /* terminate list */                          /* terminate list */
                         *e_sectp->q.tqe_prev = NULL;                          *e_sectp->q.tqe_prev = NULL;
                 }                  }
Line 294 
Line 293 
          */           */
         if (p_add == NULL && section != NULL) {          if (p_add == NULL && section != NULL) {
                 sectnewp = addlist("_section_new");                  sectnewp = addlist("_section_new");
                 for (e_sectp = section->list.tqh_first;                  TAILQ_FOREACH(e_sectp, &section->list, q) {
                     e_sectp != NULL; e_sectp = e_sectp->q.tqe_next) {  
                         if (e_sectp->s[strlen(e_sectp->s) - 1] != '/') {                          if (e_sectp->s[strlen(e_sectp->s) - 1] != '/') {
                                 (void)snprintf(buf, sizeof(buf),                                  (void)snprintf(buf, sizeof(buf),
                                     "%s{/%s,}", e_sectp->s, machine);                                      "%s{/%s,}", e_sectp->s, machine);
Line 306 
Line 304 
                                 continue;                                  continue;
                         }                          }
                         e_subp = (subp = getlist("_subdir")) == NULL ?                          e_subp = (subp = getlist("_subdir")) == NULL ?
                             NULL : subp->list.tqh_first;                              NULL : TAILQ_FIRST(&subp->list);
                         for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {                          for (; e_subp != NULL; e_subp = TAILQ_NEXT(e_subp, q)) {
                                 (void)snprintf(buf, sizeof(buf), "%s%s{/%s,}",                                  (void)snprintf(buf, sizeof(buf), "%s%s{/%s,}",
                                     e_sectp->s, e_subp->s, machine);                                      e_sectp->s, e_subp->s, machine);
                                 if ((ep = malloc(sizeof(ENTRY))) == NULL ||                                  if ((ep = malloc(sizeof(ENTRY))) == NULL ||
Line 420 
Line 418 
         buf[0] = '*';          buf[0] = '*';
   
         /* For each element in the list... */          /* For each element in the list... */
         e_tag = tag == NULL ? NULL : tag->list.tqh_first;          e_tag = tag == NULL ? NULL : TAILQ_FIRST(&tag->list);
         for (; e_tag != NULL; e_tag = e_tag->q.tqe_next) {          for (; e_tag != NULL; e_tag = TAILQ_NEXT(e_tag, q)) {
                 (void)snprintf(buf, sizeof(buf), "%s/%s.*", e_tag->s, page);                  (void)snprintf(buf, sizeof(buf), "%s/%s.*", e_tag->s, page);
                 if (glob(buf,                  if (glob(buf,
                     GLOB_APPEND | GLOB_BRACE | GLOB_NOSORT | GLOB_QUOTE,                      GLOB_APPEND | GLOB_BRACE | GLOB_NOSORT | GLOB_QUOTE,
Line 451 
Line 449 
                                 goto next;                                  goto next;
   
                         e_sufp = (sufp = getlist("_suffix")) == NULL ?                          e_sufp = (sufp = getlist("_suffix")) == NULL ?
                             NULL : sufp->list.tqh_first;                              NULL : TAILQ_FIRST(&sufp->list);
                         for (found = 0;                          for (found = 0;
                             e_sufp != NULL; e_sufp = e_sufp->q.tqe_next) {                              e_sufp != NULL; e_sufp = TAILQ_NEXT(e_sufp, q)) {
                                 (void)snprintf(buf,                                  (void)snprintf(buf,
                                      sizeof(buf), "*/%s%s", page, e_sufp->s);                                       sizeof(buf), "*/%s%s", page, e_sufp->s);
                                 if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {                                  if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
Line 466 
Line 464 
   
                         /* Try the _build key words next. */                          /* Try the _build key words next. */
                         e_sufp = (sufp = getlist("_build")) == NULL ?                          e_sufp = (sufp = getlist("_build")) == NULL ?
                             NULL : sufp->list.tqh_first;                              NULL : TAILQ_FIRST(&sufp->list);
                         for (found = 0;                          for (found = 0;
                             e_sufp != NULL; e_sufp = e_sufp->q.tqe_next) {                              e_sufp != NULL; e_sufp = TAILQ_NEXT(e_sufp, q)) {
                                 for (p = e_sufp->s;                                  for (p = e_sufp->s;
                                     *p != '\0' && !isspace(*p); ++p);                                      *p != '\0' && !isspace(*p); ++p);
                                 if (*p == '\0')                                  if (*p == '\0')
Line 766 
Line 764 
   
         rval = 0;          rval = 0;
         ep = (missp = getlist("_missing")) == NULL ?          ep = (missp = getlist("_missing")) == NULL ?
             NULL : missp->list.tqh_first;              NULL : TAILQ_FIRST(&missp->list);
         if (ep != NULL)          if (ep != NULL)
                 for (; ep != NULL; ep = ep->q.tqe_next) {                  for (; ep != NULL; ep = TAILQ_NEXT(ep, q)) {
                         if (section)                          if (section)
                                 warnx("no entry for %s in section %s of the manual.",                                  warnx("no entry for %s in section %s of the manual.",
                                         ep->s, section->s);                                          ep->s, section->s);
Line 778 
Line 776 
                 }                  }
   
         ep = (intmpp = getlist("_intmp")) == NULL ?          ep = (intmpp = getlist("_intmp")) == NULL ?
             NULL : intmpp->list.tqh_first;              NULL : TAILQ_FIRST(&intmpp->list);
         for (; ep != NULL; ep = ep->q.tqe_next)          for (; ep != NULL; ep = TAILQ_NEXT(ep, q))
                 (void)unlink(ep->s);                  (void)unlink(ep->s);
         return (rval);          return (rval);
 }  }

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29