home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff319.lzh / CNewsSrc / cnews.orig.lzh / relay / aux / canonsys.awk next >
Text File  |  1989-06-27  |  638b  |  22 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.     for (s = substr(thisln, n); s ~ /^[\t ]/; s = substr(thisln, ++n))
  8.         ;            # skip leading whitespace
  9.     thisln = s
  10. }
  11. /\\$/    { partline = partline substr(thisln, 1, length(thisln)-1); next }
  12. {                    # non-continued line
  13.     partline = partline thisln    # terminate the whole entry
  14.     if (partline != "")
  15.         print partline
  16.     partline = ""
  17. }
  18. END    {
  19.     if (partline != "")
  20.         print partline        # flush any partial line
  21. }
  22.