From 1a2cb3f73bcb8b7dc532253c64dc4da5a40e585b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 23 Mar 2016 10:57:14 -0700 Subject: Version 5. Support --version option. Put in correct copyright. Change e-mail address to kylheku.com. --- autotab.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/autotab.c b/autotab.c index 93c3500..a841eeb 100644 --- a/autotab.c +++ b/autotab.c @@ -1,11 +1,12 @@ /* - * Autotab v004. - * Program to detect the tabbing style of a text file, and report + * Autotab. + * + * A program to detect the tabbing style of a text file, and report * it as a Vim command to set up the tabstop, shiftwidth and expandtab * parameters. * - * Copyright 2014 - * Kaz Kylheku + * Copyright 2007-2016 + * Kaz Kylheku * Vancouver, Canada * * To use this, compile to an executable called "autotab". @@ -19,6 +20,7 @@ * execute 'set' system("autotab < " . bufname("%")) | endif */ +#define AUTOTAB_VER 5 #include #include #include @@ -725,8 +727,17 @@ int main(int argc, char **argv) int tabsize = 8, expandtabs = 1, shiftwidth = 8; int ret = EXIT_FAILURE; - if (argc > 1 && !strcmp(argv[1], "-d")) - debug_enabled = 1; + if (argc > 1) { + if (!strcmp(argv[1], "-d")) { + debug_enabled = 1; + } else if (!strcmp(argv[1], "--version")) { + printf("Autotab %d\n", AUTOTAB_VER); + return EXIT_SUCCESS; + } else { + fputs("invalid argument\n", stderr); + return EXIT_FAILURE; + } + } if ((lines = snarf_lines(stdin)) == 0) goto out_default; -- cgit v1.2.3