Skip to content

Commit

Permalink
Removed help file. Help text is now embedded in less executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Apr 11, 1996
1 parent c3f6f62 commit 6342ed4
Show file tree
Hide file tree
Showing 21 changed files with 282 additions and 214 deletions.
13 changes: 10 additions & 3 deletions Makefile.aut
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SRC = main.c screen.c brac.c ch.c charset.c cmdbuf.c \
output.c position.c prompt.c search.c signal.c \
tags.c ttyin.c version.c
DISTFILES = ${SRC} regexp.c regexp.h \
INSTALL Makefile.in README NEWS \
INSTALL Makefile.in Makefile.aut README NEWS \
configure configure.in acconfig.h lesskey.c \
cmd.h funcs.h less.h lesskey.h option.h position.h \
install.sh defines.h.in defines.h.top mkinstalldirs \
Expand All @@ -20,12 +20,19 @@ DISTFILES = ${SRC} regexp.c regexp.h \
Makefile.os2 defines.os2 \
Makefile.osk defines.osk

all: newfuncs ${srcdir}/configure
all: help.c funcs.h ${srcdir}/configure

help.c: less.hlp mkhelp
rm -rf help.c
./mkhelp < less.hlp > help.c

mkhelp: mkhelp.c
${CC} -o mkhelp mkhelp.c

${srcdir}/configure: ${srcdir}/configure.in
cd ${srcdir}; autoheader; autoconf

newfuncs:
funcs.h: ${SRC:%=${srcdir}/%}
mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old
awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h

Expand Down
13 changes: 1 addition & 12 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ exec_prefix = @exec_prefix@
bindir = ${exec_prefix}/bin
binprefix =

# Where the help file goes.
datadir = ${prefix}/share

mandir = ${prefix}/man/man${manext}
manext = 1
manprefix =
Expand Down Expand Up @@ -63,22 +60,17 @@ lesskey: lesskey.${O} version.${O}

${OBJ}: ${srcdir}/less.h ${srcdir}/funcs.h defines.h

filename.${O}: ${srcdir}/filename.c
${CC} -c -DHELPFILE=\"${datadir}/less.hlp\" -I. ${CPPFLAGS} ${CFLAGS} ${srcdir}/filename.c

install: all ${srcdir}/less.hlp ${srcdir}/less.nro ${srcdir}/lesskey.nro installdirs
${INSTALL_PROGRAM} less ${bindir}/${binprefix}less
${INSTALL_PROGRAM} lesskey ${bindir}/${binprefix}lesskey
${INSTALL_DATA} ${srcdir}/less.hlp ${datadir}/less.hlp
${INSTALL_DATA} ${srcdir}/less.nro ${mandir}/${manprefix}less.${manext}
${INSTALL_DATA} ${srcdir}/lesskey.nro ${mandir}/${manprefix}lesskey.${manext}

installdirs: mkinstalldirs
${srcdir}/mkinstalldirs ${bindir} ${datadir} ${mandir}
${srcdir}/mkinstalldirs ${bindir} ${mandir}

uninstall:
rm -f ${bindir}/${binprefix}less ${bindir}/${binprefix}lesskey
rm -f ${datadir}/less.hlp
rm -f ${mandir}/less.${manext} ${mandir}/lesskey.${manext}

info:
Expand Down Expand Up @@ -106,9 +98,6 @@ ${srcdir}/configure: ${srcdir}/configure.in

lint:
lint -I. ${CPPFLAGS} ${SRC}
newfuncs:
mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old
awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h
clean:
rm -f *.${O} core less lesskey

Expand Down
6 changes: 6 additions & 0 deletions NEWS.VER
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
* Command line argument "--" signals that the rest of the arguments
are files (not option flags).

* Removed help file (less.hlp). Help text is now embedded in the
less executable itself.

* Added -Ph to change the prompt for the help text.
Added -Ps to change the default short prompt (same as plain -P).

* Ported to OS-9.

======================================================================
Expand Down
33 changes: 12 additions & 21 deletions README.VER
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
=======================================================================
=== This is a distribution of less (version @@VERSION@@) ===
=== This is the distribution of less (version @@VERSION@@) ===
=== Please report any problems to the author at [email protected]. ===
=== See http:https://members.aol.com/marknudel/less for the latest info. ===
=======================================================================
Expand Down Expand Up @@ -31,13 +31,10 @@ INSTALLATION (Unix systems only):
If you choose not to include some features in your version, you may
wish to edit the manual page "less.nro" and the help page "less.hlp"
to remove the descriptions of the features which you are removing.
If you edit less.hlp, you should run "make -f Makefile.author help.c".

4. Type "make" and watch the fun.

