Subject: summary: kermit fix (and kill -STOP) Thanks all who helped!
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Mark F Willey <willey@ecn.purdue.edu>
List: current-users
Date: 07/30/1994 14:00:18
All,

Thanks, everyone, who sent help WRT my Kermit problem.  Here's a summary of
what I've done for anyone still struggling:

First off, I deleted my /dev/com? files and only used the /dev/tty0? files.
I guess they're a throwback from 0.9?

I changed my modem line in /etc/ttys to read:
tty00   "/usr/libexec/getty std.9600"   unknown off secure local

(I added the "local" flag...)

I then got C-Kermit 5a(190) from
kermit.columbia.edu:/kermit/test/bin/cku190.tar.gz

and applied the following patch to ckutio.c:
(I know this probably isn't the right way to show a patch, but you can
figure out what to do from this.  I got this by doing a "diff ckutio.c
ckutio.c.dist" or maybe the file order was switched.  Anyone have the dirt
on how to make a patch file correctly?  Someone sent me a patch that
failed, but I patched by hand to get this.  (Thanks!))

7179d7178
< #ifndef __NetBSD__
7182,7185d7180
< #else
< #define switchuid(hidden,active)        seteuid(active)
< #define switchgid(hidden,active)        setegid(active)
< #endif

Then, I did a "make bsd44 KFLAGS=-DNOCOTFMC" on kermit.  It produced a
binary called "wermit" which I renamed and moved to /usr/local/bin.  I
chmodded it 4755 and chowned it to uucp.  My tty0? files are rw by uucp
only.  (well, actually, now they're rw by everyone because else I couldn't
get "term" to write to the device.  I suppose I could patch the source in a
similar way as kermit's seteuid, etc...

Finally, I needed a way to have kermit be suspended, but not the calling
shell script.  Under 0.9, I just did a "!kill -STOP kermit_pid" in my
kermit script.  (Kermit's suspend command would stop the calling /bin/sh
script as well.  Well, under 1.0-alpha, that kill would stop the calling
script as well.  Why is this?  I've thought of some things that might have
changed:

1) behavior of kill(1)  (I don't think so - 0.9's kill had same prob...)
2) effect of -STOP signal changed
3) /bin/sh scripts no longer set child's pgrp to a new value
4) voodo magic

If anybody, know, please tell why.  I'm curious.

Anyhow, I wrote (after advice from a fellow user on The List) the following
C program, which is probably really crappy because I haven't written
anything meaningful in C for quite a while, and I had to make liberal use
of the "man" comman, and even "man -k" in order to write this.  but, it
works.  If anyone cleans it up, please send me the new version just for
laughs.  Here it is: wrapper.c

---CUT HERE---
/*

WRAPPER - set PGID to PID and system() a command for you

Written by willeyma@sage.cc.purdue.edu (soon to be @expert.cc...)

Nah, it ain't copyrighted.  What do I care?  ;-)
This program will set the PGID to the PID and then call a command,
so that you can force a PGID change for signalling purposes...

It compiles under NetBSD-current (July, 1994), and hopefully on your UNIX
of choice.

Fri Jul 29 1994  (Okay, so I wrote it on a Friday night...  So???  ;-) )

*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

main (int argc, char *argv[]) {

short pgid, pid, ppid, set_failed;
int errno, err;
char *command[300];

  if (argc != 2) {
    fprintf (stderr, "\nusage:\n\n\twrapper command\ncommand - command to execut
e\n\n");
    exit (1);
  }

  strncpy (command, argv[1], 299);
  pid = getpid();

  set_failed = setpgrp (getpid(), pid);

  if (set_failed) {
    err = errno;
    ppid = getppid();
    perror ("wrapper error: ");
    fprintf (stderr, "wrapper error: setpgrp (%d, %d) failed!\n",err,pid,pgid);
    fprintf (stderr, "wrapper error: number %d\n",err);
    exit (2);
  }

  system (command);
}
---CUT HERE---

---
                 Ask me about FREE UNIX and X for your PC.
           http://www.ecn.purdue.edu:8001/data/users/willey/mfw.html
willeyma@sage.cc.purdue.edu SOON TO BE @expert.cc... Mark Willey

------------------------------------------------------------------------------