1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-17 00:05:23 +00:00

uemacs: Add --version option.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Thiago Farina 2010-08-13 00:19:22 -03:00 committed by Linus Torvalds
parent 1f271323f8
commit dfc102ce3a

50
main.c
View File

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