1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-04 19:37:18 -05:00

refactor handling of version and program name strings.

This commit is contained in:
Renaud 2013-05-17 10:34:01 +08:00
parent 9f909644e9
commit 86afdef45e
5 changed files with 15 additions and 34 deletions

View File

@ -19,13 +19,13 @@ PROGRAM=ue
SRC=basic.c bind.c buffer.c crypt.c display.c eval.c exec.c \
file.c fileio.c input.c isearch.c line.c lock.c main.c \
pklock.c posix.c random.c region.c search.c spawn.c tcap.c \
termio.c window.c word.c names.c globals.c version.c \
termio.c window.c word.c names.c globals.c \
wrapper.c utf8.c
OBJ=basic.o bind.o buffer.o crypt.o display.o eval.o exec.o \
file.o fileio.o input.o isearch.o line.o lock.o main.o \
pklock.o posix.o random.o region.o search.o spawn.o tcap.o \
termio.o window.o word.o names.o globals.o version.o \
termio.o window.o word.o names.o globals.o \
wrapper.o utf8.o
HDR=ebind.h edef.h efunc.h epath.h estruct.h evar.h util.h version.h
@ -156,7 +156,6 @@ tcap.o: tcap.c estruct.h edef.h
termio.o: termio.c estruct.h edef.h
usage.o: usage.c usage.h
utf8.o: utf8.c utf8.h
version.o: version.c version.h
vmsvt.o: vmsvt.c estruct.h edef.h
vt52.o: vt52.c estruct.h edef.h
window.o: window.c estruct.h edef.h

View File

@ -1121,12 +1121,7 @@ static void modeline(struct window *wp)
n = 2;
strcpy(tline, " ");
strcat(tline, PROGRAM_NAME_LONG);
strcat(tline, " ");
strcat(tline, VERSION);
strcat(tline, ": ");
cp = &tline[0];
cp = " " PROGRAM_NAME_LONG " " VERSION ": " ;
while ((c = *cp++) != 0) {
vtputc(c);
++n;

17
main.c
View File

@ -93,20 +93,21 @@ extern void sizesignal(int);
#endif
static void version( void) {
printf( "%s version %s\n", PROGRAM_NAME_LONG, VERSION) ;
fputs( PROGRAM_NAME_LONG " version " VERSION "\n", stdout) ;
}
static void usage( void) {
printf( "Usage: %s filename\n", PROGRAM_NAME) ;
printf( " or: %s [options]\n\n", PROGRAM_NAME) ;
fputs( " + start at the end of file\n", stdout) ;
fputs( " +<n> start at line <n>\n", stdout) ;
fputs( " -g[G]<n> go to line <n>\n", stdout) ;
fputs( " --help display this help and exit\n", stdout) ;
fputs( " --version output version information and exit\n", stdout) ;
fputs( "Usage: " PROGRAM_NAME " filename\n"
" or: " PROGRAM_NAME " [options]\n\n"
" + start at the end of file\n"
" +<n> start at line <n>\n"
" -g[G]<n> go to line <n>\n"
" --help display this help and exit\n"
" --version output version information and exit\n", stdout) ;
}
int main(int argc, char **argv)
{
int c = -1; /* command character */

View File

@ -1,10 +0,0 @@
/* version.c -- inplements version.h */
#include "version.h"
const char *pname_s = "ue" ;
char *pnamel_s = "uEMACS" ;
char *version_s = "4.1.0" ;
/* end of version.c */

View File

@ -1,13 +1,9 @@
#ifndef VERSION_H_
#define VERSION_H_
#define PROGRAM_NAME pname_s
#define PROGRAM_NAME_LONG pnamel_s
#define PROGRAM_NAME "ue"
#define PROGRAM_NAME_LONG "uEMACS"
#define VERSION version_s
extern const char *pname_s ;
extern char *pnamel_s ;
extern char *version_s ;
#define VERSION "4.1.1"
#endif /* VERSION_H_ */