From: David MacKenzie Date: Wed, 19 Oct 1994 05:41:52 +0000 (+0000) Subject: remove comments from sed script X-Git-Tag: fsf-origin~385 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86e1f309c5baaae8533efcc5586ac238c5eba623;p=thirdparty%2Fautoconf.git remove comments from sed script --- diff --git a/bin/ifnames.in b/bin/ifnames.in index 895646e54..cd95da844 100644 --- a/bin/ifnames.in +++ b/bin/ifnames.in @@ -64,25 +64,25 @@ fi for arg do +# The first two substitutions remove comments. Not perfect, but close enough. +# The second is for comments that end on a later line. The others do: +# Enclose identifiers in @ and a space. +# Handle "#if 0" -- there are no @s to trigger removal. +# Remove non-identifiers. +# Remove any spaces at the end. +# Translate any other spaces to newlines. sed -n ' -# Remove comments. Not perfect, but close enough. s%/\*[^/]*\*/%%g -# Comments that end on a later line. s%/\*[^/]*%%g /^[ ]*#[ ]*ifn*def[ ][ ]*\([A-Za-z0-9_]*\).*/s//\1/p /^[ ]*#[ ]*e*l*if[ ]/{ s/// s/@//g - # Enclose identifiers in @ and a space. s/\([A-Za-z_][A-Za-z_0-9]*\)/@\1 /g - # Handle "#if 0" -- there are no @s to trigger removal. s/$/@ / - # Remove non-identifiers. s/@defined //g s/[^@]*@\([^ ]* \)[^@]*/\1/g - # Remove any spaces at the end. s/ *$// - # Translate any other spaces to newlines. s/ /\ /g p diff --git a/ifnames.in b/ifnames.in index 895646e54..cd95da844 100644 --- a/ifnames.in +++ b/ifnames.in @@ -64,25 +64,25 @@ fi for arg do +# The first two substitutions remove comments. Not perfect, but close enough. +# The second is for comments that end on a later line. The others do: +# Enclose identifiers in @ and a space. +# Handle "#if 0" -- there are no @s to trigger removal. +# Remove non-identifiers. +# Remove any spaces at the end. +# Translate any other spaces to newlines. sed -n ' -# Remove comments. Not perfect, but close enough. s%/\*[^/]*\*/%%g -# Comments that end on a later line. s%/\*[^/]*%%g /^[ ]*#[ ]*ifn*def[ ][ ]*\([A-Za-z0-9_]*\).*/s//\1/p /^[ ]*#[ ]*e*l*if[ ]/{ s/// s/@//g - # Enclose identifiers in @ and a space. s/\([A-Za-z_][A-Za-z_0-9]*\)/@\1 /g - # Handle "#if 0" -- there are no @s to trigger removal. s/$/@ / - # Remove non-identifiers. s/@defined //g s/[^@]*@\([^ ]* \)[^@]*/\1/g - # Remove any spaces at the end. s/ *$// - # Translate any other spaces to newlines. s/ /\ /g p diff --git a/ifnames.sh b/ifnames.sh index 895646e54..cd95da844 100644 --- a/ifnames.sh +++ b/ifnames.sh @@ -64,25 +64,25 @@ fi for arg do +# The first two substitutions remove comments. Not perfect, but close enough. +# The second is for comments that end on a later line. The others do: +# Enclose identifiers in @ and a space. +# Handle "#if 0" -- there are no @s to trigger removal. +# Remove non-identifiers. +# Remove any spaces at the end. +# Translate any other spaces to newlines. sed -n ' -# Remove comments. Not perfect, but close enough. s%/\*[^/]*\*/%%g -# Comments that end on a later line. s%/\*[^/]*%%g /^[ ]*#[ ]*ifn*def[ ][ ]*\([A-Za-z0-9_]*\).*/s//\1/p /^[ ]*#[ ]*e*l*if[ ]/{ s/// s/@//g - # Enclose identifiers in @ and a space. s/\([A-Za-z_][A-Za-z_0-9]*\)/@\1 /g - # Handle "#if 0" -- there are no @s to trigger removal. s/$/@ / - # Remove non-identifiers. s/@defined //g s/[^@]*@\([^ ]* \)[^@]*/\1/g - # Remove any spaces at the end. s/ *$// - # Translate any other spaces to newlines. s/ /\ /g p