This is canonsys.sh in view mode; [Download] [Up]
#!/bin/sh
# RCS canonsys.sh,v 1.2 1995/07/13 11:37:03 tom Exp
# title: canonsys.sh
# abstract: canonicalize a C-News sys file.
# author: T.R.Hageman, Groningen, The Netherlands
# created: December 1994
# modified: (see RCS Log at end)
# copyright:
#
# Copyright (C) 1994,1995 Tom R. Hageman.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# description:
#
# canonicalise the sys file:
# delete leading whitespace, collapse continued lines
#---
awk '
/^/ { thisln = $0 }
/^#/ { partline = "" ; print; next } # flush comments
/^[\t ]/ {
n = 0
for (s = substr(thisln, n); s ~ /^[\t ]/; s = substr(thisln, ++n))
; # skip leading whitespace
thisln = s
}
/\\$/ { partline = partline substr(thisln, 1, length(thisln)-1); next }
{ # non-continued line
partline = partline thisln # terminate the whole entry
if (partline != "")
print partline
partline = ""
}
END {
if (partline != "")
print partline # flush any partial line
}
' "$@"
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.