diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -11,24 +11,25 @@ | |||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public |
15 | License along with GNU cflow; if not, write to the Free Software | 15 | License along with GNU cflow; if not, write to the Free Software |
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | MA 02110-1301 USA */ | 17 | MA 02110-1301 USA */ |
18 | 18 | ||
19 | #include <cflow.h> | 19 | #include <cflow.h> |
20 | #include <argp.h> | 20 | #include <argp.h> |
21 | #include <stdarg.h> | 21 | #include <stdarg.h> |
22 | #include <parser.h> | 22 | #include <parser.h> |
23 | #include <version-etc.h> | ||
23 | 24 | ||
24 | const char *argp_program_version = "cflow (" PACKAGE_NAME ") " VERSION; | 25 | const char *argp_program_version = "cflow (" PACKAGE_NAME ") " VERSION; |
25 | const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; | 26 | const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; |
26 | static char doc[] = N_("generate a program flowgraph") | 27 | static char doc[] = N_("generate a program flowgraph") |
27 | "\v" | 28 | "\v" |
28 | N_("* The effect of each option marked with an asterisk is reversed if the option's long name is prefixed with `no-'. For example, --no-cpp cancels --cpp."); | 29 | N_("* The effect of each option marked with an asterisk is reversed if the option's long name is prefixed with `no-'. For example, --no-cpp cancels --cpp."); |
29 | 30 | ||
30 | enum option_code { | 31 | enum option_code { |
31 | OPT_DEFINES = 256, | 32 | OPT_DEFINES = 256, |
32 | OPT_LEVEL_INDENT, | 33 | OPT_LEVEL_INDENT, |
33 | OPT_DEBUG, | 34 | OPT_DEBUG, |
34 | OPT_PREPROCESS, | 35 | OPT_PREPROCESS, |
@@ -738,30 +739,44 @@ init() | |||
738 | level_indent[0] = " "; /* 4 spaces */ | 739 | level_indent[0] = " "; /* 4 spaces */ |
739 | if (level_indent[1] == NULL) | 740 | if (level_indent[1] == NULL) |
740 | level_indent[1] = level_indent[0]; | 741 | level_indent[1] = level_indent[0]; |
741 | if (level_end[0] == NULL) | 742 | if (level_end[0] == NULL) |
742 | level_end[0] = ""; | 743 | level_end[0] = ""; |
743 | if (level_end[1] == NULL) | 744 | if (level_end[1] == NULL) |
744 | level_end[1] = ""; | 745 | level_end[1] = ""; |
745 | 746 | ||
746 | init_lex(debug > 1); | 747 | init_lex(debug > 1); |
747 | init_parse(); | 748 | init_parse(); |
748 | } | 749 | } |
749 | 750 | ||
751 | const char version_etc_copyright[] = | ||
752 | /* Do *not* mark this string for translation. %s is a copyright | ||
753 | symbol suitable for this locale, and %d is the copyright | ||
754 | year. */ | ||
755 | "Copyright %s 2005, 2006, %d Sergey Poznyakoff"; | ||
756 | |||
757 | static void | ||
758 | cflow_version(FILE *stream, struct argp_state *state) | ||
759 | { | ||
760 | version_etc(stream, "cflow", PACKAGE_NAME, PACKAGE_VERSION, | ||
761 | "Sergey Poznyakoff", NULL); | ||
762 | } | ||
763 | |||
750 | int | 764 | int |
751 | main(int argc, char **argv) | 765 | main(int argc, char **argv) |
752 | { | 766 | { |
753 | int index; | 767 | int index; |
754 | 768 | ||
755 | program_name = argv[0]; /* Until gnulib provides a better way */ | 769 | program_name = argv[0]; /* Until gnulib provides a better way */ |
770 | argp_program_version_hook = cflow_version; | ||
756 | 771 | ||
757 | setlocale(LC_ALL, ""); | 772 | setlocale(LC_ALL, ""); |
758 | bindtextdomain(PACKAGE, LOCALEDIR); | 773 | bindtextdomain(PACKAGE, LOCALEDIR); |
759 | textdomain(PACKAGE); | 774 | textdomain(PACKAGE); |
760 | 775 | ||
761 | register_output("gnu", gnu_output_handler, NULL); | 776 | register_output("gnu", gnu_output_handler, NULL); |
762 | register_output("posix", posix_output_handler, NULL); | 777 | register_output("posix", posix_output_handler, NULL); |
763 | 778 | ||
764 | symbol_map = SM_FUNCTIONS|SM_STATIC|SM_UNDEFINED; | 779 | symbol_map = SM_FUNCTIONS|SM_STATIC|SM_UNDEFINED; |
765 | 780 | ||
766 | if (getenv("POSIXLY_CORRECT")) { | 781 | if (getenv("POSIXLY_CORRECT")) { |
767 | if (select_output_driver("posix")) | 782 | if (select_output_driver("posix")) |