Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

building C headers

Name: Anonymous 2009-04-30 9:02



#!/usr/bin/env python

import sys

if len(sys.argv) < 2:
    print "Creates a new C module with standard C template"
    print "Usage %s <modname>" % sys.argv[0]
    sys.exit(1)

templ_name = '__%s_H__' % sys.argv[1].upper()

h = open(sys.argv[1] + '.h', 'wt')
h.write('#ifndef %(tmpl)s\n#define %(tmpl)s\n\n\n#endif /* %(tmpl)s */' % \
        {'tmpl':templ_name})
h.close()

c = open(sys.argv[1] + '.c', 'wt')
c.write('#include %s.h' % sys.argv[1])
c.close()

sys.exit(0)

Name: Anonymous 2009-04-30 9:02

ONE WORD THE FORCED INDENTATION OF CODE THREAD OVER

Name: Anonymous 2009-04-30 9:04


--- bin/bmodule    2009-04-30 15:05:51.000000000 +0200
+++ old    2009-04-30 15:05:39.000000000 +0200
@@ -15,7 +15,7 @@
 h.close()
 
 c = open(sys.argv[1] + '.c', 'wt')
-c.write('#include "%s.h"' % sys.argv[1])
+c.write('#include %s.h' % sys.argv[1])
 c.close()
 
 sys.exit(0)

Name: Anonymous 2009-04-30 14:42

>>3
You patched the wrong way, moron.

Name: Anonymous 2009-05-01 3:31

>>4
Oh crap. You are right. Just patch -R it

Name: Anonymous 2009-05-01 11:30

A fatal error occured!
Please post threads less often!FUCKING HELL I REMEMBER WHEN SOMEONE SPAMMED /PROG/ AND RUINED IT FOR EVERYONE NOW I CAN NEVER MAKE NEW THREADS Powered by Shiichan 3955 + 4chan 20080608.

Name: Anonymous 2009-05-01 14:16

very useful

Don't change these.
Name: Email:
Entire Thread Thread List