Date: Tue, 25 Jul 1995 15:41:21 -0700 (PDT) From: ambrisko@tcs.com (Douglas Ambrisko) To: hackers@freefall.cdrom.com Subject: Shell commands for iij config scripts Message-ID: <9507252241.AA02416@cozumel.tcs.com> In-Reply-To: <199507251230.FAA23459@freefall.cdrom.com> from "owner-hackers-digest@freefall.cdrom.com" at Jul 25, 95 05:30:17 am
next in thread | previous in thread | raw e-mail | index | archive | help
Here is a couple of hacks I made to iij-ppp, I'd like these capabilities
added.
to main.c so that is would start ppp negotiation in auto mode. This is so
it will work with slirp, it also still works with my straight ppp provider
that isn't in my local call whereas my slirp connection is!
*** main.c.orig Tue Jul 25 15:00:09 1995
--- main.c Tue Jul 25 15:00:44 1995
***************
*** 378,384 ****
CcpInit();
LcpUp();
! if (mode & (MODE_DIRECT|MODE_DEDICATED))
LcpOpen(OPEN_ACTIVE);
else
LcpOpen(VarOpenMode);
--- 378,384 ----
CcpInit();
LcpUp();
! if (mode & (MODE_DIRECT|MODE_DEDICATED|MODE_AUTO))
LcpOpen(OPEN_ACTIVE);
else
LcpOpen(VarOpenMode);
to command.c so I can run a script from the config file when the link comes
up (like dequeue any mail waiting on my system or at my providers site for
me and update my named config file since slirp's DNS server keeps changing
depending on the machine I get connected to)
*** command.c.orig Tue Jul 25 14:55:00 1995
--- command.c Tue Jul 25 14:57:27 1995
***************
*** 168,173 ****
--- 168,175 ----
"Save settings", StrNull},
{ "set", "setup", SetCommand, LOCAL_AUTH,
"Set parameters", "var value"},
+ { "shell", NULL, ShellCommand, LOCAL_AUTH,
+ "Set parameters", "var value"},
{ "show", NULL, ShowCommand, LOCAL_AUTH,
"Show status and statictics", "var"},
{ "term", NULL, TerminalCommand,LOCAL_AUTH,
***************
*** 785,790 ****
--- 787,812 ----
return(val);
}
+ static int
+ ShellCommand(list, argc, argv)
+ struct cmdtab *list;
+ int argc;
+ char **argv;
+ {
+ int val = 1;
+ int count = 0;
+ char command[8192] /* this is bad */;
+
+ if (argc > 0){
+ for(command[0]=0;count<argc;count++){
+ strcat(command," ");
+ strcat(command,argv[count]);
+ }
+ val = system(command);
+ }else
+ printf("Use ``shell <command>''.\n");
+ return(val);
+ }
static int
AddCommand(list, argc, argv)
The reason why I did this, is that my phone bill was to expensive, my ppp
connection was not in my local calling area and I had a shell account that
was. So I run two iij-ppp auto sessions, a generic one that uses my
shell account with slirp for general net surfing and the ppp-account to
dequeue smtp mail waiting for my machine. Now I just have a ping in my
crontab and that automatically dequeues my mail waiting for me once a day
and my phone bill is a lot lower.
Doug A.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9507252241.AA02416>
