SUMMARY: menu scripts

From: sunacct (sunm@nhm.ac.uk)
Date: Wed Jun 04 1997 - 12:43:14 CDT


Hello Sun-managers,

First & foremost many thanks to the following ;-

Michael Zimmerman <zimmer@pop.psu.edu>
Steve Boyko <SBoyko@nbpower.com>
Kent R Arnott <karnott@falcon.tamucc.edu>
Garry Robbins <Garry.Robbins@Labatt.com>
Stuart Lawson"<Stuart_Lawson@ivax.com>
Rachel Polanskis <rachel@juno.virago.org.au>

THE QUESTION...
---------------

>Hello sun-managers,
>
>I'm looking for a software package ( scripts, pointers to web sites etc.)
>that will allow the use of menus to run user software. Ideally the package
>would be
>easily maintainable and simple to use (ascii?). It's primary use would be
>for novices to Unix. I've searched the archives and have not come up with
>anything
>useful. I will summarise.

THE ANSWERS...
--------------

The job can be done quick and dirty :) by scripts, other alternatives are
a package called "menu", or FMLI in Solaris
------------------------------------------------------------------------
Stuart suggested the following :
It should be quite simple to set something up, along the lines of
(C-shell):

echo '(1) Package 1...'
echo '(2) Package 2 ...'
echo '(3) Package 3 ...'

set reply = $<

switch ($reply):
    case '1'
           /usr/bin/package_1
    case '2'
          /usr/bin/package_2
    case '3'
          /usr/bin/package_3
end switch

....or something like this.
----------------------------

Rachel suggested that...

Solaris comes with FMLI the "Forms and Menu Language Interface".
Documentation is sparse.
The product is extremely useful.

Have a look in: /usr/vmsys

------------------------------
There is a package called "menu" which also does the trick, it's written by
by Paul J. Condie. It uses Curses in a terminal environment.

It can be found at ftp.mfi.com in /pub/sysadmin.

There was an article about it in the February 1997 issue of SysAdmin
magazine. This article is in fact on the Web at

http://www.samag.com/602art.htm.

A perl script was also sent, thanks Kent!

Saja
Sys. Admin.

---

here goes....

----------------------------------------------------------------------------- >From :Kent R Arnott <karnott@falcon.tamucc.edu>.... Hi here is one :

#!/usr/bin/perl # # # menu: This perl v4.036 script is easy to modify on the fly menu # system to aid non-UNIX lovers and newbies but probably is not # the best perl coding around (my reply to that is simple, # it works! :) # # This is a simple menu system to aid the non-UNIX users of a # UNIX system get things accomplished. Although I love UNIX # and feel everyone should learn it, it is easier to setup a # menu system that is both easy to maintain and easy to use for # users who refuse to learn UNIX or for old secretarys that # just want to check their e-mail or in some cases Usenet news # (*grin*). # # This is currently running on a DECstation 5000/240 running # ULTRIX 4.3A.A. and a DECAlpha AXP 3000/900 and a Sun Netra. # # make any modifications you would like and then copy this script # to /usr/local/bin/menu and chmod 755 and inform the users # to type menu at the prompt after logging in, this assumes # /usr/local/bin/ is in their path. # # # Send comments or suggestions to the programmer: # Kent Arnott # Systems Programmer II, Systems Administrator # Texas A&M University-Corpus Christi # 6300 Ocean Drive Corpus Christi, Texas 78412 # e-mail: karnott@tamucc.edu phone:(512)994-2693 # # # LAST MODIDFICATION DATE May 11, 1995 # # menu is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 1, or (at your option) any later version. # # menu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # menu. If not, write to: # # The Free Software Foundation # 675 Mass Ave # Cambridge, MA 02139, USA # ######################################################################### # ENVIRONMENT -- PROGRAMS $me=getlogin; $HOME=$ENV{"HOME"}; %editors=(); $editors{"1"}="/usr/ucb/vi"; $editors{"2"}="$LOCHOME/pico"; $LOCHOME="/usr/local/bin"; $tel="/usr/ucb/telnet"; $tn="$LOCHOME/tn3270"; $lyn="$LOCHOME/lynx"; $gop="$LOCHOME/gopher";

# FILES -- DOCUMENTS $DOCHOME="/usr/local/doc"; $DIALIN="$DOCHOME/dialin.help"; $VIRULZ="$DOCHOME/vihelp"; $LIBHELP="$DOCHOME/library.help"; $PINEHELP="$DOCHOME/pine.help"; $PROFILE="$HOME/.profile"; $LOGIN="$HOME/.login"; $MOTD="/etc/motd";

# # MAIN MENU # &cls;

