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
lost the SCCS id's...
[unix-history]
/
usr
/
src
/
bin
/
ed
/
ed.c
diff --git
a/usr/src/bin/ed/ed.c
b/usr/src/bin/ed/ed.c
index
ddb96e8
..
3c554ae
100644
(file)
--- a/
usr/src/bin/ed/ed.c
+++ b/
usr/src/bin/ed/ed.c
@@
-1,19
+1,24
@@
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)ed.c 4.
7
(Berkeley) %G%";
+static char sccsid[] = "@(#)ed.c 4.
14
(Berkeley) %G%";
#endif
/*
* Editor
*/
#endif
/*
* Editor
*/
-
+#include <sys/param.h>
+#include <sys/wait.h>
#include <signal.h>
#include <sgtty.h>
#undef CEOF
#include <signal.h>
#include <sgtty.h>
#undef CEOF
+#include <fcntl.h>
+#include <time.h>
#include <setjmp.h>
#include <setjmp.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "pathnames.h"
#define NULL 0
#include "pathnames.h"
#define NULL 0
-#define FNSIZE 64
#define LBSIZE 512
#define ESIZE 128
#define GBSIZE 256
#define LBSIZE 512
#define ESIZE 128
#define GBSIZE 256
@@
-39,8
+44,8
@@
char T[] = "TMP";
int peekc;
int lastc;
int peekc;
int lastc;
-char savedfile[
FNSIZE
];
-char file[
FNSIZE
];
+char savedfile[
MAXPATHLEN
];
+char file[
MAXPATHLEN
];
char linebuf[LBSIZE];
char rhsbuf[LBSIZE/2];
char expbuf[ESIZE+4];
char linebuf[LBSIZE];
char rhsbuf[LBSIZE/2];
char expbuf[ESIZE+4];
@@
-57,9
+62,8
@@
char *linebp;
int ninbuf;
int io;
int pflag;
int ninbuf;
int io;
int pflag;
-long lseek();
-int (*oldhup)();
-int (*oldquit)();
+sig_t oldhup;
+sig_t oldquit;
int vflag = 1;
int vflag = 1;
@@
-68,7
+72,7
@@
int col;
char *globp;
int tfile = -1;
int tline;
char *globp;
int tfile = -1;
int tline;
-char tfname[
] = "/tmp/eXXXXX"
;
+char tfname[
sizeof(_PATH_TMP) + 20]
;
char *loc1;
char *loc2;
char *locs;
char *loc1;
char *loc2;
char *locs;
@@
-94,17
+98,16
@@
int *address();
char *getline();
char *getblock();
char *place();
char *getline();
char *getblock();
char *place();
-char *mktemp();
-char *malloc();
-char *realloc();
jmp_buf savej;
jmp_buf savej;
+void onintr(), quit(), onhup();
+
main(argc, argv)
main(argc, argv)
-char **argv;
+ int argc;
+ char **argv;
{
register char *p1, *p2;
{
register char *p1, *p2;
- extern int onintr(), quit(), onhup();
- int (*oldintr)();
+ sig_t oldintr;
oldquit = signal(SIGQUIT, SIG_IGN);
oldhup = signal(SIGHUP, SIG_IGN);
oldquit = signal(SIGQUIT, SIG_IGN);
oldhup = signal(SIGHUP, SIG_IGN);
@@
-137,7
+140,9
@@
char **argv;
globp = "r";
}
zero = (int *)malloc(nlall*sizeof(int));
globp = "r";
}
zero = (int *)malloc(nlall*sizeof(int));
- mktemp(tfname);
+ (void)strcpy(tfname, _PATH_TMP);
+ (void)strcat(tfname, "_edXXXXXX");
+ (void)mktemp(tfname);
init();
if (((int)oldintr&01) == 0)
signal(SIGINT, onintr);
init();
if (((int)oldintr&01) == 0)
signal(SIGINT, onintr);
@@
-548,18
+553,20
@@
exfile()
}
}
}
}
+void
onintr()
{
onintr()
{
- signal(SIGINT, onintr);
+ /* not necessary: (void)signal(SIGINT, onintr); */
putchr('\n');
lastc = '\n';
error(Q);
}
putchr('\n');
lastc = '\n';
error(Q);
}
+void
onhup()
{
onhup()
{
- signal(SIGINT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
+ /* not necessary: (void)signal(SIGINT, SIG_IGN); */
+ /* not necessary: (void)signal(SIGHUP, SIG_IGN); */
if (dol > zero) {
addr1 = zero+1;
addr2 = dol;
if (dol > zero) {
addr1 = zero+1;
addr2 = dol;
@@
-746,7
+753,8
@@
int (*f)();
callunix()
{
callunix()
{
- register (*savint)(), pid, rpid;
+ register sig_t savint;
+ register int pid, rpid;
int retcode;
setnoaddr();
int retcode;
setnoaddr();
@@
-763,6
+771,7
@@
callunix()
puts("!");
}
puts("!");
}
+void
quit()
{
if (vflag && fchange && dol!=zero) {
quit()
{
if (vflag && fchange && dol!=zero) {