#!/bin/sh

# $Copyright:	$
# Copyright (c) 1984, 1985 Sequent Computer Systems, Inc.
# All rights reserved
#  
# This software is furnished under a license and may be used
# only in accordance with the terms of that license and with the
# inclusion of the above copyright notice.   This software may not
# be provided or otherwise made available to, or used by, any
# other person.  No title to or ownership of the software is
# hereby transferred.

# $Header: makeptx 1.3 86/03/17 $
for i in 1 2 3 4 5 6 7 8
do
	(
		cd ../man$i
		/usr/lib/getNAME *.$i*
	)
done |
sed '
	h
	s/^\.TH  *\([^ ]*\)  *\([^ ]*\).*/\1(\2)/
	t good1
	s/.*/BAD SYNTAX IN MAKEPTX = &/
	q
	: good1
	H
	s/(.*//
	y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
	H
	g
	s/.*\n.*\((.*\)\n\(.*\)/\2\1/
	x
	s/.*	\(.*\)\n.*\n.*/\1/
	t dummy
	: dummy
	s/ *\\- */: /
	t good2
	s/  *-  */: /
	t good2
	G
	s/\(.*\)\n\(.*\)(.*/\2: \1/
	: good2
	s/ *, */,/g
	s/,/, /g
	s/\\f[123P]//g
	s/\\&//g
	/\\/{
		s/.*/BAD SYNTAX (backslash) IN MAKEPTX = &/
		q
	}
	H
	g
	s/\n/ /
	s/  *$//
'