do { chop($prompt = <<'EOP');

MAIN MENU

1 - Electronic mail (pine) 2 - Other Internet stuff 3 - Change my password 4 - Read the Message of the Day 5 - Help Files

7 - Library Electronic Resources 8 - Exit to shell 9 - Logoff

Enter choice: EOP print $prompt; $choice=substr(<STDIN>,0,1);

system("$LOCHOME/pine") if $choice eq 1; &internet_options if $choice eq 2; &passwd if $choice eq 3; &Display($MOTD) if $choice eq 4; &help if $choice eq 5; if ($choice eq "g") { &cls; &gnublurb; sleep 2; &cls; }

&library if $choice eq 7;

&cls; } until (($choice eq 8) || ($choice eq 9));

if ($choice eq 9) { &cls; print "\nThat's the news, and I'm outta' here!!!\n"; sleep 2; $PID=getppid; kill 9, $PID; } else { &cls; print "\nTo return to the menu, type 'menu'.\n\n"; }

exit 0; ############################################################################## # # MENUS # # sub internet_options { &cls; do { chop($prompt = <<'EOP');

Network and Internet Applications

1 - Gopher [Wander the Net looking for info] 2 - Usenet [Read the Internet news] 3 - Lynx [A text based world wide web browser] 4 - Telnet [Connect to an off-campus site]

7 - Quote for the Day

9 - Return to the MAIN MENU

Enter choice: EOP print $prompt; $choice_i=substr(<STDIN>,0,1);

&gopher if $choice_i eq 1; system("$LOCHOME/tin") if $choice_i eq 2; &lynx if $choice_i eq 3; &telnet if $choice_i eq 4; &quote if $choice_i eq 7;

&cls; } until ($choice_i eq 9); }

sub help { &cls; do { chop($prompt = <<'EOP');

Help Files Menu

1 - Dialing into falcon 2 - A little help on the "vi" editor 3 - Electronic Library Help 4 - Pine(email) Notes

7 - UNIX and Internet Guides

9 - Return to the MAIN MENU

Enter choice: EOP print $prompt; $choice_h=substr(<STDIN>,0,1);

&Display($DIALIN) if $choice_h eq 1; &Display($VIRULZ) if $choice_h eq 2; &Display($LIBHELP) if $choice_h eq 3; &Display($PINEHELP) if $choice_h eq 4; &GetAsst if $choice_h eq 7;

&cls; } until ($choice_h eq 9); }

sub library { &cls; do { chop($prompt = <<'EOP');

Electronic Library Resources

1 - Portal (TAMU-CC Online Catalog) 2 - CD-ROM Databases 3 - Wilson Databases 4 - Uncover Databases 5 - Other TAMU Catalogs 6 - UT Austin Catalog 7 - TexShare

9 - Return to the MAIN MENU

Enter choice: EOP print $prompt; $choice_l=substr(<STDIN>,0,1);

&portal if $choice_l eq 1; &cdrom if $choice_l eq 2; &wilson if $choice_l eq 3; &uncover if $choice_l eq 4; &other_tamu if $choice_l eq 5; &uta if $choice_l eq 6; &texshare if $choice_l eq 7;

&cls; } until ($choice_l eq 9); }

# 1---------2---------3---=-----*&<$@ @$<&*1---------2---------3---------

# # SUBROUTINES and OTHER STUFF # # sub cls { system ("/usr/ucb/clear"); }

sub passwd { @password = getpwuid($<); $oldpasswd = $password[1]; system("/usr/local/bin/passwd"); @password = getpwuid($<); $newpasswd = $password[1]; ($oldpasswd ne $newpasswd) && print "\n Your password has changed\n"; sleep 3; }

sub check { $dest = `/etc/ping $place`; if ($dest =~ /is alive/) { system("$protocol $place $port"); } else { chop; print "\n$place is either down or does not exist. "; print "\n\nPress <ENTER> to continue..."; $_=<>; } }

sub Display { local($FILETOREAD) = @_; &cls; $line = 0; $screensize = 23; open(FILETOREAD,"<$FILETOREAD"); while(<FILETOREAD>) { $line += 1; if ($line%$screensize == 0) { print "Press <ENTER> to continue..."; $enter = <>; &cls; } print $_; } close(FILETOREAD); print "Press <ENTER> to continue..."; $enter = <>; }

sub gopher { &cls; print "\nEnter desired gopher site [gopher.tamucc.edu]: "; chop ($where=<>); if ($where eq "") { $place = "gopher.tamucc.edu"; $port = ""; } else { ($place,$port)=split(/ /,$where); } $protocol = "$gop"; &check;

}

