mirror of
https://github.com/rfivet/uemacs.git
synced 2024-09-06 06:34:16 -04:00
rework version and help printing
em --help now returns EXIT_SUCCESS
This commit is contained in:
parent
f3ce8236af
commit
c961759288
6
Makefile
6
Makefile
@ -135,8 +135,8 @@ basic.o: basic.c estruct.h edef.h
|
|||||||
bind.o: bind.c estruct.h edef.h epath.h
|
bind.o: bind.c estruct.h edef.h epath.h
|
||||||
buffer.o: buffer.c estruct.h edef.h
|
buffer.o: buffer.c estruct.h edef.h
|
||||||
crypt.o: crypt.c estruct.h edef.h
|
crypt.o: crypt.c estruct.h edef.h
|
||||||
display.o: display.c estruct.h edef.h utf8.h
|
display.o: display.c estruct.h edef.h utf8.h version.h
|
||||||
eval.o: eval.c estruct.h edef.h evar.h
|
eval.o: eval.c estruct.h edef.h evar.h version.h
|
||||||
exec.o: exec.c estruct.h edef.h
|
exec.o: exec.c estruct.h edef.h
|
||||||
file.o: file.c estruct.h edef.h
|
file.o: file.c estruct.h edef.h
|
||||||
fileio.o: fileio.c estruct.h edef.h
|
fileio.o: fileio.c estruct.h edef.h
|
||||||
@ -145,7 +145,7 @@ input.o: input.c estruct.h edef.h
|
|||||||
isearch.o: isearch.c estruct.h edef.h
|
isearch.o: isearch.c estruct.h edef.h
|
||||||
line.o: line.c estruct.h edef.h
|
line.o: line.c estruct.h edef.h
|
||||||
lock.o: lock.c estruct.h edef.h
|
lock.o: lock.c estruct.h edef.h
|
||||||
main.o: main.c estruct.h efunc.h edef.h ebind.h
|
main.o: main.c estruct.h efunc.h edef.h ebind.h version.h
|
||||||
pklock.o: pklock.c estruct.h
|
pklock.o: pklock.c estruct.h
|
||||||
posix.o: posix.c estruct.h utf8.h
|
posix.o: posix.c estruct.h utf8.h
|
||||||
random.o: random.c estruct.h edef.h
|
random.o: random.c estruct.h edef.h
|
||||||
|
18
main.c
18
main.c
@ -49,6 +49,10 @@
|
|||||||
*
|
*
|
||||||
* 4.0 Petri Kutvonen, 1-Sep-91
|
* 4.0 Petri Kutvonen, 1-Sep-91
|
||||||
*
|
*
|
||||||
|
* This modified version is now called uEmacs/rf.
|
||||||
|
*
|
||||||
|
* 4.1 Renaud Fivet, 1-May-13
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -88,8 +92,12 @@ extern void sizesignal(int);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void usage(int status)
|
static void version( void) {
|
||||||
{
|
printf( "%s version %s\n", PROGRAM_NAME_LONG, VERSION) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void usage( void) {
|
||||||
printf( "Usage: %s filename\n", PROGRAM_NAME) ;
|
printf( "Usage: %s filename\n", PROGRAM_NAME) ;
|
||||||
printf( " or: %s [options]\n\n", PROGRAM_NAME) ;
|
printf( " or: %s [options]\n\n", PROGRAM_NAME) ;
|
||||||
fputs( " + start at the end of file\n", stdout) ;
|
fputs( " + start at the end of file\n", stdout) ;
|
||||||
@ -97,8 +105,6 @@ void usage(int status)
|
|||||||
fputs( " -g[G]<n> go to line <n>\n", stdout) ;
|
fputs( " -g[G]<n> go to line <n>\n", stdout) ;
|
||||||
fputs( " --help display this help and exit\n", stdout) ;
|
fputs( " --help display this help and exit\n", stdout) ;
|
||||||
fputs( " --version output version information and exit\n", stdout) ;
|
fputs( " --version output version information and exit\n", stdout) ;
|
||||||
|
|
||||||
exit(status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@ -141,8 +147,10 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
if( argc == 2) {
|
if( argc == 2) {
|
||||||
if( strcmp( argv[ 1], "--help") == 0) {
|
if( strcmp( argv[ 1], "--help") == 0) {
|
||||||
usage(EXIT_FAILURE);
|
usage() ;
|
||||||
|
exit( EXIT_SUCCESS) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strcmp( argv[ 1], "--version") == 0) {
|
if( strcmp( argv[ 1], "--version") == 0) {
|
||||||
version() ;
|
version() ;
|
||||||
exit( EXIT_SUCCESS) ;
|
exit( EXIT_SUCCESS) ;
|
||||||
|
15
version.c
15
version.c
@ -1,7 +1,12 @@
|
|||||||
#include <stdio.h>
|
/* version.c -- inplements version.h */
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
void version(void)
|
#include <stdio.h>
|
||||||
{
|
|
||||||
printf("%s version %s\n", PROGRAM_NAME_LONG, VERSION);
|
char *pname_s = "em" ;
|
||||||
}
|
char *pnamel_s = "uEmacs/rf" ;
|
||||||
|
|
||||||
|
char *version_s = "4.1.0" ;
|
||||||
|
|
||||||
|
/* end of version.c */
|
||||||
|
11
version.h
11
version.h
@ -1,12 +1,13 @@
|
|||||||
#ifndef VERSION_H_
|
#ifndef VERSION_H_
|
||||||
#define VERSION_H_
|
#define VERSION_H_
|
||||||
|
|
||||||
#define PROGRAM_NAME "em"
|
#define PROGRAM_NAME pname_s
|
||||||
#define PROGRAM_NAME_LONG "uEmacs/Pk"
|
#define PROGRAM_NAME_LONG pnamel_s
|
||||||
|
|
||||||
#define VERSION "4.0.15"
|
#define VERSION version_s
|
||||||
|
|
||||||
/* Print the version string. */
|
extern char *pname_s ;
|
||||||
void version(void);
|
extern char *pnamel_s ;
|
||||||
|
extern char *version_s ;
|
||||||
|
|
||||||
#endif /* VERSION_H_ */
|
#endif /* VERSION_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user