mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-30 04:56:23 -05:00
uemacs: Add --help option.
Add a basic usage() function to support the --help option. Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
dfc102ce3a
commit
8facd84c6f
@ -1,4 +1,4 @@
|
|||||||
/* DISPLAY.C
|
/* display.c
|
||||||
*
|
*
|
||||||
* The functions in this file handle redisplay. There are two halves, the
|
* The functions in this file handle redisplay. There are two halves, the
|
||||||
* ones that update the virtual display screen, and the ones that make the
|
* ones that update the virtual display screen, and the ones that make the
|
||||||
@ -15,6 +15,7 @@
|
|||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
#include "efunc.h"
|
#include "efunc.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
struct video {
|
struct video {
|
||||||
int v_flag; /* Flags */
|
int v_flag; /* Flags */
|
||||||
@ -1132,7 +1133,7 @@ static void modeline(struct window *wp)
|
|||||||
n = 2;
|
n = 2;
|
||||||
|
|
||||||
strcpy(tline, " ");
|
strcpy(tline, " ");
|
||||||
strcat(tline, PROGNAME);
|
strcat(tline, PROGRAM_NAME_LONG);
|
||||||
strcat(tline, " ");
|
strcat(tline, " ");
|
||||||
strcat(tline, VERSION);
|
strcat(tline, VERSION);
|
||||||
strcat(tline, ": ");
|
strcat(tline, ": ");
|
||||||
|
33
estruct.h
33
estruct.h
@ -21,24 +21,11 @@
|
|||||||
#undef CTRLZ
|
#undef CTRLZ
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Program Identification.....
|
/* Machine/OS definitions. */
|
||||||
|
|
||||||
PROGNAME should always be MicroEMACS for a distibrution
|
|
||||||
unmodified version. People using MicroEMACS as a shell
|
|
||||||
for other products should change this to reflect their
|
|
||||||
product. Macros can query this via the $progname variable
|
|
||||||
|
|
||||||
this version in called uEmacs/PK
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PROGNAME "uEmacs/PK"
|
|
||||||
#define VERSION "4.0.15"
|
|
||||||
|
|
||||||
/* Machine/OS definitions */
|
|
||||||
|
|
||||||
#if defined(AUTOCONF) || defined(MSDOS) || defined(BSD) || defined(SYSV) || defined(VMS)
|
#if defined(AUTOCONF) || defined(MSDOS) || defined(BSD) || defined(SYSV) || defined(VMS)
|
||||||
|
|
||||||
/* make an intelligent guess about the target system */
|
/* Make an intelligent guess about the target system. */
|
||||||
|
|
||||||
#if defined(__TURBOC__)
|
#if defined(__TURBOC__)
|
||||||
#define MSDOS 1 /* MS/PC DOS 3.1-4.0 with Turbo C 2.0 */
|
#define MSDOS 1 /* MS/PC DOS 3.1-4.0 with Turbo C 2.0 */
|
||||||
@ -72,7 +59,7 @@
|
|||||||
#define VMS 0
|
#define VMS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define V7 0 /* no more */
|
#define V7 0 /* No more. */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -130,7 +117,7 @@
|
|||||||
#define TERMCAP UNIX
|
#define TERMCAP UNIX
|
||||||
#define IBMPC MSDOS
|
#define IBMPC MSDOS
|
||||||
|
|
||||||
#endif /*autoconf */
|
#endif /* Autoconf. */
|
||||||
|
|
||||||
/* Configuration options */
|
/* Configuration options */
|
||||||
|
|
||||||
@ -159,7 +146,7 @@
|
|||||||
#define FILOCK BSD
|
#define FILOCK BSD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* autoconf */
|
#endif /* Autoconf. */
|
||||||
|
|
||||||
#define ISRCH 1 /* Incremental searches like ITS EMACS */
|
#define ISRCH 1 /* Incremental searches like ITS EMACS */
|
||||||
#define WORDPRO 1 /* Advanced word processing features */
|
#define WORDPRO 1 /* Advanced word processing features */
|
||||||
@ -185,13 +172,13 @@
|
|||||||
#define XONXOFF (UNIX | VMS)
|
#define XONXOFF (UNIX | VMS)
|
||||||
#define NATIONL (UNIX | VMS)
|
#define NATIONL (UNIX | VMS)
|
||||||
|
|
||||||
#endif /* autoconf */
|
#endif /* Autoconf. */
|
||||||
|
|
||||||
#define PKCODE 1 /* include my extensions P.K., define always */
|
#define PKCODE 1 /* include my extensions P.K., define always */
|
||||||
#define IBMCHR MSDOS /* use IBM PC character set P.K. */
|
#define IBMCHR MSDOS /* use IBM PC character set P.K. */
|
||||||
#define SCROLLCODE 1 /* scrolling code P.K. */
|
#define SCROLLCODE 1 /* scrolling code P.K. */
|
||||||
|
|
||||||
/* System dependant library redefinitions, structures and includes */
|
/* System dependant library redefinitions, structures and includes. */
|
||||||
|
|
||||||
#if TURBO
|
#if TURBO
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
@ -220,7 +207,7 @@
|
|||||||
#define unlink(a) delete(a)
|
#define unlink(a) delete(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* define some ability flags */
|
/* Define some ability flags. */
|
||||||
|
|
||||||
#if IBMPC
|
#if IBMPC
|
||||||
#define MEMMAP 1
|
#define MEMMAP 1
|
||||||
@ -234,11 +221,11 @@
|
|||||||
#define ENVFUNC 0
|
#define ENVFUNC 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Emacs global flag bit definitions (for gflags) */
|
/* Emacs global flag bit definitions (for gflags). */
|
||||||
|
|
||||||
#define GFREAD 1
|
#define GFREAD 1
|
||||||
|
|
||||||
/* internal constants */
|
/* Internal constants. */
|
||||||
|
|
||||||
#define NBINDS 256 /* max # of bound keys */
|
#define NBINDS 256 /* max # of bound keys */
|
||||||
#define NFILEN 80 /* # of bytes, file name */
|
#define NFILEN 80 /* # of bytes, file name */
|
||||||
|
13
eval.c
13
eval.c
@ -1,4 +1,4 @@
|
|||||||
/* EVAL.C
|
/* eval.c
|
||||||
*
|
*
|
||||||
* Expression evaluation functions
|
* Expression evaluation functions
|
||||||
*
|
*
|
||||||
@ -12,19 +12,20 @@
|
|||||||
#include "efunc.h"
|
#include "efunc.h"
|
||||||
#include "evar.h"
|
#include "evar.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
/* Initialize the user variable list. */
|
||||||
void varinit(void)
|
void varinit(void)
|
||||||
{ /* initialize the user variable list */
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAXVARS; i++)
|
for (i = 0; i < MAXVARS; i++)
|
||||||
uv[i].u_name[0] = 0;
|
uv[i].u_name[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* evaluate a function
|
* Evaluate a function.
|
||||||
*
|
*
|
||||||
* char *fname; name of function to evaluate
|
* @fname: name of function to evaluate.
|
||||||
*/
|
*/
|
||||||
char *gtfun(char *fname)
|
char *gtfun(char *fname)
|
||||||
{
|
{
|
||||||
@ -259,7 +260,7 @@ char *gtenv(char *vname)
|
|||||||
case EVVERSION:
|
case EVVERSION:
|
||||||
return (VERSION);
|
return (VERSION);
|
||||||
case EVPROGNAME:
|
case EVPROGNAME:
|
||||||
return (PROGNAME);
|
return (PROGRAM_NAME_LONG);
|
||||||
case EVSEED:
|
case EVSEED:
|
||||||
return (itoa(seed));
|
return (itoa(seed));
|
||||||
case EVDISINP:
|
case EVDISINP:
|
||||||
|
24
main.c
24
main.c
@ -60,6 +60,7 @@
|
|||||||
#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. */
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
/* For MSDOS, increase the default stack space. */
|
/* For MSDOS, increase the default stack space. */
|
||||||
#if MSDOS & TURBO
|
#if MSDOS & TURBO
|
||||||
@ -87,6 +88,16 @@ extern void sizesignal(int);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void usage(int status)
|
||||||
|
{
|
||||||
|
printf("Usage: %s filename\n", PROGRAM_NAME);
|
||||||
|
printf(" or: %s [options]\n\n", PROGRAM_NAME);
|
||||||
|
fputs(" --help display this help and exit\n", stdout);
|
||||||
|
fputs(" --version output version information and exit\n", stdout);
|
||||||
|
|
||||||
|
exit(status);
|
||||||
|
}
|
||||||
|
|
||||||
#if CALLED
|
#if CALLED
|
||||||
int emacs(int argc, char **argv)
|
int emacs(int argc, char **argv)
|
||||||
#else
|
#else
|
||||||
@ -117,11 +128,11 @@ int main(int argc, char **argv)
|
|||||||
int newc;
|
int newc;
|
||||||
|
|
||||||
#if PKCODE & VMS
|
#if PKCODE & VMS
|
||||||
(void) umask(-1); /* use old protection (this is at wrong place) */
|
(void) umask(-1); /* Use old protection (this is at wrong place). */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PKCODE & BSD
|
#if PKCODE & BSD
|
||||||
sleep(1); /* time for window manager */
|
sleep(1); /* Time for window manager. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNIX
|
#if UNIX
|
||||||
@ -130,13 +141,16 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
if (!strcmp(argv[1], "--version")) {
|
if (strcmp(argv[1], "--help") == 0) {
|
||||||
printf("%s version %s\n", PROGNAME, VERSION);
|
usage(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (strcmp(argv[1], "--version") == 0) {
|
||||||
|
printf("%s version %s\n", PROGRAM_NAME_LONG, VERSION);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the editor */
|
/* Initialize the editor. */
|
||||||
vtinit(); /* Display */
|
vtinit(); /* Display */
|
||||||
edinit("main"); /* Buffers, windows */
|
edinit("main"); /* Buffers, windows */
|
||||||
varinit(); /* user variables */
|
varinit(); /* user variables */
|
||||||
|
Loading…
Reference in New Issue
Block a user