If you want less to find the help file in a directory other than
the default (/usr/local/share), define "datadir" to that directory.
For example: "make datadir=/usr/local/helpfiles"

5. If the make succeeds, it will generate a program "less"
in your current directory. Test the generated program.

Expand All @@ -46,11 +43,9 @@ INSTALLATION (Unix systems only):

The default install destinations are:
Executables (less, lesskey) in /usr/local/bin
Data files (less.hlp) in /usr/local/share
Documentation (less.nro, lesskey.nro) in /usr/local/man/man1
If you want to install any of these files elsewhere, define
bindir, datadir, and/or mandir to the appropriate directories.
datadir must be defined the same as in step 4.
bindir and/or mandir to the appropriate directories.

If you have any problems building or running "less", suggestions,
complaints, etc., you may mail to the author at [email protected]
Expand Down Expand Up @@ -79,7 +74,7 @@ INSTALLATION (MS-DOS systems only)

4. If you wish, you may edit DEFINES.DOS to remove some optional features.
If you choose not to include some features in your version, you may
wish to edit the manual page LESS.MAN and the help page LESS.HLP
wish to edit the manual page LESS.MAN and the help page HELP.C
to remove the descriptions of the features which you are removing.

5. Type "make" and watch the fun.
Expand All @@ -91,9 +86,8 @@ INSTALLATION (MS-DOS systems only)
6. If the make succeeds, it will generate a program "LESS.EXE"
in your current directory. Test the generated program.

7. When satisfied that it works, you may wish to install LESS.EXE,
LESSKEY.EXE and LESS.HLP in a directory which is included in
your PATH.
7. When satisfied that it works, you may wish to install LESS.EXE and
LESSKEY.EXE in a directory which is included in your PATH.



Expand All @@ -108,7 +102,7 @@ INSTALLATION (OS/2 systems only)

4. If you wish, you may edit defines.os2 to remove some optional features.
If you choose not to include some features in your version, you may
wish to edit the manual page less.man and the help page less.hlp
wish to edit the manual page less.man and the help page help.c
to remove the descriptions of the features which you are removing.

5. Type "make" and watch the fun.
Expand All @@ -122,9 +116,8 @@ INSTALLATION (OS/2 systems only)
somewhere in a directory listed in the PATH or INIT environment
variables.

8. When satisfied that it works, you may wish to install less.exe,
lesskey.exe and less.hlp in a directory which is included in
your PATH.
8. When satisfied that it works, you may wish to install less.exe and
lesskey.exe in a directory which is included in your PATH.



Expand All @@ -133,16 +126,14 @@ INSTALLATION (OS-9 systems only)

1. Move the distributed source to its own directory.

2. Rename Makefile.osk to Makefile.
2. If you are using gcc, rename Makefile.gcc.os9 to Makefile.
If you are using Ultra C, rename Makefile.ult.os9 to Makefile.

3. Check the Makefile to make sure the definitions look ok.
If you are using gcc, you should not need to change anything.
If you are using Ultra C, comment out the gcc definitions near
the top of the file, and un-comment the Ultra C definitions.

4. If you wish, you may edit defines.osk to remove some optional features.
If you choose not to include some features in your version, you may
wish to edit the manual page less.man and the help page less.hlp
wish to edit the manual page less.man and the help page help.c
to remove the descriptions of the features which you are removing.

5. Type "make" and watch the fun.
Expand Down
24 changes: 16 additions & 8 deletions ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ extern int autobuf;
extern int sigs;
extern int cbufs;
extern int secure;
extern constant char helpdata[];
extern constant int size_helpdata;
extern IFILE curr_ifile;
#if LOGFILE
extern int logfile;
Expand Down Expand Up @@ -186,15 +188,19 @@ fch_get()
* If we read less than a full block, that's ok.
* We use partial block and pick up the rest next time.
*/
if (ch_ungotchar == -1)
{
n = iread(ch_file, &bp->data[bp->datasize],
(unsigned int)(LBUFSIZE - bp->datasize));
} else
if (ch_ungotchar != -1)
{
bp->data[bp->datasize] = ch_ungotchar;
n = 1;
ch_ungotchar = -1;
} else if (ch_flags & CH_HELPFILE)
{
bp->data[bp->datasize] = helpdata[ch_fpos];
n = 1;
} else
{
n = iread(ch_file, &bp->data[bp->datasize],
(unsigned int)(LBUFSIZE - bp->datasize));
}

if (n == READ_INTR)
Expand Down Expand Up @@ -459,6 +465,8 @@ ch_length()
{
if (ignore_eoi)
return (NULL_POSITION);
if (ch_flags & CH_HELPFILE)
return (size_helpdata);
return (ch_fsize);
}

