From dfc102ce3a47dfd63a98cad7930e223b2597e3ac Mon Sep 17 00:00:00 2001 From: Thiago Farina Date: Fri, 13 Aug 2010 00:19:22 -0300 Subject: [PATCH] uemacs: Add --version option. Signed-off-by: Thiago Farina Signed-off-by: Linus Torvalds --- main.c | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/main.c b/main.c index c00dc3d..873fbf8 100644 --- a/main.c +++ b/main.c @@ -1,14 +1,16 @@ /* + * main.c + * uEmacs/PK 4.0 * - * based on + * Based on: * * MicroEMACS 3.9 - * written by Dave G. Conroy. - * substatially modified by Daniel M. Lawrence - * modified by Petri Kutvonen - * - * MicroEMACS 3.9 (C)opyright 1987 by Daniel M. Lawrence + * Written by Dave G. Conroy. + * Substatially modified by Daniel M. Lawrence + * Modified by Petri Kutvonen + * + * MicroEMACS 3.9 (c) Copyright 1987 by Daniel M. Lawrence * * Original statement of copying policy: * @@ -18,8 +20,6 @@ * * No copyright claimed for modifications made by Petri Kutvonen. * - * MAIN.C - * * This file contains the main driving routine, and some keyboard * processing code. * @@ -51,28 +51,27 @@ * */ -#include +#include -/* make global definitions not external */ +/* Make global definitions not external. */ #define maindef -#include "estruct.h" /* global structures and defines */ -#include "edef.h" /* global definitions */ -#include "efunc.h" /* function declarations and name table */ -#include "ebind.h" /* default key bindings */ +#include "estruct.h" /* Global structures and defines. */ +#include "edef.h" /* Global definitions. */ +#include "efunc.h" /* Function declarations and name table. */ +#include "ebind.h" /* Default key bindings. */ -/* for MSDOS, increase the default stack space */ - -#if MSDOS & TURBO -#if PKCODE +/* For MSDOS, increase the default stack space. */ +#if MSDOS & TURBO +#if PKCODE extern unsigned _stklen = 20000; #else extern unsigned _stklen = 32766; #endif #endif -#if VMS -#include +#if VMS +#include #define GOOD (SS$_NORMAL) #endif @@ -80,7 +79,7 @@ extern unsigned _stklen = 32766; #define GOOD 0 #endif -#if UNIX +#if UNIX #include static void emergencyexit(int); #ifdef SIGWINCH @@ -88,7 +87,7 @@ extern void sizesignal(int); #endif #endif -#if CALLED +#if CALLED int emacs(int argc, char **argv) #else int main(int argc, char **argv) @@ -130,6 +129,12 @@ int main(int argc, char **argv) signal(SIGWINCH, sizesignal); #endif #endif + if (argc == 2) { + if (!strcmp(argv[1], "--version")) { + printf("%s version %s\n", PROGNAME, VERSION); + exit(EXIT_SUCCESS); + } + } /* initialize the editor */ vtinit(); /* Display */ @@ -151,7 +156,6 @@ int main(int argc, char **argv) /* Parse the command line */ for (carg = 1; carg < argc; ++carg) { - /* Process Switches */ #if PKCODE if (argv[carg][0] == '+') {