Introduction
Introduction Statistics Contact Development Disclaimer Help
Remove unneeded Plan 9 code. - sam - An updated version of the sam text editor.
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit d411e3e2206e3534e76c0b4540c705087cc4520d
parent 1949e700289945a502275ebd626ec24f430ffb82
Author: Rob King <[email protected]>
Date: Thu, 11 Aug 2016 12:43:30 -0500
Remove unneeded Plan 9 code.
They have their own sam. :)
Diffstat:
sam/plan9.c | 174 -------------------------------
samterm/plan9.c | 113 -------------------------------
2 files changed, 0 insertions(+), 287 deletions(-)
---
diff --git a/sam/plan9.c b/sam/plan9.c
@@ -1,174 +0,0 @@
-/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
-#include "sam.h"
-
-Rune samname[] = L"~~sam~~";
-
-Rune *left[]= {
- L"{[(<«",
- L"\n",
- L"'\"`",
- 0
-};
-Rune *right[]= {
- L"}])>»",
- L"\n",
- L"'\"`",
- 0
-};
-
-char RSAM[] = "sam";
-char SAMTERM[] = "/bin/aux/samterm";
-char HOME[] = "home";
-char TMPDIR[] = "/tmp";
-char SH[] = "rc";
-char SHPATH[] = "/bin/rc";
-char RX[] = "rx";
-char RXPATH[] = "/bin/rx";
-char SAMSAVECMD[] = "/bin/rc\n/sys/lib/samsave";
-
-void
-dprint(char *z, ...)
-{
- char buf[BLOCKSIZE];
- va_list arg;
-
- va_start(arg, z);
- doprint(buf, &buf[BLOCKSIZE], z, arg);
- va_end(arg);
- termwrite(buf);
-}
-
-void
-print_ss(char *s, String *a, String *b)
-{
- dprint("?warning: %s: `%.*S' and `%.*S'\n", s, a->n, a->s, b->n, b->s);
-}
-
-void
-print_s(char *s, String *a)
-{
- dprint("?warning: %s `%.*S'\n", s, a->n, a->s);
-}
-
-char*
-getuser(void)
-{
- static char user[NAMELEN];
- int fd;
-
- if(user[0] == 0){
- fd = open("/dev/user", 0);
- if(fd<0 || read(fd, user, sizeof user)<=0)
- strcpy(user, "none");
- close(fd);
- }
- return user;
-}
-
-int
-statfile(char *name, ulong *dev, ulong *id, long *time, long *length, long *ap…
-{
- Dir dirb;
-
- if(dirstat(name, &dirb) == -1)
- return -1;
- if(dev)
- *dev = dirb.type|(dirb.dev<<16);
- if(id)
- *id = dirb.qid.path;
- if(time)
- *time = dirb.mtime;
- if(length)
- *length = dirb.length;
- if(appendonly)
- *appendonly = dirb.mode & CHAPPEND;
- return 1;
-}
-
-int
-statfd(int fd, ulong *dev, ulong *id, long *time, long *length, long *appendon…
-{
- Dir dirb;
-
- if(dirfstat(fd, &dirb) == -1)
- return -1;
- if(dev)
- *dev = dirb.type|(dirb.dev<<16);
- if(id)
- *id = dirb.qid.path;
- if(time)
- *time = dirb.mtime;
- if(length)
- *length = dirb.length;
- if(appendonly)
- *appendonly = dirb.mode & CHAPPEND;
- return 1;
-}
-
-void
-notifyf(void *a, char *s)
-{
- USED(a);
- if(bpipeok && strcmp(s, "sys: write on closed pipe") == 0)
- noted(NCONT);
- if(strcmp(s, "interrupt") == 0)
- noted(NCONT);
- panicking = 1;
- rescue();
- noted(NDFLT);
-}
-
-int
-newtmp(int num)
-{
- int i, fd;
- static char tempnam[30];
-
- i = getpid();
- do
- sprint(tempnam, "%s/%d%.4s%dsam", TMPDIR, num, getuser(), i++);
- while(access(tempnam, 0) == 0);
- fd = create(tempnam, ORDWR|OCEXEC|ORCLOSE, 0000);
- if(fd < 0){
- remove(tempnam);
- fd = create(tempnam, ORDWR|OCEXEC|ORCLOSE, 0000);
- }
- return fd;
-}
-
-int
-waitfor(int pid)
-{
- int rpid;
- Waitmsg wm;
-
- do; while((rpid = wait(&wm)) != pid && rpid != -1);
- return wm.msg[0];
-}
-
-void
-samerr(char *buf)
-{
- sprint(buf, "%s/sam.err", TMPDIR);
-}
-
-void*
-emalloc(ulong n)
-{
- void *p;
-
- p = malloc(n);
- if(p == 0)
- panic("malloc fails");
- memset(p, 0, n);
- return p;
-}
-
-void*
-erealloc(void *p, ulong n)
-{
- p = realloc(p, n);
- if(p == 0)
- panic("realloc fails");
- return p;
-}
diff --git a/samterm/plan9.c b/samterm/plan9.c
@@ -1,113 +0,0 @@
-/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
-#include <u.h>
-#include <libc.h>
-#include <libg.h>
-#include <frame.h>
-#include "flayer.h"
-#include "samterm.h"
-
-static char exname[64];
-
-void
-getscreen(int argc, char **argv)
-{
- USED(argc);
- USED(argv);
- binit1(panic, 0, "sam", 1);
- bitblt(&screen, screen.clipr.min, &screen, screen.clipr, 0);
-}
-
-int
-screensize(int *w, int *h)
-{
- int fd, n;
- char buf[5*12+1];
-
- fd = open("/dev/screen", OREAD);
- if(fd < 0)
- return 0;
- n = read(fd, buf, sizeof(buf)-1);
- close(fd);
- if (n != sizeof(buf)-1)
- return 0;
- buf[n] = 0;
- if (h) {
- *h = atoi(buf+4*12)-atoi(buf+2*12);
- if (*h < 0)
- return 0;
- }
- if (w) {
- *w = atoi(buf+3*12)-atoi(buf+1*12);
- if (*w < 0)
- return 0;
- }
- return 1;
-}
-
-int
-snarfswap(char *fromsam, int nc, char **tosam)
-{
- char *s1;
- int f, n;
-
- f = open("/dev/snarf", 0);
- if(f < 0)
- return -1;
- *tosam = s1 = alloc(SNARFSIZE);
- n = read(f, s1, SNARFSIZE-1);
- close(f);
- if(n < 0)
- n = 0;
- if (n == 0) {
- *tosam = 0;
- free(s1);
- } else
- s1[n] = 0;
- f = create("/dev/snarf", 1, 0666);
- if(f >= 0){
- write(f, fromsam, nc);
- close(f);
- }
- return n;
-}
-
-void
-dumperrmsg(int count, int type, int count0, int c)
-{
- fprint(2, "samterm: host mesg: count %d %x %x %x %s...ignored\n",
- count, type, count0, c, rcvstring());
-}
-
-void
-removeextern(void)
-{
- remove(exname);
-}
-
-void
-extstart(void)
-{
- char buf[32];
- int fd, p[2];
-
- if(pipe(p) < 0)
- return;
- sprint(exname, "/srv/sam.%s", getuser());
- fd = create(exname, 1, 0600);
- if(fd < 0){ /* assume existing guy is more important */
- Err:
- close(p[0]);
- close(p[1]);
- return;
- }
- sprint(buf, "%d", p[0]);
- if(write(fd, buf, strlen(buf)) <= 0)
- goto Err;
- close(fd);
- /*
- * leave p[0] open so if the file is removed the event
- * library won't get an error
- */
- estart(Eextern, p[1], 8192);
- atexit(removeextern);
-}
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.