🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.d
Article #5027

Re: callback source

#5027
From: Mike Fields
Date: Fri, 19 May 1989 17:48
96 lines
3151 bytes
In article <324@arc.UUCP>, chet@arc.UUCP (Chet Wood) writes:
> In article <180004@mechp10.UUCP>,  Greg Klein writes:
> 
> > About a month ago I posted a request for getty and login source code that
> > I could use to write a callback program.  Here's what I came up with.
> 
> Does anybody have a call back program that'll work under BSD? 
> 
> Thanks in advance,
> 
> Chet Wood                       ~                         (408)727-3357
>      arc!chet@apple.COM         .  Advansoft Research Corporation
>           chet@arc.UUCP         .       4301 Great America Parkway
>                apple!arc!chet   .            Santa Clara, CA 95054, USA

I asked the same question some time ago and was sent the following 
program (it is fairly short and it works! - not fancy - add your own
bells and whistles)


>From: ssc-vax!uw-beaver!rutgers!hardy.nbi.com!harlan (Harlan Olson)
X-Mailer: ELM [version 2.2 PL6]

Maybe this might help you.

-- 
Harlan Olson
Customer Support Training        |       2995 Wilderness Pl.
303/443-9892 x2208               |       Boulder, CO  80301
{alegra,ucbvax,ncar,isieng}!nbires!hardy!harlan (USENET)



-----------------cut here ---------------------
#include <sgtty.h>

/*
 * Call back program
 * CHANGE THE PHONE NUMBER TO YOUR OWN!!!
 * To compile: cc -O -o callback callback.c
 * To use: after logging in as normal, type: exec callback
 * The exec is a shell internal command which causes the shell to execute the
 * specified command without forking.  This is necessary because callback must
 * be run as the top-level process of a login session.
 */

char *phone_number = "9,7763232";

main ()
  {
	struct sgttyb sgttyb;
	int oflags, olbits, lbits = LNOHANG|LNOMDM;

	sleep (3);
	ioctl (0, TIOCLGET, &olbits);
	ioctl (0, TIOCLBIS, &lbits);

	ioctl (0, TIOCGETP, &sgttyb);
	oflags = sgttyb.sg_flags;
	sgttyb.sg_flags &= ~ECHO;
	ioctl (0, TIOCSETP, &sgttyb);

	sleep (2);
	write (1, "+++", 3);
	sleep (2);

	write (1, "AT Z\r", 5);
	sleep (2);

	write (1, "AT H0\r", 6);
	sleep (3);

	write (1, "AT V0 DT ", 9);
	write (1, phone_number, strlen(phone_number));
	write (1, "\r", 1);
	sleep (23);
	ioctl (0, TIOCFLUSH, 0);

	ioctl (0, TIOCLSET, &olbits);

	sgttyb.sg_flags = oflags;
	ioctl (0, TIOCSETP, &sgttyb);

	execl ("/bin/login", "login", (char *)0);
	write (1, "Whoops!\r\n", 9);
	sleep (3);
}




-- 
Mikey (yes "he likes it!")
=======================================================   Mike Fields
uw-beaver!ssc-vax!shuksan!mikey  (206) 393-3768 [work]    12022 NE 138th Pl.
(alt) ssc-vax!mikey              (206) 821-3492 [home]    Kirkland, Wa. 98034
Technical Details
Message-ID: <1348@shuksan.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bbn!mailrus!cornell!uw-beaver!ssc-vax!shuksan!mikey
References: <180004@mechp10.UUCP> <324@arc.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bbn!mailrus!cornell!uw-beaver!ssc-vax!shuksan!mikey
From: mikey@shuksan.UUCP (Mike Fields)
Newsgroups: comp.sources.d
Subject: Re: callback source
Summary: callback programs
Keywords: callback, getty, login
Message-ID: <1348@shuksan.UUCP>
Date: 19 May 89 17:48:51 GMT
References: <180004@mechp10.UUCP> <324@arc.UUCP>
Organization: The Boeing Co., BAC MMST, Seattle, WA
Lines: 96