sub lynx { &cls; print "\nWWW sites typically look like this: http://www.tamu.edu/\n"; print "\nWhere do you want to go: "; $www=<>; $test_www = (split(/\//,$www))[2]; $destination = `/etc/ping $test_www`; if ($destination =~ /is alive/) { system("$lyn -vikeys $www"); } else { print "\n$www is either down or does not exist."; print "\n\nPress <ENTER> to continue..."; $_=<>; } }

sub telnet { &cls; print "\nTELNET sites typically look like this: wuarchive.wustl.edu"; print "\n\nWhere do you want to go: "; $place = <STDIN>; $protocol = "$tel"; $port = ""; &check; }

sub quote { &cls; $place = "mudflap.tamucc.edu"; $port = "17"; $protocol = "$tel"; &check; $port = ""; }

sub GetAsst { system("$lyn -vikeys $DOCHOME/help1.html"); }

sub portal { &cls; chop($prompt = <<'EOP');

To log into Texas A&M University-Corpus Christi's Online Catalog type "library" when prompted for your login.

To get help please check under "Help Files" for library help.

You are about to enter portal.tamucc.edu

brought to you by the fine folks at Bell Library...

to continue press <ENTER> now. EOP print $prompt; $_=<>; $place = "portal.tamucc.edu"; $protocol = "$tel"; $port = ""; &check; }

sub cdrom { &cls; chop($prompt = <<'EOP');

CD-ACCESS KEY MAP CONVERSION CHART

When using the CD-ROM from remote sites (offices, dorms, labs) use the following chart to emulate PC-Key functions. The left column contains a list of PC keys. The right contains their equivalents. DOWNLOADING function on CD-ROM products is not available through remote access.

PC-Key equivalent Terminal =============================================== ESC ESC e F1 - F10 F1 - F10 F11 ESC - F12 ESC = PAGE UP ESC pu PAGE DOWN ESC pd HOME ESC { END ESC } INSERT ESC i DELETE ESC t CONTROL ESC c ALT ESC a DISCONNECT ESC xx REDRAW ESC xr

Press <RETURN> to continue... EOP print $prompt; $_=<>; $place = "165.95.5.64"; $protocol = "$tel"; $port = ""; &check;

} sub wilson { &cls; print "\n\nTo log into the Wilson Databases\n"; print "\n1. type \"notis\" when you see the aTm screen.\n"; print "2. then type \"indx\".\n"; print "3. next type \"wils\".\n"; print "4. You will then be asked to supply your social security number."; print "\n\nIf you SSN does not work, contact Sylvia Contreras at 994-2370"; print ".\nTo logoff of the Wilson Databases type \"stop\"\n\n"; print "\n\n\nTo get help please check under \"Help Files\" for "; print "library help\n\n\n"; print "\nto continue press <ENTER> now."; $_=<>; $place = "tammvs1.tamu.edu"; $protocol = "$tn"; $port = ""; &check; }

sub uncover { &cls; print "\n\nRead the welcome message for instructions."; print "\nUNCOVER is the ONLY database available without a password.\n"; print "to exit uncover type \"\/\/exit\""; print "\n\n\nTo get help please check under \"Help Files\" for "; print "library help\n\n\n"; print "\nto continue press <ENTER> now."; $_=<>; $place = "database.carl.org"; $protocol = "$tel"; $port = ""; &check; }

sub other_tamu { &cls; print "\n\nTo log into other Texas A&M University Databases\n"; print "\n1. type \"notis\" when you see the aTm screen.\n"; print "2. then type \"cat\".\n"; print "3. type the 5 letter prefix associated with the university you"; print "\nchoose to search.\n\n"; print "To logoff of the databases type \"stop\"\n\n"; print "\n\n\nTo get help please check under \"Help Files\" for "; print "library help\n\n\n"; print "\nto continue press <ENTER> now."; $_=<>; $place = "tammvs1.tamu.edu"; $protocol = "$tn"; $port = ""; &check; }

sub uta { &cls; print "\n\nTo log into University of Texas Austin Databases\n"; print "\n1. type \"utalib\" when you see the aTm screen.\n"; print "\n2. To search a catalog select \"1\" UTCAT online\n"; print "\nTo logoff of the database type \"10\"\n\n"; print "\n\n\nTo get help please check under \"Help Files\" for "; print "library help\n\n\n"; print "\nto continue press <ENTER> now."; $_=<>; $place = "tammvs1.tamu.edu"; $protocol = "$tn"; $port = ""; &check; }

sub texshare { &cls; print "\n\nYour are logging into TexShare\n"; print "\n\n\nTo get help please check under \"Help Files\" for "; print "library help\n\n\n"; print "\nto continue press <ENTER> now."; $_=<>; $place = "tcsul.texshare.utexas.edu"; $port = "70"; $protocol = "$gop"; &check; $port = ""; }

sub gnublurb { print "\tmenu version 1.5, Copyright (C) 1995 Kent R. Arnott.\n\n"; print "\tmenu comes with ABSOLUTELY NO WARRANTY. This is free software,\n"; print "\tand you are welcome to redistribute it under certain conditions.\n"; }

## --<<<<<<<<<<<<<<<<<<<<<*>>>>>>>>>>>>>>>>>>>>>-- ## Kent Arnott ## Systems Programmer II, Systems Administrator ## Texas A&M University-Corpus Christi ## e-mail: karnott@tamucc.edu ph:(512)994-2693 ## --<<<<<<<<<<<<<<<<<<<<<*>>>>>>>>>>>>>>>>>>>>>-- ---------------------------------------------------------------------------- -----------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:56 CDT