C comment remover

Maarten Litmaath maart at cs.vu.nl
Wed Jan 10 08:57:43 AEST 1990


In article <4041 at brazos.Rice.edu> moraes at cs.toronto.edu (Mark Moraes)
posted a (slow!) C comment remover I once wrote for fun in sed.  Sed *is*
a good tool to remove C comments, but it's clearer (and faster!) to divide
the task into 3 parts, each having its own sed script.  Furthermore there
was a small bug in the original script: it replaced each comment by *zero*
spaces instead of *one* space (easily fixed).  Anyway, below are the 3
scripts, to be used as follows:

	sed -f Cstrip.1.sed [file] | sed -f Cstrip.2.sed | sed -f Cstrip.3.sed

A still more twisted sample file is included.

[[Ed's Note: Placed in archives at Rice.]]

FTP:	Hostname : titan.rice.edu (128.42.1.30)
	Directory: sun-source
	Filename : crem.shar

Archive Server Address: archive-server at rice.edu
Archive Server Command: send sun-source crem.shar



More information about the Comp.sys.sun mailing list