BSD 1 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Sun, 27 Nov 1977 02:14:03 +0000 (18:14 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Sun, 27 Nov 1977 02:14:03 +0000 (18:14 -0800)
Work on file s6/number.c
Work on file s6/prints6
Work on file s6/pascals.c
Work on file s6/ssp.c

Synthesized-from: 1bsd

s6/number.c [new file with mode: 0644]
s6/pascals.c [new file with mode: 0644]
s6/prints6 [new file with mode: 0755]
s6/ssp.c [new file with mode: 0644]

diff --git a/s6/number.c b/s6/number.c
new file mode 100644 (file)
index 0000000..79324bb
--- /dev/null
@@ -0,0 +1,44 @@
+#
+/*
+ * number - a cat like program which prints lines like the editor '#'' command
+ *
+ * Bill Joy UCB June 28, 1977
+ */
+int    ibuf[259];
+extern fout;
+
+int    lino;
+
+main(argc, argv)
+       int argc;
+       char *argv[];
+{
+       register c;
+       register lastc;
+
+       fout = dup(1);
+       argc--, argv++;
+       do {
+               if (argc > 0) {
+                       if (fopen(argv[0], ibuf) < 0) {
+                               flush();
+                               perror(argv[0]);
+                               flush();
+                               exit(1);
+                       }
+                       argc--, argv++;
+               }
+               lastc = '\n';
+               for (;;) {
+                       c = getc(ibuf);
+                       if (c == -1)
+                               break;
+                       if (lastc == '\n')
+                               printf("%6d  ", ++lino);
+                       lastc = c;
+                       putchar(c);
+               }
+       } while (argc > 0);
+       flush();
+       exit(0);
+}
diff --git a/s6/pascals.c b/s6/pascals.c
new file mode 100644 (file)
index 0000000..b1a7456
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * pcs - C front end for pascals
+ *
+ * Author: Bill Joy UCB June 1977
+ *
+ * This program implements Pascals as though it were
+ * a real program with a syntax:
+ *
+ *     pcs program
+ *
+ * Note that it is too large to be interpreted with a px that
+ * does not run in separate i/d space.
+ */
+char   pcs[]   "/usr/lib/pascals";
+
+main(argc, argv)
+       int argc;
+       char *argv[];
+{
+       if (argc != 2) {
+               printf("Usage: %s file\n", argv[0]);
+               exit (1);
+       }
+       close(0);
+       if (open(argv[1], 0) < 0) {
+               perror(argv[1]);
+               exit(1);
+       }
+       execl("/bin/px", "px", pcs, 0);
+       execl("/usr/bin/px", "px", pcs, 0);
+       write(2, "Can't find px\n", 14);
+       exit(1);
+}
diff --git a/s6/prints6 b/s6/prints6
new file mode 100755 (executable)
index 0000000..e2a2862
--- /dev/null
@@ -0,0 +1,3 @@
+rm a.out x xx
+pr [a-h]*
+pr [i-z]*
diff --git a/s6/ssp.c b/s6/ssp.c
new file mode 100644 (file)
index 0000000..876d6d3
--- /dev/null
+++ b/s6/ssp.c
@@ -0,0 +1,69 @@
+/*
+ * ssp - single space output
+ *
+ * Bill Joy UCB August 25, 1977
+ *
+ * Compress multiple empty lines to a single empty line.
+ * Option - compresses to nothing.
+ */
+
+char   poof, hadsome;
+
+int    ibuf[259];
+
+extern int fout;
+
+main(argc, argv)
+       int argc;
+       char *argv[];
+{
+       register int c;
+
+       argc--, argv++;
+       do {
+               while (argc > 0 && argv[0][0] == '-') {
+                       poof = 1;
+                       argc--, argv++;
+               }
+               if (argc > 0) {
+                       if (fopen(argv[0], ibuf) < 0) {
+                               flush();
+                               perror(argv[0]);
+                               exit(1);
+                       }
+                       argc--, argv++;
+               }
+               for (;;) {
+                       c = getc(ibuf);
+                       if (c == -1)
+                               break;
+                       if (c != '\n') {
+                               hadsome = 1;
+                               putchar(c);
+                               continue;
+                       }
+                       /*
+                        * Eat em up
+                        */
+                       if (hadsome)
+                               putchar('\n');
+                       c = getc(ibuf);
+                       if (c == -1)
+                               break;
+                       if (c != '\n') {
+                               putchar(c);
+                               hadsome = 1;
+                               continue;
+                       }
+                       do
+                               c = getc(ibuf);
+                       while (c == '\n');
+                       if (!poof && hadsome)
+                               putchar('\n');
+                       if (c == -1)
+                               break;
+                       putchar(c);
+                       hadsome = 1;
+               }
+       } while (argc > 0);
+}