summaryrefslogtreecommitdiffstats
path: root/autotab.c
diff options
context:
space:
mode:
Diffstat (limited to 'autotab.c')
-rw-r--r--autotab.c23
1 files 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 <kkylheku@gmail.com>
+ * Copyright 2007-2016
+ * Kaz Kylheku <kaz@kylheku.com>
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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;