home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / carp / carp.table < prev    next >
Text File  |  1992-03-10  |  3KB  |  98 lines

  1. #
  2. # is going to accept input something like:
  3. #
  4. # cops_dir/architecture_dir/hostname/cops_report_file root.chk 2
  5. #
  6. #  Where the first field is the path to the report file (relative
  7. # or absolute to the cops dir), the second is the check that generated
  8. # the warning message, and the last is the warning level.
  9.  
  10. #  This is something like what the final report will be:
  11. #
  12. # hostname     date crn dev ftp grp hme is pass msc pwd rc root usr
  13. # ===================================================================
  14. #             |    |   |   |   |   |   |   |   |   |   |   |   |
  15. #
  16. #  TO ADD NEW CHECKS -- just add a line near the bottom; bug.chk is
  17. # used as an example.  Note you'll also have to add this to "carp" --
  18. # see comments there, too...
  19. #
  20. # find the most serious problems
  21. {
  22. if (type[$2] == "")     type[$2] = $3
  23. else if (type[$2] > $3) type[$2] = $3
  24. # print "type:", $2, $3, "now", type[$2]
  25.  
  26. # something like "arch/hostname/1992_Dec_31" or "hostname/1992_Dec_31", etc.
  27. # print "one, Line:", $1, ",", $0
  28. if (final == "") {
  29.     res=split($1, host_date, "/");
  30.  
  31.     if (res >= 2) {
  32.         host = sprintf("%s",host_date[res-1])
  33.         date = sprintf("%s",host_date[res])
  34.         }
  35.     else if (res == 1) {
  36.         host = "unknown"
  37.         date = sprintf("%s",host_date[res])
  38.         }
  39.     else {
  40.         host = "unknown"
  41.         date = "unknown"
  42.         }
  43.  
  44.     host_len=length(host)
  45.     date_len=length(date)
  46.     diff = 25 - date_len - host_len
  47.  
  48.     final=sprintf("%s", host)
  49.     for (j=1; j < diff; j++)
  50.         final=sprintf("%s ",final);
  51.     final=sprintf("%s%s", final, date)
  52.     }
  53. }
  54.  
  55. #
  56. #
  57. #  Final printing, etc...
  58. END {
  59. printf("%s  |", final)
  60.  
  61. for (i in type)
  62.     if (type[i] == 3) type[i] = " "
  63.  
  64. if (type["cron.chk"] != "") { printf(" %s |", type["cron.chk"]) }
  65. else printf(" ? |")
  66. if (type["dev.chk"] != "") { printf(" %s |", type["dev.chk"]) }
  67. else printf(" ? |")
  68. if (type["ftp.chk"] != "") { printf(" %s |", type["ftp.chk"]) }
  69. else printf(" ? |")
  70. if (type["group.chk"] != "") { printf(" %s |", type["group.chk"]) }
  71. else printf(" ? |")
  72. if (type["home.chk"] != "") { printf(" %s |", type["home.chk"]) }
  73. else printf(" ? |")
  74. if (type["is_able.chk"] != "") { printf(" %s |", type["is_able.chk"]) }
  75. else printf(" ? |")
  76. if (type["pass.chk"] != "") { printf(" %s |", type["pass.chk"]) }
  77. else printf(" ? |")
  78. if (type["misc.chk"] != "") { printf(" %s |", type["misc.chk"]) }
  79. else printf(" ? |")
  80. if (type["passwd.chk"] != "") { printf(" %s |", type["passwd.chk"]) }
  81. else printf(" ? |")
  82. if (type["rc.chk"] != "") { printf(" %s |", type["rc.chk"]) }
  83. else printf(" ? |")
  84. if (type["root.chk"] != "") { printf(" %s |", type["root.chk"]) }
  85. else printf(" ? |")
  86. if (type["user.chk"] != "") { printf(" %s |", type["user.chk"]) }
  87. else printf(" ? |")
  88. if (type["kuang"] != "") { printf(" %s |\n", type["kuang"]) }
  89. else print " ? |"
  90.  
  91. #  Note -- if adding this, change the last line above to *not* print
  92. # a newline; e.g. take the "\n" out of the printf, and make the
  93. # last "print" a printf like the rest of 'em.
  94. #
  95. # if (type["bug.chk"] != "") { printf(" %s |\n", type["bug.chk"]) }
  96. # else print " ? |"
  97. }
  98.