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
19
display.c
19
display.c
@ -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
|
||||||
@ -8,13 +8,14 @@
|
|||||||
* modified by Petri Kutvonen
|
* modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#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, ": ");
|
||||||
|
119
estruct.h
119
estruct.h
@ -21,58 +21,45 @@
|
|||||||
#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 */
|
||||||
#else
|
#else
|
||||||
#define MSDOS 0
|
#define MSDOS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BSD) || defined(sun) || defined(ultrix) || (defined(vax) && defined(unix)) || defined(ultrix) || defined(__osf__)
|
#if defined(BSD) || defined(sun) || defined(ultrix) || (defined(vax) && defined(unix)) || defined(ultrix) || defined(__osf__)
|
||||||
#ifndef BSD
|
#ifndef BSD
|
||||||
#define BSD 1 /* Berkeley UNIX */
|
#define BSD 1 /* Berkeley UNIX */
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define BSD 0
|
#define BSD 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SVR4) || defined(__linux__) /* ex. SunOS 5.3 */
|
#if defined(SVR4) || defined(__linux__) /* ex. SunOS 5.3 */
|
||||||
#define SVR4 1
|
#define SVR4 1
|
||||||
#define SYSV 1
|
#define SYSV 1
|
||||||
#undef BSD
|
#undef BSD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SYSV) || defined(u3b2) || defined(_AIX) || (defined(i386) && defined(unix)) || defined(__hpux)
|
#if defined(SYSV) || defined(u3b2) || defined(_AIX) || (defined(i386) && defined(unix)) || defined(__hpux)
|
||||||
#define USG 1 /* System V UNIX */
|
#define USG 1 /* System V UNIX */
|
||||||
#else
|
#else
|
||||||
#define USG 0
|
#define USG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(VMS) || (defined(vax) && ! defined(unix))
|
#if defined(VMS) || (defined(vax) && ! defined(unix))
|
||||||
#define VMS 1 /* VAX/VMS */
|
#define VMS 1 /* VAX/VMS */
|
||||||
#else
|
#else
|
||||||
#define VMS 0
|
#define VMS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define V7 0 /* no more */
|
#define V7 0 /* No more. */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -130,25 +117,25 @@
|
|||||||
#define TERMCAP UNIX
|
#define TERMCAP UNIX
|
||||||
#define IBMPC MSDOS
|
#define IBMPC MSDOS
|
||||||
|
|
||||||
#endif /*autoconf */
|
#endif /* Autoconf. */
|
||||||
|
|
||||||
/* Configuration options */
|
/* Configuration options */
|
||||||
|
|
||||||
#define CVMVAS 1 /* arguments to page forward/back in pages */
|
#define CVMVAS 1 /* arguments to page forward/back in pages */
|
||||||
#define CLRMSG 0 /* space clears the message line with no insert */
|
#define CLRMSG 0 /* space clears the message line with no insert */
|
||||||
#define CFENCE 1 /* fench matching in CMODE */
|
#define CFENCE 1 /* fench matching in CMODE */
|
||||||
#define TYPEAH 1 /* type ahead causes update to be skipped */
|
#define TYPEAH 1 /* type ahead causes update to be skipped */
|
||||||
#define DEBUGM 1 /* $debug triggers macro debugging */
|
#define DEBUGM 1 /* $debug triggers macro debugging */
|
||||||
#define VISMAC 0 /* update display during keyboard macros */
|
#define VISMAC 0 /* update display during keyboard macros */
|
||||||
#define CTRLZ 0 /* add a ^Z at end of files under MSDOS only */
|
#define CTRLZ 0 /* add a ^Z at end of files under MSDOS only */
|
||||||
#define ADDCR 0 /* ajout d'un CR en fin de chaque ligne (ST520) */
|
#define ADDCR 0 /* ajout d'un CR en fin de chaque ligne (ST520) */
|
||||||
#define NBRACE 1 /* new style brace matching command */
|
#define NBRACE 1 /* new style brace matching command */
|
||||||
#define REVSTA 1 /* Status line appears in reverse video */
|
#define REVSTA 1 /* Status line appears in reverse video */
|
||||||
|
|
||||||
#ifndef AUTOCONF
|
#ifndef AUTOCONF
|
||||||
|
|
||||||
#define COLOR 1 /* color commands and windows */
|
#define COLOR 1 /* color commands and windows */
|
||||||
#define FILOCK 0 /* file locking under unix BSD 4.2 */
|
#define FILOCK 0 /* file locking under unix BSD 4.2 */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -159,43 +146,43 @@
|
|||||||
#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 */
|
||||||
#define FNLABEL 0 /* function key label code [HP150] */
|
#define FNLABEL 0 /* function key label code [HP150] */
|
||||||
#define APROP 1 /* Add code for Apropos command */
|
#define APROP 1 /* Add code for Apropos command */
|
||||||
#define CRYPT 1 /* file encryption enabled? */
|
#define CRYPT 1 /* file encryption enabled? */
|
||||||
#define MAGIC 1 /* include regular expression matching? */
|
#define MAGIC 1 /* include regular expression matching? */
|
||||||
#define AEDIT 1 /* advanced editing options: en/detabbing */
|
#define AEDIT 1 /* advanced editing options: en/detabbing */
|
||||||
#define PROC 1 /* named procedures */
|
#define PROC 1 /* named procedures */
|
||||||
#define CLEAN 0 /* de-alloc memory on exit */
|
#define CLEAN 0 /* de-alloc memory on exit */
|
||||||
#define CALLED 0 /* is emacs a called subroutine? or stand alone */
|
#define CALLED 0 /* is emacs a called subroutine? or stand alone */
|
||||||
|
|
||||||
#define ASCII 1 /* always using ASCII char sequences for now */
|
#define ASCII 1 /* always using ASCII char sequences for now */
|
||||||
#define EBCDIC 0 /* later IBM mainfraim versions will use EBCDIC */
|
#define EBCDIC 0 /* later IBM mainfraim versions will use EBCDIC */
|
||||||
|
|
||||||
#ifndef AUTOCONF
|
#ifndef AUTOCONF
|
||||||
|
|
||||||
#define XONXOFF 0 /* don't disable XON-XOFF flow control P.K. */
|
#define XONXOFF 0 /* don't disable XON-XOFF flow control P.K. */
|
||||||
#define NATIONL 0 /* interprete [,],\,{,},| as characters P.K. */
|
#define NATIONL 0 /* interprete [,],\,{,},| as characters P.K. */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#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>
|
||||||
#include <mem.h>
|
#include <mem.h>
|
||||||
#undef peek
|
#undef peek
|
||||||
#undef poke
|
#undef poke
|
||||||
#define peek(a,b,c,d) movedata(a,b,FP_SEG(c),FP_OFF(c),d)
|
#define peek(a,b,c,d) movedata(a,b,FP_SEG(c),FP_OFF(c),d)
|
||||||
@ -208,7 +195,7 @@
|
|||||||
#define getname xgetname
|
#define getname xgetname
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MSDOS & MSC
|
#if MSDOS & MSC
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#define peek(a,b,c,d) movedata(a,b,FP_SEG(c),FP_OFF(c),d)
|
#define peek(a,b,c,d) movedata(a,b,FP_SEG(c),FP_OFF(c),d)
|
||||||
@ -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