in reply to S simple C checking script
Are you sure you are not over-extending the request of your friend?
Looking at the content is difficult:
The idea to compile the file to see if it runs will also lead to problems:
- not every C-file needs main()
- not every C-file includes stdio.h
Therefore I would just look at the extensions .c and .h (and possible additional relevant extensions for your domain).
- what if it is a C-file, which however contains a syntax-error? Probably it should be listed nevertheless...
- what if the C-file needs some non-standard compile options (and compiling fails if you don't provide them?)
- what if it is a simple C++ - program/file, which however compiles with C?