projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
null pointer bugs
[unix-history]
/
usr
/
src
/
old
/
more
/
more.c
diff --git
a/usr/src/old/more/more.c
b/usr/src/old/more/more.c
index
8fd0d0f
..
0d84b2b
100644
(file)
--- a/
usr/src/old/more/more.c
+++ b/
usr/src/old/more/more.c
@@
-1,4
+1,4
@@
-static char *sccsid = "@(#)more.c 4.
4 (Berkeley) 81/04/23
";
+static char *sccsid = "@(#)more.c 4.
8 (Berkeley) 83/02/09
";
/*
** more.c - General purpose tty output filter and file perusal program
/*
** more.c - General purpose tty output filter and file perusal program
@@
-9,10
+9,6
@@
static char *sccsid = "@(#)more.c 4.4 (Berkeley) 81/04/23";
** modified by John Foderaro, UCB to add -c and MORE environment variable
*/
** modified by John Foderaro, UCB to add -c and MORE environment variable
*/
-#include <whoami.h>
-#ifdef V6
-#include <retrofit.h>
-#endif
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
@@
-20,23
+16,13
@@
static char *sccsid = "@(#)more.c 4.4 (Berkeley) 81/04/23";
#include <sgtty.h>
#include <setjmp.h>
#include <sys/types.h>
#include <sgtty.h>
#include <setjmp.h>
#include <sys/types.h>
-#include <sys/dir.h>
#include <sys/stat.h>
#include <local/uparm.h>
/* Help file will eventually go in libpath(more.help) on all systems */
#include <sys/stat.h>
#include <local/uparm.h>
/* Help file will eventually go in libpath(more.help) on all systems */
-#ifdef INGRES
-#define VI "/usr/bin/vi"
-#define HELPFILE "/mntp/doucette/more/more.help"
-#endif
-
-#ifndef INGRES
-#ifndef HELPFILE
#define HELPFILE libpath(more.help)
#define HELPFILE libpath(more.help)
-#endif
#define VI binpath(vi)
#define VI binpath(vi)
-#endif
#define Fopen(s,m) (Currline = 0,file_pos=0,fopen(s,m))
#define Ftell(f) file_pos
#define Fopen(s,m) (Currline = 0,file_pos=0,fopen(s,m))
#define Ftell(f) file_pos
@@
-44,13
+30,8
@@
static char *sccsid = "@(#)more.c 4.4 (Berkeley) 81/04/23";
#define Getc(f) (++file_pos, getc(f))
#define Ungetc(c,f) (--file_pos, ungetc(c,f))
#define Getc(f) (++file_pos, getc(f))
#define Ungetc(c,f) (--file_pos, ungetc(c,f))
-#ifdef V6
-#define MBIT RAW
-#define CBREAK ~RAW
-#else
#define MBIT CBREAK
#define stty(fd,argp) ioctl(fd,TIOCSETN,argp)
#define MBIT CBREAK
#define stty(fd,argp) ioctl(fd,TIOCSETN,argp)
-#endif
#define TBUFSIZ 1024
#define LINSIZ 256
#define TBUFSIZ 1024
#define LINSIZ 256
@@
-63,9
+44,7
@@
struct sgttyb otty;
long file_pos, file_size;
int fnum, no_intty, no_tty, slow_tty;
int dum_opt, dlines, onquit(), end_it();
long file_pos, file_size;
int fnum, no_intty, no_tty, slow_tty;
int dum_opt, dlines, onquit(), end_it();
-#ifdef SIGTSTP
int onsusp();
int onsusp();
-#endif
int nscroll = 11; /* Number of lines scrolled by 'd' */
int fold_opt = 1; /* Fold long lines */
int stop_opt = 1; /* Stop after form feeds */
int nscroll = 11; /* Number of lines scrolled by 'd' */
int fold_opt = 1; /* Fold long lines */
int stop_opt = 1; /* Stop after form feeds */
@@
-182,12
+161,10
@@
char *argv[];
if (!no_tty) {
signal(SIGQUIT, onquit);
signal(SIGINT, end_it);
if (!no_tty) {
signal(SIGQUIT, onquit);
signal(SIGINT, end_it);
-#ifdef SIGTSTP
if (signal (SIGTSTP, SIG_IGN) == SIG_DFL) {
signal(SIGTSTP, onsusp);
catch_susp++;
}
if (signal (SIGTSTP, SIG_IGN) == SIG_DFL) {
signal(SIGTSTP, onsusp);
catch_susp++;
}
-#endif
stty (2, &otty);
}
if (no_intty) {
stty (2, &otty);
}
if (no_intty) {
@@
-705,7
+682,7
@@
int *length;
}
else
column = 1 + (column | 7);
}
else
column = 1 + (column | 7);
- else if (c == '\b')
+ else if (c == '\b'
&& column > 0
)
column--;
else if (c == '\r')
column = 0;
column--;
else if (c == '\r')
column = 0;
@@
-1230,9
+1207,7
@@
register int n;
}
if (feof (file)) {
if (!no_intty) {
}
if (feof (file)) {
if (!no_intty) {
-#ifdef V6
file->_flag &= ~_IOEOF; /* why doesn't fseek do this ??!!??! */
file->_flag &= ~_IOEOF; /* why doesn't fseek do this ??!!??! */
-#endif
Currline = saveln;
Fseek (file, startline);
}
Currline = saveln;
Fseek (file, startline);
}
@@
-1261,17
+1236,13
@@
char *cmd, *args;
}
signal (SIGINT, SIG_IGN);
signal (SIGQUIT, SIG_IGN);
}
signal (SIGINT, SIG_IGN);
signal (SIGQUIT, SIG_IGN);
-#ifdef SIGTSTP
if (catch_susp)
signal(SIGTSTP, SIG_DFL);
if (catch_susp)
signal(SIGTSTP, SIG_DFL);
-#endif
wait (0);
signal (SIGINT, end_it);
signal (SIGQUIT, onquit);
wait (0);
signal (SIGINT, end_it);
signal (SIGQUIT, onquit);
-#ifdef SIGTSTP
if (catch_susp)
signal(SIGTSTP, onsusp);
if (catch_susp)
signal(SIGTSTP, onsusp);
-#endif
set_tty ();
pr ("------------------------\n");
prompt (filename);
set_tty ();
pr ("------------------------\n");
prompt (filename);
@@
-1335,10
+1306,11
@@
initterm ()
char clearbuf[100];
char *clearptr, *padstr;
int ldisc;
char clearbuf[100];
char *clearptr, *padstr;
int ldisc;
+ char *term;
setbuf(stdout, obuf);
if (!(no_tty = gtty(1, &otty))) {
setbuf(stdout, obuf);
if (!(no_tty = gtty(1, &otty))) {
- if (
tgetent(buf, getenv("TERM")
) <= 0) {
+ if (
(term = getenv("TERM")) || tgetent(buf, term
) <= 0) {
dumb++; ul_opt = 0;
}
else {
dumb++; ul_opt = 0;
}
else {
@@
-1380,7
+1352,7
@@
initterm ()
if (padstr = tgetstr("pc", &clearptr))
PC = *padstr;
Home = tgetstr("ho",&clearptr);
if (padstr = tgetstr("pc", &clearptr))
PC = *padstr;
Home = tgetstr("ho",&clearptr);
- if (*Home == '\0')
+ if (
Home == 0 ||
*Home == '\0')
{
if ((cursorm = tgetstr("cm", &clearptr)) != NULL) {
strcpy(cursorhome, tgoto(cursorm, 0, 0));
{
if ((cursorm = tgetstr("cm", &clearptr)) != NULL) {
strcpy(cursorhome, tgoto(cursorm, 0, 0));
@@
-1607,7
+1579,6
@@
register FILE *f;
/* Come here when we get a suspend signal from the terminal */
/* Come here when we get a suspend signal from the terminal */
-#ifdef SIGTSTP
onsusp ()
{
reset_tty ();
onsusp ()
{
reset_tty ();
@@
-1622,4
+1593,3
@@
onsusp ()
if (inwait)
longjmp (restore);
}
if (inwait)
longjmp (restore);
}
-#endif