Documentation ¶
Overview ¶
C2gofmt translates C syntax source files into Go syntax.
Usage:
c2gofmt [-v] [-w] [-r file] [file.c file.h ...]
C2gofmt translates the named C source files to Go syntax. It only operates syntactically: it does not type-check the C code nor the generated Go code. As a result, the generated Go code will almost certainly not compile. But it can serve well as the starting point for a manual translation, with c2gofmt having done much of the most tedious work.
The -v flag causes c2gofmt to print verbose output.
By default, c2gofmt writes the Go translation on standard output. The -w flag causes c2gofmt to write a Go file for each C input file, named by removing the .c suffix (if any) and adding .go.
The -r flag causes c2gofmt to read rewrite rules from the named file. In the file, blank lines or lines beginning with # are ignored. Other lines take the form “old -> new” and are interpreted the same as the patterns passed to “gofmt -r”.