/[man-db]/man-db/src/check_mandirs.c
ViewVC logotype

Diff of /man-db/src/check_mandirs.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.49 by cjwatson, Sat Sep 6 10:29:09 2003 UTC revision 1.50 by cjwatson, Tue Sep 16 21:54:00 2003 UTC
# Line 87  extern int errno; Line 87  extern int errno;
87  #include "descriptions.h"  #include "descriptions.h"
88  #include "filenames.h"  #include "filenames.h"
89  #include "globbing.h"  #include "globbing.h"
90    #include "manp.h"
91  #include "ult_src.h"  #include "ult_src.h"
92  #include "security.h"  #include "security.h"
93  #include "check_mandirs.h"  #include "check_mandirs.h"
# Line 682  static int count_glob_matches (const cha Line 683  static int count_glob_matches (const cha
683  static short purge_normal (const char *name, struct mandata *info,  static short purge_normal (const char *name, struct mandata *info,
684                             char **found)                             char **found)
685  {  {
686            /* TODO: On some systems, the cat page extension differs from the
687             * man page extension, so this may be too strict.
688             */
689          if (count_glob_matches (name, info->ext, found))          if (count_glob_matches (name, info->ext, found))
690                  return 0;                  return 0;
691    
# Line 694  static short purge_normal (const char *n Line 698  static short purge_normal (const char *n
698          return 1;          return 1;
699  }  }
700    
701  /* Decide whether to purge a reference to a WHATIS_MAN page. */  /* Decide whether to purge a reference to a WHATIS_MAN or WHATIS_CAT page. */
702  static short purge_whatis (const char *manpath, const char *name,  static short purge_whatis (const char *path, int cat, const char *name,
703                             struct mandata *info, char **found)                             struct mandata *info, char **found)
704  {  {
705            /* TODO: On some systems, the cat page extension differs from the
706             * man page extension, so this may be too strict.
707             */
708          if (count_glob_matches (name, info->ext, found)) {          if (count_glob_matches (name, info->ext, found)) {
709                  /* If the page exists and didn't beforehand, then presumably                  /* If the page exists and didn't beforehand, then presumably
710                   * we're about to rescan, which will replace the WHATIS_MAN                   * we're about to rescan, which will replace the WHATIS_MAN
# Line 739  static short purge_whatis (const char *m Line 746  static short purge_whatis (const char *m
746                  char **real_found;                  char **real_found;
747                  int save_debug = debug;                  int save_debug = debug;
748                  debug = 0;                  debug = 0;
749                  real_found = look_for_file (manpath, info->ext,                  real_found = look_for_file (path, info->ext,
750                                              info->pointer, 0, 1);                                              info->pointer, cat, 1);
751                  debug = save_debug;                  debug = save_debug;
752    
753                  if (count_glob_matches (info->pointer, info->ext, real_found))                  if (count_glob_matches (info->pointer, info->ext, real_found))
# Line 802  static short check_multi_key (const char Line 809  static short check_multi_key (const char
809  /* Go through the database and purge references to man pages that no longer  /* Go through the database and purge references to man pages that no longer
810   * exist.   * exist.
811   */   */
812  short purge_missing (const char *manpath)  short purge_missing (const char *manpath, const char *catpath)
813  {  {
814          datum key;          datum key;
815          short count = 0;          short count = 0;
# Line 858  short purge_missing (const char *manpath Line 865  short purge_missing (const char *manpath
865                  split_content (content.dptr, &entry);                  split_content (content.dptr, &entry);
866                  content.dptr = entry.addr;                  content.dptr = entry.addr;
867    
                 /* We only handle ULT_MAN, SO_MAN, and WHATIS_MAN for now. */  
                 if (entry.id > WHATIS_MAN) {  
                         free (nicekey);  
                         MYDBM_FREE (content.dptr);  
                         nextkey = MYDBM_NEXTKEY (dbf, key);  
                         MYDBM_FREE (key.dptr);  
                         key = nextkey;  
                         continue;  
                 }  
   
868                  save_debug = debug;                  save_debug = debug;
869                  debug = 0;      /* look_for_file() is quite noisy */                  debug = 0;      /* look_for_file() is quite noisy */
870                  found = look_for_file (manpath, entry.ext,                  if (entry.id <= WHATIS_MAN)
871                                         entry.name ? entry.name : nicekey,                          found = look_for_file (manpath, entry.ext,
872                                         0, 1);                                                 entry.name ? entry.name
873                                                              : nicekey,
874                                                   0, 1);
875                    else
876                            found = look_for_file (catpath, entry.ext,
877                                                   entry.name ? entry.name
878                                                              : nicekey,
879                                                   1, 1);
880                  debug = save_debug;                  debug = save_debug;
881    
882                  /* Now actually decide whether to purge, depending on the                  /* Now actually decide whether to purge, depending on the
883                   * type of entry.                   * type of entry.
884                   */                   */
885                  if (entry.id == ULT_MAN || entry.id == SO_MAN)                  if (entry.id == ULT_MAN || entry.id == SO_MAN ||
886                        entry.id == STRAY_CAT)
887                          count += purge_normal (nicekey, &entry, found);                          count += purge_normal (nicekey, &entry, found);
888                  else            /* entry.id == WHATIS_MAN */                  else if (entry.id == WHATIS_MAN)
889                          count += purge_whatis (manpath, nicekey,                          count += purge_whatis (manpath, 0, nicekey,
890                                                   &entry, found);
891                    else    /* entry.id == WHATIS_CAT */
892                            count += purge_whatis (catpath, 1, nicekey,
893                                                 &entry, found);                                                 &entry, found);
894    
895                  free (nicekey);                  free (nicekey);

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26