home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / CNEWS / _CNEWS.TAR / usr / lib / newsbin / relay / canonsys.awk next >
Encoding:
Text File  |  1994-09-02  |  645 b   |  23 lines

  1. # canonicalise the sys file:
  2. # delete comments & leading whitespace, collapse continued lines
  3. # rewritten to avoid assignment to $0, which is broken in older awks
  4. /^/    { thisln = $0 }
  5. /^#/    { partline = ""; next }        # delete comments
  6. /^[\t ]/    {
  7.     n = 0
  8.     for (s = substr(thisln, n); s ~ /^[\t ]/; s = substr(thisln, ++n))
  9.         ;            # skip leading whitespace
  10.     thisln = s
  11. }
  12. /\\$/    { partline = partline substr(thisln, 1, length(thisln)-1); next }
  13. {                    # non-continued line
  14.     partline = partline thisln    # terminate the whole entry
  15.     if (partline != "")
  16.         print partline
  17.     partline = ""
  18. }
  19. END    {
  20.     if (partline != "")
  21.         print partline        # flush any partial line
  22. }
  23.