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
date and time created 88/07/21 17:35:50 by marc
[unix-history]
/
usr
/
src
/
local
/
local.cmd
/
cpr.c
diff --git
a/usr/src/local/local.cmd/cpr.c
b/usr/src/local/local.cmd/cpr.c
index
6f23f19
..
81eae98
100644
(file)
--- a/
usr/src/local/local.cmd/cpr.c
+++ b/
usr/src/local/local.cmd/cpr.c
@@
-2,7
+2,7
@@
# include <sgtty.h>
# include <signal.h>
# include <sgtty.h>
# include <signal.h>
-static char SccsId[] = "@(#)cpr.c 1.
4
%G%";
+static char SccsId[] = "@(#)cpr.c 1.
8
%G%";
/*
** CPR -- print on concept 108
/*
** CPR -- print on concept 108
@@
-18,13
+18,16
@@
static char SccsId[] = "@(#)cpr.c 1.4 %G%";
** -f form feed following to print.
*/
** -f form feed following to print.
*/
+#define LINELEN 132 /* carriage width */
+
typedef char bool;
#define TRUE 1
#define FALSE 0
struct sgttyb tbuf;
typedef char bool;
#define TRUE 1
#define FALSE 0
struct sgttyb tbuf;
-int SysLine;
-bool FormFeedFollowing;
+int SysLinePid; /* pid of sysline process */
+bool FormFeedFollowing; /* print form feed following print */
+bool EchoDuringPrint; /* echo on terminal while printing */
main(argc, argv)
int argc;
main(argc, argv)
int argc;
@@
-37,20
+40,23
@@
main(argc, argv)
/* arrange to stop the sysline program during printing */
p = getenv("SYSLINE");
if (p != NULL)
/* arrange to stop the sysline program during printing */
p = getenv("SYSLINE");
if (p != NULL)
- SysLine = atoi(p);
+ SysLine
Pid
= atoi(p);
/* process arguments */
while (--argc > 0)
{
p = *++argv;
/* process arguments */
while (--argc > 0)
{
p = *++argv;
- if (*p == '-')
+ if (*p != '-')
+ break;
+ switch (*++p)
{
{
- switch (*++p)
- {
- case 'f':
- FormFeedFollowing = TRUE;
- break;
- }
+ case 'f':
+ FormFeedFollowing = TRUE;
+ break;
+
+ case 'e':
+ EchoDuringPrint = TRUE;
+ break;
}
}
}
}
@@
-61,14
+67,15
@@
main(argc, argv)
setupterm();
/* print the appropriate files */
setupterm();
/* print the appropriate files */
- if (argc <
2
)
+ if (argc <
1
)
copyfile();
else
{
copyfile();
else
{
- while (
--argc
> 0)
+ while (
argc--
> 0)
{
{
- if (freopen(*++argv, "r", stdin) == NULL)
- perror(*argv);
+ p = *argv++;
+ if (freopen(p, "r", stdin) == NULL)
+ perror(p);
else
copyfile();
}
else
copyfile();
}
@@
-80,11
+87,6
@@
main(argc, argv)
copyfile()
{
copyfile()
{
- char buf[200];
- register char *p;
- extern char *index();
-
- while (fgets(buf, sizeof buf, stdin) != NULL)
{
p = index(buf, '\n');
if (p == NULL)
{
p = index(buf, '\n');
if (p == NULL)
@@
-111,11
+113,9
@@
setupterm()
}
oldflags = tbuf.sg_flags;
tbuf.sg_flags &= ~ECHO;
}
oldflags = tbuf.sg_flags;
tbuf.sg_flags &= ~ECHO;
- tbuf.sg_flags |= CBREAK;
+ tbuf.sg_flags |= CBREAK
| XTABS
;
stty(1, &tbuf);
tbuf.sg_flags = oldflags;
stty(1, &tbuf);
tbuf.sg_flags = oldflags;
- if (SysLine > 0)
- kill(SysLine, SIGSTOP);
}
cleanterm()
}
cleanterm()
@@
-142,6
+142,6
@@
getack()
resetmodes()
{
stty(1, &tbuf);
resetmodes()
{
stty(1, &tbuf);
- if (SysLine > 0)
- kill(SysLine, SIGCONT);
+ if (SysLine
Pid
> 0)
+ kill(SysLine
Pid
, SIGCONT);
}
}