external tool to remove embedded filenames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's rather unnecessary for files to contain their
path/filename in source code comments.

Here's a trivial little script that can remove
embedded filenames in c90 style comments from files.

This requires git.

It does the following types of removals:

remove individual lines like /* filename */ completely
remove filename from /* filename -- comment */, leave /* comment */
remove filename and any trailing ' *\n' from /* filename, leave /*
remove filename from /* filename, leave /*
remove filename from continuation ' * filename -- comment' leave ' * comment'
remove filename and any trailing ' *\n' from continuation ' * filename\n *\n'

It seems to work well enough.

It does not handle c99 comments.
No // filename variants are removed.

Running it on today's -next gives:

$ perl remove_embedded_filenames.pl
$ git diff --shortstat
 2310 files changed, 354 insertions(+), 4239 deletions(-)

It's also possible to give any filename or path
as an argument to the script

For instance:

$ perl remove_embedded_filenames.pl drivers/net

Attachment: remove_embedded_filenames.pl
Description: Perl program

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux