mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 23:17:13 -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
|
||||
* ones that update the virtual display screen, and the ones that make the
|
||||
@ -15,6 +15,7 @@
|
||||
#include "estruct.h"
|
||||
#include "edef.h"
|
||||
#include "efunc.h"
|
||||
#include "version.h"
|
||||
|
||||
struct video {
|
||||
int v_flag; /* Flags */
|
||||
@ -1132,7 +1133,7 @@ static void modeline(struct window *wp)
|
||||
n = 2;
|
||||
|
||||
strcpy(tline, " ");
|
||||
strcat(tline, PROGNAME);
|
||||
strcat(tline, PROGRAM_NAME_LONG);
|
||||
strcat(tline, " ");
|
||||
strcat(tline, VERSION);
|
||||
strcat(tline, ": ");
|
||||
|
33
estruct.h
33
estruct.h
@ -21,24 +21,11 @@
|
||||
#undef CTRLZ
|
||||
#endif
|
||||
|
||||
/* Program Identification.....
|
||||
|
||||
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 */
|
||||
/* Machine/OS definitions. */
|
||||
|
||||
#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__)
|
||||
#define MSDOS 1 /* MS/PC DOS 3.1-4.0 with Turbo C 2.0 */
|
||||
@ -72,7 +59,7 @@
|
||||
#define VMS 0
|
||||
#endif
|
||||
|
||||
#define V7 0 /* no more */
|
||||
#define V7 0 /* No more. */
|
||||
|
||||
#else
|
||||
|
||||
@ -130,7 +117,7 @@
|
||||
#define TERMCAP UNIX
|
||||
#define IBMPC MSDOS
|
||||
|
||||
#endif /*autoconf */
|
||||
#endif /* Autoconf. */
|
||||
|
||||
/* Configuration options */
|
||||
|
||||
@ -159,7 +146,7 @@
|
||||
#define FILOCK BSD
|
||||
#endif
|
||||
|
||||
#endif /* autoconf */
|
||||
#endif /* Autoconf. */
|
||||
|
||||
#define ISRCH 1 /* Incremental searches like ITS EMACS */
|
||||
#define WORDPRO 1 /* Advanced word processing features */
|
||||
@ -185,13 +172,13 @@
|
||||
#define XONXOFF (UNIX | VMS)
|
||||
#define NATIONL (UNIX | VMS)
|
||||
|
||||
#endif /* autoconf */
|
||||
#endif /* Autoconf. */
|
||||
|
||||
#define PKCODE 1 /* include my extensions P.K., define always */
|
||||
#define IBMCHR MSDOS /* use IBM PC character set 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
|
||||
#include <dos.h>
|
||||
@ -220,7 +207,7 @@
|
||||
#define unlink(a) delete(a)
|
||||
#endif
|
||||
|
||||
/* define some ability flags */
|
||||
/* Define some ability flags. */
|
||||
|
||||
#if IBMPC
|
||||
#define MEMMAP 1
|
||||
@ -234,11 +221,11 @@
|
||||
#define ENVFUNC 0
|
||||
#endif
|
||||
|
||||
/* Emacs global flag bit definitions (for gflags) */
|
||||
/* Emacs global flag bit definitions (for gflags). */
|
||||
|
||||
#define GFREAD 1
|
||||
|
||||
/* internal constants */
|
||||
/* Internal constants. */
|
||||
|
||||
#define NBINDS 256 /* max # of bound keys */
|
||||
#define NFILEN 80 /* # of bytes, file name */
|
||||
|
13
eval.c
13
eval.c
@ -1,4 +1,4 @@
|
||||
/* EVAL.C
|
||||
/* eval.c
|
||||
*
|
||||
* Expression evaluation functions
|
||||
*
|
||||
@ -12,19 +12,20 @@
|
||||
#include "efunc.h"
|
||||
#include "evar.h"
|
||||
#include "util.h"
|
||||
#include "version.h"
|
||||
|
||||
/* Initialize the user variable list. */
|
||||
void varinit(void)
|
||||
{ /* initialize the user variable list */
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXVARS; i++)
|
||||
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)
|
||||
{
|
||||
@ -259,7 +260,7 @@ char *gtenv(char *vname)
|
||||
case EVVERSION:
|
||||
return (VERSION);
|
||||
case EVPROGNAME:
|
||||
return (PROGNAME);
|
||||
return (PROGRAM_NAME_LONG);
|
||||
case EVSEED:
|
||||
return (itoa(seed));
|
||||
case EVDISINP:
|
||||
|
24
main.c
24
main.c
@ -60,6 +60,7 @@
|
||||
#include "edef.h" /* Global definitions. */
|
||||
#include "efunc.h" /* Function declarations and name table. */
|
||||
#include "ebind.h" /* Default key bindings. */
|
||||
#include "version.h"
|
||||
|
||||
/* For MSDOS, increase the default stack space. */
|
||||
#if MSDOS & TURBO
|
||||
@ -87,6 +88,16 @@ extern void sizesignal(int);
|
||||
#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
|
||||
int emacs(int argc, char **argv)
|
||||
#else
|
||||
@ -117,11 +128,11 @@ int main(int argc, char **argv)
|
||||
int newc;
|
||||
|
||||
#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
|
||||
|
||||
#if PKCODE & BSD
|
||||
sleep(1); /* time for window manager */
|
||||
sleep(1); /* Time for window manager. */
|
||||
#endif
|
||||
|
||||
#if UNIX
|
||||
@ -130,13 +141,16 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#endif
|
||||
if (argc == 2) {
|
||||
if (!strcmp(argv[1], "--version")) {
|
||||
printf("%s version %s\n", PROGNAME, VERSION);
|
||||
if (strcmp(argv[1], "--help") == 0) {
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
if (strcmp(argv[1], "--version") == 0) {
|
||||
printf("%s version %s\n", PROGRAM_NAME_LONG, VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize the editor */
|
||||
/* Initialize the editor. */
|
||||
vtinit(); /* Display */
|
||||
edinit("main"); /* Buffers, windows */
|
||||
varinit(); /* user variables */
|
||||
|
Loading…
x
Reference in New Issue
Block a user