Expand Down Expand Up @@ -690,7 +698,7 @@ ch_init(f, flags)
/*
* Try to seek; set CH_CANSEEK if it works.
*/
if (seekable(f))
if (!(flags & CH_HELPFILE) && seekable(f))
ch_flags |= CH_CANSEEK;
set_filestate(curr_ifile, (void *) thisfile);
}
Expand All @@ -707,7 +715,7 @@ ch_close()
{
int keepstate = FALSE;

if (ch_flags & (CH_CANSEEK|CH_POPENED))
if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE))
{
/*
* We can seek or re-open, so we don't need to keep buffers.
Expand All @@ -723,7 +731,7 @@ ch_close()
* But don't really close it if it was opened via popen(),
* because pclose() wants to close it.
*/
if (!(ch_flags & CH_POPENED))
if (!(ch_flags & (CH_POPENED|CH_HELPFILE)))
close(ch_file);
ch_file = -1;
} else
Expand Down
17 changes: 9 additions & 8 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ extern int swindow;
extern int jump_sline;
extern int quitting;
extern int wscroll;
extern int nohelp;
extern int top_scroll;
extern int ignore_eoi;
extern int secure;
extern int helping;
extern char *every_first_cmd;
extern char *curr_altfilename;
extern char version[];
Expand Down Expand Up @@ -469,7 +469,7 @@ prompt()
/*
* If the -E flag is set and we've hit EOF on the last file, quit.
*/
if (quit_at_eof == OPT_ONPLUS && hit_eof &&
if (quit_at_eof == OPT_ONPLUS && hit_eof && !helping &&
next_ifile(curr_ifile) == NULL_IFILE)
quit(QUIT_OK);

Expand Down Expand Up @@ -1008,11 +1008,13 @@ commands()
/*
* Print file name, etc.
*/
if (helping)
break;
cmd_exec();
parg.p_string = eq_message();
error("%s", &parg);
break;

case A_VERSION:
/*
* Print version number, without the "@(#)".
Expand All @@ -1026,6 +1028,7 @@ commands()
* Exit.
*/
quit(QUIT_OK);
break;

/*
* Define abbreviation for a commonly used sequence below.
Expand Down Expand Up @@ -1105,15 +1108,13 @@ commands()
/*
* Help.
*/
if (nohelp)
if (helping)
{
bell();
break;
}
clear_bot();
putstr(" help");
cmd_exec();
help(0);
(void) edit(FAKE_HELPFILE);
break;

case A_EXAMINE:
Expand Down Expand Up @@ -1183,7 +1184,7 @@ commands()
number = 1;
if (edit_next(number))
{
if (quit_at_eof && hit_eof)
if (quit_at_eof && hit_eof && !helping)
quit(QUIT_OK);
parg.p_string = (number > 1) ? "(N-th) " : "";
error("No %snext file", &parg);
Expand Down
7 changes: 3 additions & 4 deletions defines.ds
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@
#define LESSKEYFILE "_less"
#define DEF_LESSKEYINFILE "_lesskey"

/*
* HELPFILE is the full pathname of the help file.
*/
#define HELPFILE "less.hlp"

/* Settings always true for MS-DOS systems. */

Expand Down Expand Up @@ -222,6 +218,9 @@
/* Define HAVE_VOID if your compiler supports the "void" type. */
#define HAVE_VOID 1

/* Define HAVE_CONST if your compiler supports the "const" modifier. */
#define HAVE_CONST 1

/* Define HAVE_TIME_T if your system supports the "time_t" type. */
#define HAVE_TIME_T 1

Expand Down
8 changes: 3 additions & 5 deletions defines.o2
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@
#define LESSKEYFILE "less.ini"
#define DEF_LESSKEYINFILE "lesskey.ini"


/*
* HELPFILE is the full pathname of the help file.
*/
#define HELPFILE "less.hlp"

/* Settings always true for the emx compiler for OS/2 systems. */
#define OS2 1
Expand Down Expand Up @@ -210,6 +205,9 @@
/* Define HAVE_VOID if your compiler supports the "void" type. */
#define HAVE_VOID 1

/* Define HAVE_CONST if your compiler supports the "const" modifier. */
#define HAVE_CONST 1

/* Define HAVE_TIME_T if your system supports the "time_t" type. */
#define HAVE_TIME_T 0

Expand Down
3 changes: 3 additions & 0 deletions defines.o9
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@
/* Define HAVE_VOID if your compiler supports the "void" type. */
#define HAVE_VOID 1

/* Define HAVE_CONST if your compiler supports the "const" modifier. */
#define HAVE_CONST 1

/* Define HAVE_TIME_T if your system supports the "time_t" type. */
#define HAVE_TIME_T 1

Expand Down
Loading

0 comments on commit 6342ed4

Please sign in to comment.