Fix samsave handling. - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 8bd039bda9589be301e4621d597a0b8792d9bbba
 (DIR) parent caf2df597a195145f35578b6f22600bb6c57b9c4
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Sun,  4 Sep 2016 22:00:49 -0500
       
       Fix samsave handling.
       
       There were various problems with the way sam.save was written and passed
       to samsave, many arising from the right way to shebang it.
       
       The way we do it now is simpler: rely on the POSIX requirement that a
       file that isn't an executable (and doesn't have a #!) is passed directly
       to /bin/sh. This should "just work" on any reasonably POSIXy system.
       
       Diffstat:
         sam/Makefile                        |       2 +-
         sam/sam.c                           |       4 ++--
       
       2 files changed, 3 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/sam/Makefile b/sam/Makefile
       @@ -32,7 +32,7 @@ RXSAMNAME=rsam
        
        SAMSAVE=/bin/sh\\n$(SAMSAVEDIR)/samsave
        
       -CFLAGS=$(STANDARDS) $(INCS) $(INCLUDES)
       +CFLAGS=$(STANDARDS) $(INCS) $(INCLUDES) -DSAMSAVEDIR='"$(SAMSAVEDIR)"'
        
        LIB=../libframe/libframe.a ../libXg/libXg.a
        CC?=c99
 (DIR) diff --git a/sam/sam.c b/sam/sam.c
       @@ -146,7 +146,7 @@ rescue(void)
                                continue;
                        if(io == -1){
                                sprint(buf, "%s/sam.save", home);
       -                        io = create(buf, 1, 0777);
       +                        io = create(buf, 1, 0700);
                                if(io<0)
                                        return;
                        }
       @@ -157,7 +157,7 @@ rescue(void)
                                free(c);
                        }else
                                sprint(buf, "nameless.%d", nblank++);
       -                fprint(io, "#!%s '%s' $* <<'---%s'\n", "samsave", buf, buf);
       +                fprint(io, "%s '%s' $* <<'---%s'\n", SAMSAVEDIR "/samsave", buf, buf);
                        addr.r.p1 = 0, addr.r.p2 = f->nrunes;
                        writeio(f);
                        fprint(io, "\n---%s\n", (char *)buf);