/* From apertus!uum1!umn.edu!spool.mu.edu!uwm.edu!linac!att!att!gtephx!nationsr Wed Mar 10 09:57:50 1993
/* Newsgroups: rec.sport.baseball
/* Path: apertus!uum1!umn.edu!spool.mu.edu!uwm.edu!linac!att!att!gtephx!nationsr
/* From: nationsr@gtephx.UUCP (Robert J. Nations)
/* Subject: MLB schedule program in C
/* Message-ID: <1993Mar9.203610.11952@gtephx.UUCP>
/* Keywords: baseball schedule 1993
/* Organization: gte
/* Date: Tue, 9 Mar 1993 20:36:10 GMT
/* Lines: 1122
/* 
/* Hi,
/* I have modified the nba.c program to handle the major league baseball 
/* schedule for 1993.  The only change from the nba program is that I added
/* code to allow users to use the short(2-3 letter) form of the teams such
/* as atl for atlanta.  I used the MLB pocket schedule provided to set up the
/* database and I do not vouch for the accuracy of the game time information.
/* I did verify that all teams play the other teams in their division 13 times
/* and play all teams in the other division 12 times.
/* 
/* Enjoy.
/* 
/* Bob Nations
/* 
/* ---------------------------CUT HERE---------------------------------------
/* 
/**************************************************************************
**
* This program prints out the MLB schedule for any day in the 1992-1993   
*
* season. By default, the current day's schedule is printed.  One can also
*
* specify one or more dates on the command line and get the schedule for  
*
* that/those date(s).  Any national TV coverage (TNT and NBC) is also     
*
* included.  The tip-off time for each game is also listed.  The time is  
*
* set up in the matrix for the Eastern time zone.  To change the time to  
*
* show either Central, Mountain, or Pacific time zone just change the     
*
* "TZ_FIX" #define below before compiling (other time zones are not       
*
* currently supported...sorry).                                           
*
*                                                                         
*
*       SEE NEW ADDITIONS TO THIS VERSION BELOW                            *
* A new feature this year is the ability to print a summary of a week's   
*
* worth of games.  This feature is enabled if the first arguement is "-s".
*
*                                                                         
*
* To compile just use... "cc -o mlb mlb.c"                                
*
*                                                                         
*
* Usage:                                                                  
*
* mlb                                   <-- today's schedule                       *
* mlb 7/4                       <-- Fourth of July day's schedule          *
* mlb 4/5 10/3                  <-- schedule for the first and last        *
*                                   day of the season                      *
* mlb -s                        <-- schedule in summary format for the     *
*                                   next week                              *
* mlb -s 7/12                   <-- schedule in summary format for a week  *
*                                   starting at the All-Star Break         *
* mlb -s nyy            <-- schedule in summary format for single  *                                                            
*                           team for the next week using short     *
*                                                       name                                                               *
* mlb -s seattle                <-- schedule in summary format for seattle *
*                                                       for the next week                                          *
* mlb toronto all       <-- full year's schedule for single team   *
*
* Brought to you again this year by:                                      
*
*       ___          __________   _____    ___                            
*
*      /  /\        /  _______/\ /    |\  /  /\ || Len Carr               
*
*     /  / /       /  /__ ____\//  /| | |/  / / || AT&T CellNet           
*
*    /  / /       /  ___/\     /  / | | /  / /  || 200 Laurel Ave., 2D-213
*
*   /  / /       /  ____\/    /  / /| |/  / /   || Middletown, NJ 07748   
*
*  /  /_/____   /  /______   /  / / | /  / /    || (908) 957-3571         
*
* /_________/\ /_________/\ /__/ /  |__ / /     ||                        
*
* \_________\/ \_________\/ \__\/    \__\/      || len@mt747.att.com      
*
*                                                                         
*
***************************************************************************
**/

/*
 * Functionality expanded to allow printing of entire MLB schedule
 * and the full schedules of individual teams.
 *
 * Usage:
 *      mlb all                         <-- print full MLB schedule
 *      mlb "NY Yankees"        <-- print yankees game scheduled for today
 *      mlb atlanta 6/6         <-- print atlanta game scheduled for 6/6
 *      mlb "san diego" all     <-- print full san diego schedule (notice quotes)
 *      mlb -help               <-- print help message.
 *
 *  Modified by Toshio Hori (toshi@nml.t.u-tokyo.ac.jp)
 *  Modified on Sep 26, 1992.
 */

/**************************************************************************
***
* Functionality has been expanded to allow for the displaying of           
*
* a given MLB match up (eg Boston vs Utah)                                  *
*                                                                           *
*  Usage:                                                                   *
*       nba -m boston utah      <- prints games with this matchup           *
*                                                                           *
*  Modified by Dennis P. Joyce (dpj4303@ritvax.rit.edu)                     *
*  Modified on Sept. 30, 1992.                                              *
*                                                                           *
***************************************************************************
***/

/**************************************************************************
***
*                                                                           
*  Functionality has been expanded to include the weekly schedule          
*  for an individual team.                                                 
*                                                                           
*  Usage:
*     
*       nba -s boston 11/20     <- prints the boston schedule for week of
11/20
*       nba -s atlanta 11/20 3/23    <- sched. for Atl. week of 11/20 & 3/23
*
*  Modified by Dennis P. Joyce (dpj4303@ritvax.rit.edu)                     
*                              (dxj@sunsrvr3.cci.com)                       
*  Modified on Oct. 1, 1992.                                                
*                                                                           
***************************************************************************
**/

/**************************************************************************
**
* Functionality has been expanded to include TV listings for the          
*
* superstations WGN, WTBS, and WWOR.                                      
*
*                                                                         
*
* Not extensively tested, but seems OK                                    
*
*                                                                         
*
* Modified by Mike Northam (mbn@greyskul.hf.intel.com)                    
*
*                                                                         
*
* Modified on Nov. 12, 1992                                               
*
*                                                                         
*
* Bugs:  nba "team name" all                                              
*
*        seems to have been broken by one of the above changes            
*
*        I'm not a Real C Programmer(tm) so didn't investigate further    
*
***************************************************************************
**/

/**************************************************************************
**
* Modified on Nov. 17, 1992 by Dan Kinney (dkinney@bothell.sgi.com)       
*
*                                                                         
*
* Fixed above bug (which was worded wrong).                               
*
* Real bug: "nba -s" and/or "nba -s portland" would dump core.            
*
*                                                                         
*
* Search on "Dan" to find the two changes in the source.                  
*
*                                                                         
*
* GO BLAZERS!!  Rip City!!                                                
*
***************************************************************************
**/

#include  <stdio.h>
#include  <string.h>
#include  <ctype.h>
#include  <time.h>

#ifdef pyr
#define strchr(a,b) (char *)index(a,b)
#endif

/*
 * All times in the schedule matrix are based on the Eastern time zone.
 * To change to one of the other three below, comment out the Eastern
 * entry and un-comment the desired one.
 */
/* #define TZ_FIX  0 /* Eastern */
/* #define TZ_FIX 2 /* Central */
#define TZ_FIX 4 /* Mountain */
/* #define TZ_FIX 6 /* Pacific */

char  *nba_teams[] = {
  "Atlanta", "Baltimore", "Boston", "California", "Chicago Cubs",
  "Chicago White Sox", "Cincinnati", "Cleveland", "Colorado", "Detroit",
  "Florida", "Houston", "Kansas City",  "Los Angeles", "Milwaukee",
  "Minnesota", "Montreal", "NY Mets", "NY Yankees", "Oakland", 
  "Philadelphia", "Pittsburg", "St Louis", "San Diego", "San Francisco",
  "Seattle",  "Texas",   "Toronto",
  "All Star Break",   "All Star Game"
};

char  *nba_summary_teams[] = {
  "Atl", "Bal", "Bos", "Cal", "ChC",
  "ChW", "Cin", "Cle", "Col", "Det",
  "Fla", "Hou", "KC",  "LA",  "Mil",
  "Min", "Mon", "NYM", "NYY", "Oak",
  "Phi", "Pit", "StL", "SD",  "SF", 
  "Sea", "Tex", "Tor",
  "ASB",  "ASG"
};

char  *alternate_site[] = {
  "(Double Header)",
  "(in Hartford)",
  "(in Kingdome)",
  "(in Japan)",
  ""
};

char  *sum_alt_site[] = {
  "2 = Double Header",
  "h = Game played in Hartford",
  "k = Game played in Kingdome",
  "j = Game played in Japan",
  ""
};

char  *game_time[] = {
  "(8:05 am)",  "(8:35 am)",
  "(9:05 am)",  "(9:35 am)",  "(10:05 am)", "(10:35 am)",
  "(11:05 am)", "(11:35 am)", "(12:05 Noon)", "(12:35 pm)",
  "(1:05 pm)",  "(1:35 pm)",  "(2:05 pm)",  "(2:35 pm)",
  "(3:05 pm)",  "(3:35 pm)",  "(4:05 pm)",  "(4:35 pm)",
  "(5:05 pm)",  "(5:35 pm)",  "(6:05 pm)",  "(6:35 pm)",
  "(7:05 pm)",  "(7:35 pm)",  "(8:05 pm)",  "(8:35 pm)",
  "(9:05 pm)",  "(9:35 pm)",  "(10:05 pm)", "(10:35 pm)",
  "(11:05 pm)", "(11:35 pm)", ""
};

/* WGN, WTBS, WWOR added to 'tv_coverage' and 'sum_tv_coverage' 11/12/92 by
mbn
*   they show up as numbers 4,5,6,7,8,9 after the game_time character  */

char  *tv_coverage[] = {
  "(TNT)", "(TNT*)", "(NBC)", "(NBC*)", 
  "(WGN)", "(WTBS)", "(WWOR)", "WGN/WTBS", "WGN/WWOR", "WTBS/WWOR", ""
};

char  *sum_tv_coverage[] = {
  "T = Game broadcast on TNT",
  "t = Game may be broadcast on TNT",
  "N = Game broadcast on NBC",
  "n = Game may be broadcast on NBC",
  "G = Game broadcast on WGN",
  "B = Game broadcast on WTBS",
  "W = Game broadcast on WWOR",
  "X = Game broadcast on WGN/WTBS",
  "Y = Game broadcast on WGN/WWOR",
  "Z = Game broadcast on WTBS/WWOR",
  ""
};

int days[] = {
     31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
  /* jan feb mar apr may jun jul aug sep oct nov dec */
};

char  *weekday[] = {
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday",
  "Sunday" 
};

char  *summary_weekday[] = {
  "MO",
  "TU",
  "WE",
  "TH",
  "FR",
  "SA",
  "SU"
};

int playing = -1; /* Not looking or certain matchup */
int summary_form = 0; /* Print out schedule in summary format? */
        /*  0 = No...use long format,  */
        /*  1 = Yes...use summary format   */

/********************************************************************
* Schedule matrix...each character string represents one day in the *
* life of the NBA for the 1992-1993 season.  There are 27 different *
* teams in the NBA represented by the characters "a-z", "{", "|",   *
* and "} and correspond to the "nba_teams" array above.             *
*                                                                   *
* In general the matrix can be viewed as visitor/home/time triplet  *
* where the first entry is the visiting team, the second is the     *
* home team, and the third is the tip-off time.  This 3 character   *
* set is modified slightly in order to store any TV coverage and    *
* "alternate home site" information.                                *
*                                                                   *
* If there is a digit between the visitor and the home team then we *
* look in the "alternate_site" array for the actual location that   *
* the game is being played.                                         *
*                                                                   *
* If there is a digit after the tip-off time then the "tv_coverage" *
* array is checked to see whether NBC, TNT or a superstation are    *
* broadcasting the game.                                            *
********************************************************************/
char  *nba_schedule[] = {
  /* 04/5  (001) */ "shHcmJjt[{bKaeInkHirIqgIulU",
  /* 04/6  (002) */ "fpUodM|zZaeInkTulUxvTywV",
  /* 04/7  (003) */ "cmVfpUjtYodZshS{bT|zLaeInkTirHqgTulUywV",
  /* 04/8  (004) */ "cmVfpGjtKshSnaTqgFxvKywH",
  /* 04/9  (005) */ "bzZc{Vh|LjdZotZpmVsfJeuKgwVlrTnaTqiOxkTyvT",
  /* 04/10 (006) */ "bzYc{Vh|HjdYotMpmJsfSeuSgwUlrHnaTqiKxkSyvH",
  /* 04/11 (007) */ "bzNc{Kh|HjdMotMpmJsfJeuHgwIlrHnaGqiKxkHyvH",
  /* 04/12 (008) */ "b{VdoIhcGmsFpfUeaTguTkyMriWvxZ",
  /* 04/13 (009) */ "b{VpfUtjHz|TeaTguTkyMriHvxWlqYwnM",
  /* 04/14 (010) */ "b{VdoShcGmsGpfUz|TeaOguTkyMriTvxWlqYwnZ",
  /* 04/15 (011) */ "doIhcQmsStjHz|FayMlqHriKvxMwnZ",
  /* 04/16 (012) */ "dbTfcQmpUtoSzjS{sS|hSayZiqTklUrgTueKvnZwxY",
  /* 04/17 (013) */ "dbHfcGmpUtoIzjG{sH|hHayMiqHklUrgGueIvnYwxY",
  /* 04/18 (014) */ "dbHfcGmpItoIzjH{sH|hHayMiqHklJrgIueIvnUwxM",
  /* 04/19 (015) */ "fcCzjH|hHleU",
  /* 04/20 (016) */ "czYfbThdZopUstY{jS|mVakTgvTiwVleUnqTxuTyrT",
  /* 04/21 (017) */ "czYfbThdZopUstY{jH|mVakTgvTiwVleKnqTxuTyrT",
  /* 04/22 (018) */ "czYhdZopGstK|mVakHgvTiwHnqTxuTyrT",
  /* 04/23 (019) */ "bmVcdZf|ThtZjpUszZ{oSawVgeKlvWkiTnuTxrTyqT",
  /* 04/24 (020) */ "bmJcdYf|HhtMjpUszY{oIawUgeIlvKkiSnuSxrHyqH",
  /* 04/25 (021) */ "bmJcdMf|HhtMjpIszN{oIawIgeIlvKkiHnuHxrHyqH",
  /* 04/26 (022) */ "bfUhzYjmVpoS{|TeiWkgTnrTqxYvaTyuTwlU",
  /* 04/27 (023) */ "bfUhzYjmYpoV{|IctZsdTeiWkgTnrHqxYvaTyuFwlU",
  /* 04/28 (024) */ "ctKhzYj{Vm|TofUpbTsdZelUkaTqnZryZuxYvgTwiW",
  /* 04/29 (025) */ "j{Vm|FofUpbTelUkaTqnZryMuxMvgTwiK",
  /* 04/30 (026) */ "dcTmbTo{VpjSthSzsS|fUegTikTqyZrxYunZvlUwaT",
  /* 05/01 (027) */ "dcGmbSo{GpjGthHzsH|fSegIikSqyMrxYunYvlUwaG",
  /* 05/02 (028) */ "dcGmbHo{KpjHthHzsH|fJegIikHqyMrxMunMvlJwaG",
  /* 05/03 (029) */ "dhSo{VtsSzcT",
  /* 05/04 (030) */ "bpUdhSfoUmjStsSzcT|{VavTgkTieUlwVrnZuyZxqT",
  /* 05/05 (031) */ "bpGdsSfoImjHtcTzhS|{VavTgkTieKlwVrnZuyMxqT",
  /* 05/06 (032) */ "b|TdsStcEzhHaiWglUefU",
  /* 05/07 (033) */ "b|TcoUhfUpzZsjStdZ{mVaiWglUkrTnyZqvTxeKwuT",
  /* 05/08 (034) */ "b|GcoIhfSpzYsjStdY{mUaiKglUkrHnyMqvSxeIwuS",
  /* 05/09 (035) */ "b|HcoIhfJpzNsjHtdM{mJaiKglJkrHnyMqvHxeIwuH",
  /* 05/10 (036) */ "cbTfzYpdZsjS{tYalUkrTneUvuTxgTyiW",
  /* 05/11 (037) */ "cbTfzYj|TmhSosSpdZ{tYalUkqTneKrwVvuTxgTyiW",
  /* 05/12 (038) */ "cbTfzLj|TmhSosSpdM{tYalUkqTneIrwVvuTxgTyiW",
  /* 05/13 (039) */ "j|TmhHosS{tKkqTrwHxgFyiO",
  /* 05/14 (040) */ "bjScpUf{VhoUmdZztZ|sSigTkwVnlUrqTuaTveKyxY",
  /* 05/15 (041) */ "bjGcpUf{VhoImdYztM|sHigSkwUnlUrqHuaSveIyxY",
  /* 05/16 (042) */ "bjHcpIf{KhoImdMztM|sHigIkwInlJrqHuaGveIyxM",
  /* 05/17 (043) */ "hbUdfTjoUspUz{V|cTgnZixYlyMqaTukTvrT",
  /* 05/18 (044) */ "hbUdfTjoUspUz{V|cVtmTewVgnZixYlyZqaTukTvrT",
  /* 05/19 (045) */ "hbUdfTjoUspGz{V|cVtmTewVgnZixYlyMqaTukTvrT",
  /* 05/20 (046) */ "hbFjoIz{VtmVewVgyMixMquT",
  /* 05/21 (047) */ "obVd{SjhTp|TscTtfUzmVarTekTgyZinZlxYquTwvT",
  /* 05/22 (048) */ "obVd{HjhSp|HscGtfSzmUarGekSgyMinYlxYquSwvS",
  /* 05/23 (049) */ "obKd{HjhHp|HscGtfJzmJarTekHgyMinMlxMquHwvH",
  /* 05/24 (050) */ "bsScjSdzYo|H{hSruTxnZwqT",
  /* 05/25 (051) */ "bsScjSdzYo|U{hTmfYptSagTilUkvTruTxnZyeIwqT",
  /* 05/26 (052) */ "bsScjHdzYo|U{hTmfKptSagTilUkvTruTxnZyeIwqT",
  /* 05/27 (053) */ "bsSdzYo|HmfFptKagTilUkvTyeU",
  /* 05/28 (054) */ "bdZfsShpUjzZmoU{cT|tWgrTlkTnvTqeKuiWxwVyaT",
  /* 05/29 (055) */ "bdYfsShpUjzYmoU{cG|tMgrHlkSnvSqeIuiKxwUyaM",
  /* 05/30 (056) */ "bdMfsShpIjzUmoI{cG|tMgrHlkHnvHqeIuiKxwIyaG",
  /* 05/31 (057) */ "btYhsGmcT{pI|dMnwJqlHreIugTviWxaTykH",
  /* 06/1  (058) */ "btYhsSmcS{pT|dYfjUozZnwVqlUreUugTviWxaTykT",
  /* 06/2  (059) */ "btKhsSmcS{pQ|dLfjUozZnwVqlHreKugTviWxaTykT",
  /* 06/3  (060) */ "fjSomVeqTvyZxaFwgT",
  /* 06/4  (061) */ "cfUdjSomVphSs{Vt|TzbTanZeqTiuTkxYrlUvyZwgT",
  /* 06/5  (062) */ "cfSdjGomUphHs{Vt|HzbSanYeqTiuSkxYrlUvyMwgS",
  /* 06/6  (063) */ "cfJdjHomJphHs{Vt|HzbHanMeqHiuHkxMrlJvyMwgI",
  /* 06/7  (064) */ "chSd|TjfUp{VsmVtbTzoUaxYerTgqTknZluT",
  /* 06/8  (065) */ "chSd|TjfUp{VsmVtbTzoUaxYerTgqTknZivTluTwyM",
  /* 06/9  (066) */ "chSd|TjfUp{VsmVtbTzoIerTgqTivTluTwyM",
  /* 06/10 (067) */ "bcTp{VsoU|jSgaTnxMqwVurTvkT",
  /* 06/11 (068) */ "bcTfmVh{VsoUtpUzdZ|jSeyZgaTliWnxYqwVurTvkT",
  /* 06/12 (069) */ "bcGfmUh{VsoUtpUzdY|jSeyMgaSliWnxYqwUurSvkS",
  /* 06/13 (070) */ "bcGfmJh{UsoItpIzdM|jHeyMgaGliKnxMqwIurHvkQ",
  /* 06/14 (071) */ "boUcsSftYhjSmzY{dZ|pUkeUniWraTuqTvwV",
  /* 06/15 (072) */ "boUcsSftYhjSmzY{dZ|pUkeKniWraTuqTvwVxlUygT",
  /* 06/16 (073) */ "boIcsSftKhjSmzY{dZ|pGkeIniWraTuqTvwHxlUygT",
  /* 06/17 (074) */ "c|TftKhjHpsS{dZkuTrvTxlUygFweI",
  /* 06/18 (075) */ "bhSc|TfdZmtMojSpsS{zZaqTkuTngTrvTxiWylUweK",
  /* 06/19 (076) */ "bhHc|HfdYmtMojGpsH{zYaqTkuSngSrvSxiWylUweI",
  /* 06/20 (077) */ "bhHc|HfdMmtMojHpsH{zNaqHkuHngIrvUxiKylJweI",
  /* 06/21 (078) */ "dmVohSpcTtzY{fUauTevKgiWlnZqrTxyZwkT",
  /* 06/22 (079) */ "dmVohTpcStzT{fTjbYs|UauTevTgiWlnZqrTxyZwkT",
  /* 06/23 (080) */ "dmVohTpcStzT{fTjbYs|HauFevTgiOlnZqrHxyMwkT",
  /* 06/24 (081) */ "dmJohTtzSjbTs|LgxMiyMlnZ",
  /* 06/25 (082) */ "dpUjcTmhSsbTt{VzfU|oUenZgxYiyZlaTqkTuvTwrT",
  /* 06/26 (083) */ "dpUjcGmhSsbSt{VzfS|oUenYgxYiyMlaSqkSuvSwrH",
  /* 06/27 (084) */ "dpIjcGmhHsbHt{UzfJ|oIenMgxMiyMlaGqkQuvHwrH",
  /* 06/28 (085) */ "fhSjsSm{VocTzpU|bTexYuwVvqTynZ",
  /* 06/29 (086) */ "fhYjsSm{SocVzpT|bUdtTexYiaTlgTrkTuwVvqTynZ",
  /* 06/30 (087) */ "fhKjsSm{GocVzpT|bUdtTexMiaTlgTrkTuwVvqTynZ",
  /* 07/1  (088) */ "bfUdtKzpG{jSiaTlgTrkTuwHvqH",
  /* 07/2  (089) */ "bfUczZhdZopUstZ{jS|mVeiWkaTnqTvgTxuTyrTwlU",
  /* 07/3  (090) */ "bfSczYhdYopIstM{jG|mUeiWkaSnqTvgSxuSyrSwlU",
  /* 07/4  (091) */ "bfJczUhdWopIstM{jH|mUeiKkaGnqHvgIxuHyrHwlJ",
  /* 07/5  (092) */ "bmVcdZf|ThtWjpUszY{oIeiWkaTnuTvgIxrTyqTwlH",
  /* 07/6  (093) */ "bmVcdZf|ThtYjpUszY{oUawVgeUkiWnuTvlUxrTyqT",
  /* 07/7  (094) */ "bmVcdMf|ThtKjpGszL{oIawVgeKkiWnuTvlUxrHyqT",
  /* 07/8  (095) */ "ctMfbTjmVpoUsdZ{|TawVgeIkiOnrTvlUxqTyuT",
  /* 07/9  (096) */ "ctZfbTjmZpoVsdU{|ZhzTakTgvTiwVleKnrTxqTyuT",
  /* 07/10 (097) */ "ctMfbHjmYpoUsdU{|YhzWakSgvSiwUleInrHxqTyuS",
  /* 07/11 (098) */ "ctMfbHjmNpoJsdI{|MhzHakQgvHiwIleInrHxqHyuH",
  /* 07/12 (099) */ "}bU",
  /* 07/13 (100) */ "~bU",
  /* 07/14 (101) */ "}bU",
  /* 07/15 (102) */ "dhSfoUj{Vm|TpbTtsSzcTieUkgTlwVqnZryMuxMvaT",
  /* 07/16 (103) */ "dhSfoUj{Vm|TpbTtsSzcTieKkgTlwVqnZryZuxYvaT",
  /* 07/17 (104) */ "dhHfoUj{Vm|GpbStsHzcGieIkgSlwIqnZryMuxYvaG",
  /* 07/18 (105) */ "dhHfoIj{Um|HpbHtsHzcGieIkgIlwIqnMryMuxMvaG",
  /* 07/19 (106) */ "dcTmbTo{VpjSthSzsS|fUegTikTlvTqyZrxYunZwaT",
  /* 07/20 (107) */ "dcTmbTo{VpjSthSzsS|fUegTikTlvTqyMrxYunZwaT",
  /* 07/21 (108) */ "dcGmbFpjHthSzsG|fUegTikTlvTqyMrxMunZwaT",
  /* 07/22 (109) */ "bpUdsSmjSofUtcTzhS|{VavTelUgkTqxYrnZuyMwiW",
  /* 07/23 (110) */ "bpUdsSmjSofUtcTzhS|{VavTelUgkTqxYrnZuyZwiW",
  /* 07/24 (111) */ "bpUdsGmjGofStcGzhS|{VavSelUgkSqxYrnJuyMwiW",
  /* 07/25 (112) */ "bpIdsHmjHofJtcGzhH|{UavHelJgkQqxMrnMuyMwiK",
  /* 07/26 (113) */ "coUhfUsjStdZ{mVaiWglUnyMxeU",
  /* 07/27 (114) */ "coUhfUsjStdZ{mVb|TpzYaiWglUkrTnyZqvTxeKwuT",
  /* 07/28 (115) */ "coUhfHsjHtdZ{mVb|TpzZaiWglUkrTnyMqvTxeIwuT",
  /* 07/29 (116) */ "coIj|TpzYtdZ{mJalUkrHqvTwuF",
  /* 07/30 (117) */ "cbTfzLhmVj|TosSpdZ{tZalUkqTneKrwVvuTxgTyiW",
  /* 07/31 (118) */ "cbSfzYhmUj|GosSpdY{tMalUkqTneIrwUvuSxgGyiW",
  /* 08/1  (119) */ "cbHfzUhmJj|HosHpdP{tMalJkqHneIrwIvuHxgIyiK",
  /* 08/2  (120) */ "f{VobT|sSigTkwVrqTveI",
  /* 08/3  (121) */ "cpUf{VjhSmdZobTztY|sSigTkwVnlUrqTuaTveIyxY",
  /* 08/4  (122) */ "cpUf{VjhSmdZobTztK|sSigTkwVnlUrqTuaTveIyxY",
  /* 08/5  (123) */ "cpKf{VjhHmdMobTztK|sGigFkwVnlHrqHuaTveIyxM",
  /* 08/6  (124) */ "cjSdfUhbTo|TspUtmVz{VewVgnZi0xQlyZqaTukTvrT",
  /* 08/7  (125) */ "cjGdfShbSo|HspUtmUz{VewUgnZlyMqaSukSvrG",
  /* 08/8  (126) */ "cjHdfJhbHo|UspItmJz{UewIgnMixMlyMqaGukQvrH",
  /* 08/9  (127) */ "bjStfUzmVekTgyMinZlxYwvT",
  /* 08/10 (128) */ "bjStfVzmUd{ThoTp|UscTarTekTgyMinZlxYquTwvT",
  /* 08/11 (129) */ "bjStfVzmUd{ThoTp|HscTarTekTgyMinZlxYquTwvT",
  /* 08/12 (130) */ "bjHd{VhoImfUp|FscTarTekTinMlxMquFwvT",
  /* 08/13 (131) */ "bsSdzZjoImfUptZ{hS|cTagTilUkvTruTxnZyeKwqT",
  /* 08/14 (132) */ "bsHdzYjoUmfSptM{hS|cGagSilUkvSruSxnYyeIwqT",
  /* 08/15 (133) */ "bsHdzNjoImfJptM{hH|cGagUilJkvHruHxnMyeIwqH",
  /* 08/16 (134) */ "bzYjdZotY{sS|hHrgT",
  /* 08/17 (135) */ "bzYjdZotY{sS|hSfcTmpYklUnaTqeIrgTuiWxwVyvT",
  /* 08/18 (136) */ "bzLjdZotK{sS|hSfcTmpUklUnaTqeIrgTuiWxwVyvT",
  /* 08/19 (137) */ "hcTmpGodZklUnaTqeUuiOxwHyvK",
  /* 08/20 (138) */ "fpUhcTmsSodZtjSz|T{bTaeKkyZnwVqgTriWulUvxY",
  /* 08/21 (139) */ "fpUhcGmsHodYtjGz|H{bSaeIkyMnwUqgSulU",
  /* 08/22 (140) */ "fpIhcGmsHodMtjJz|H{bHaeIkyMnwIqgIriKulJvxM",
  /* 08/23 (141) */ "h|TpmVsfUtjS{bTayZeqTgrTiuTvnZwxY",
  /* 08/24 (142) */ "c{VdbTh|TpmVsfUtoUzjSayMeqTgrTiuTlkTvnZwxY",
  /* 08/25 (143) */ "c{VdbTh|FpmVsfUtoUzjHayMeqTgrHiuFlkTvnZwxM",
  /* 08/26 (144) */ "c{VdbFpmVshStoI|zYirTlkT",
  /* 08/27 (145) */ "b{VcmVdoUjtZpfUshS|zZeaTguTirTlqTxvTykTwnZ",
  /* 08/28 (146) */ "b{VcmUdoUjtMpfSshH|zYeaGguSirSlqTxvSykSwnY",
  /* 08/29 (147) */ "b{KcmJdoIjtMpfJshH|zNeaGguHirKlqHx0vGykQwnM",
  /* 08/30 (148) */ "jzYmoUpfU{cT|tYgwVlrTqiWueU",
  /* 08/31 (149) */ "bdZfsShpUjzYmoU{cT|tYgwVlrTnvTqiWueKxkTyaT",
  /* 09/1  (150) */ "bdZfsShpUjzLmoI{cT|tKgwUlrHnvTqiWueIxkTyaT",
  /* 09/2  (151) */ "bdZfsShpGozYnvTreUxkTyaT",
  /* 09/3  (152) */ "btZfjShsSmcTozZ{pU|dZnkTqlUreKugTviWxaTywU",
  /* 09/4  (153) */ "btMfjGhsHmcGozY{pU|dYnkSqlUreIugSviWxaSywU",
  /* 09/5  (154) */ "btMfjHhsHmcGozL{pU|dMnkHqlJreIugIviKxaGywI",
  /* 09/6  (155) */ "cfSomJs{UzbQanUeuSiqHkxYrlHvyM",
  /* 09/7  (156) */ "cfUdjSphSs{Vt|TzbTanZeuTiqTkxYrlUvyZwgT",
  /* 09/8  (157) */ "cfUdjSphSs{Vt|TzbTomVanZeuTiqTkxYrlUwgT",
  /* 09/9  (158) */ "djSphSt|TaxYeuTivTknZwyZ",
  /* 09/10 (159) */ "chSd|TjfUp{VsmVtbTzoUaxYerTgqTivTknZluTwyZ",
  /* 09/11 (160) */ "chHd|HjfSp{VsmUtbSzoIaxYerHgqTivSknYluSwyM",
  /* 09/12 (161) */ "chHd|HjfJp{KsmJtbHzoIaxMerHgqHivHknMluHwyM",
  /* 09/13 (162) */ "bcTfmVh{VsoUtpUzdZeyZliWnxYurT",
  /* 09/14 (163) */ "bcTfmVh{VsoUtpUzdZ|jSeyZgaTliWnxYqwUurTvkT",
  /* 09/15 (164) */ "bcTfmVh{VsoItpUzdZ|jSeyMgaTliWnxYqwUurTvkT",
  /* 09/16 (165) */ "csSmzYtpUgaTliOqwUvkT",
  /* 09/17 (166) */ "boUcsSftZhjSmzZ{dZ|pUkeKniWraTuqTvwUxlUygT",
  /* 09/18 (167) */ "boUcsHftMhjGmzY{dY|pEkeIniWraTuqTvwUxlUygI",
  /* 09/19 (168) */ "boIcsHftMhjHmzN{dM|pIkeIniKraUuqHvwIxlJygI",
  /* 09/20 (169) */ "bhSfdZmtYojS{zYkuTngTrvTxiWylUweU",
  /* 09/21 (170) */ "bhSfdZmtYojS{zYc|TpsSaqTkuTngTrvTxiWylUweU",
  /* 09/22 (171) */ "bhSfdZmtYojH{zYc|TpsSaqTkuTngTrvTxiWylUweK",
  /* 09/23 (172) */ "c|TfdMmtKaqTngTylU",
  /* 09/24 (173) */ "dmVjbTohSpcTs|TtzZ{fUauTevTgiWlnZqrTxyZwkT",
  /* 09/25 (174) */ "dmUjbSohHpcGs|HtzY{fSauSevSgiWlnMqrSxyMwkS",
  /* 09/26 (175) */ "dmJjbHohHpcGs|HtzM{fJauHevHgiKlnMqrHxyMwkH",
  /* 09/27 (176) */ "dpUhmVjcTsbTzfU|oUenZqkTuvTxyZwrT",
  /* 09/28 (177) */ "dpUhmVjcTsbTzfU|oUt{VenZgxYiyZlaTqkTuvTwrT",
  /* 09/29 (178) */ "dpUhmVjcTsbTzfU|oUt{VenZgxYiyMlaTqkTuvTwrT",
  /* 09/30 (179) */ "dpGjcTzfU|bTt{VlaTqkTuvTynZwrT",
  /* 10/1  (180) */ "dtZfhSjsSm{VocTzpU|bTexYiaTlgTrkTuwUvqTynZ",
  /* 10/2  (181) */ "dtMfhHjsSm{VocGzpE|bSexYiaSlgIrkSuwIvqTynZ",
  /* 10/3  (182) */ "dtMfhHjsSm{KocGzpI|bHexMiaGlgIrkHuwIvqHynM",
};

main(argc,argv)
int argc;
char  *argv[];
{
  extern    int is_team();
  extern    int get_nba_day();
  extern    void  do_long_sched();
  extern    void  do_all();
  extern    void  do_summary_sched();

  struct tm    *time_tm;
  register int i,j;
  register int month,day;
  int          arg_count;
  int          nba_day;
  int          team;
  int          newteam;
  long         current_date;
  char         *ptr;
  int          teamtwo = -1;


  /*
   * Look for the "summary form" flag...if specified, it must be the
   * first option.
   */
  arg_count = 1;
  team = -1;
  
  if (argc > arg_count) {
    /*
     * -help option
     */
    if (strcmp(argv[arg_count], "-help") == 0) {
      fprintf(stdout, "Usage: %s [-s|-s team|team] [-m team1 team2] [mm/dd | all]\n",
             argv[0]);
      exit(0);
    }

    /*
     * Check for a request for summary or a specific team.
     */

    /* Fixed 11/17 for syntax "nba -s" and "nba -s portland" */
    /* Dan Kinney  dkinney@bothell.sgi.com */

    if (strcmp(argv[arg_count], "-s") == 0) {
      summary_form = 1;
      if (arg_count+1 != argc) {
          arg_count++;
          if (is_team(argv[arg_count], &newteam)) {
             team = newteam;
             arg_count++;
             }
          }
      else arg_count++;
    } /* if (strcmp()) */

/* New functionality added by Dennis P. Joyce (dpj4303@ritvax.rit.edu):
        -m option designates that matchup  listing is desired. The
        next two arguments are the teams that are desired               */

    else if (strcmp(argv[arg_count], "-m") == 0){
        playing=1;
        arg_count++;
        if (is_team(argv[arg_count], &newteam))  {
                team = newteam;
                arg_count++;
                if (is_team(argv[arg_count], &newteam)) {
                        teamtwo = newteam;
                        arg_count++;
                        }
                else 
                        {
                        fprintf(stdout,"\n%s: Is not a MLB team\n",argv[arg_count]);
                        exit(0);
                        }
                }
                else 
                        {
                        fprintf(stdout,"\n%s: Is not a MLB team\n",argv[arg_count]);
                        exit(0);
                        }
        do_all(team,teamtwo);
        }


      else if (is_team(argv[arg_count], &newteam))  {
      team = newteam;
      arg_count++;
    } /* else if (is_team()) */
  }/* if (argc > ..) */

  /*
   * Check for a requested date on the command line.
   */
  if (argc == arg_count) {
    /*
     * No date/options requested...give today's schedule.
     */
    current_date = time((long *)NULL);
    time_tm = localtime(&current_date);
    month = time_tm->tm_mon+1;
    day = time_tm->tm_mday,0;
    nba_day = get_nba_day(month,day);
    if (nba_day < 0)
      exit(1);

    if (summary_form == 1)      /* Do SUMMARY format */

    /* Fixed 11/17 do_summary_sched not called with team param */
    /* Dan Kinney  dkinney@bothell.sgi.com */

      do_summary_sched(month,day,nba_day,team);
    else          /* Do LONG format */
      do_long_sched(month,day,nba_day,team);

    exit(0);
  } /* if (argc == ..) */

  for (;arg_count<argc;arg_count++) {
    /*
     * Validate the date format.
     */
    j = strlen(argv[arg_count]);
    ptr = strchr(argv[arg_count],'/');

    /*
     * This if loop is added by toshi@nml.t.u-tokyo.ac.jp
     * to allow printing of entire NBA schedule (Sep 26, 1992). 
     */
    if (strcmp(argv[arg_count], "all") == 0) {
        do_all(team,teamtwo);
    } /* if  (strcmp()) */
    else if ((strspn(argv[arg_count],"0123456789/") != j) ||
        (j < 3) || (j > 5) ||
        (argv[arg_count][0] == '/') ||
        (argv[arg_count][j-1] == '/') ||
        (ptr == NULL)) {
      fprintf(stderr,"Invalid date \"%s\"...format is \"mm/dd\"\n",
              argv[arg_count]);
      continue;
    } /* else if ((strspn())) */


    /*
     * Do some basic date validation...
     */
    month = atoi(argv[arg_count]);
    day = atoi(++ptr);

    if (month > 12) {
      fprintf(stderr,"Invalid date \"%d/%d\"...months are from 1 - 12.\n",
              month,day);
      continue;
    } /* if (month > 12) */

    if (day == 0) {
      fprintf(stderr,"Invalid date \"%d/%d\"...the day can not be\"0\"\n",
              month,day);
      continue;
    }/* if (day == 0) */
    else if (day > days[month-1]) {
      fprintf(stderr,"Invalid date \"%d/%d\"...there are only %d days in the month.\n",
        month,day,days[month-1]);
      continue;
    } /* else if (day > ..) */

    /*
     * Figure out what julian date is being requested and convert
     * it to the specific day of the NBA season.
     */
    nba_day = get_nba_day(month,day);
    if (nba_day < 0)
      continue;

    if (summary_form == 1)      /* Do SUMMARY format */
      do_summary_sched(month,day,nba_day,team);
    else          /* Do LONG format */
      do_long_sched(month,day,nba_day,team,teamtwo);
  }

  exit(0);
} /* main */

/* do_all procedure designed to check each day of NBA season. This is the
same code 
        that was in the main() in the previous version                  */

void do_all(team,teamtwo)
int team,teamtwo;
{
int month,day,nba_day;
 for (month = 4; month <= 10; month++) {

        for (day = 1; day <= days[month-1]; day++) {
          if ((month == 4) & (day < 5))  continue;
          if ((month == 10)  && (day > 3)) break;

          nba_day = get_nba_day(month, day);
          if (nba_day < 0)
            continue;

          do_long_sched(month, day, nba_day, team,teamtwo);
        } /* for (day = ..) */
      } /* for (month = ..) */

      exit(0);
}


int
is_team(name, team)
char *name;
int *team;
{
  char newname[128], checkname[128];
  int i, j;

  /*
   * Convert the given name to lower case and all others are lower case
   */
  for (i = 0; i < strlen(name); i++)
        newname[i] = tolower(name[i]);
/*
    if (isupper(name[i]))
      newname[i] = tolower(name[i]);
    else
      newname[i] = name[i];
*/
  newname[i] = '\0';

  /*
   * Scan the NBA teams for one that matches the given name
   */
  for (i = 0; i < (sizeof(nba_teams)/sizeof(char *)); i++) {
    /*
     * Convert the name to check to lower case
     */
    for (j = 0; j < strlen(nba_teams[i]); j++)
      if (isupper(nba_teams[i][j]))
        checkname[j] = tolower(nba_teams[i][j]);
      else
        checkname[j] = nba_teams[i][j];
    checkname[j] = '\0';

    if (strcmp(checkname, newname) == 0) {
      *team = i;
      return(1);
    } /* if (strcmp()) */

    for (j = 0; j < strlen(nba_summary_teams[i]); j++)
      if (isupper(nba_summary_teams[i][j]))
        checkname[j] = tolower(nba_summary_teams[i][j]);
      else
        checkname[j] = nba_summary_teams[i][j];
    checkname[j] = '\0';

    if (strcmp(checkname, newname) == 0) {
      *team = i;
      return(1);
    } /* if (strcmp()) */
  } /* for (i = 0;..) */

  /*
   * No team found
   */
  *team = -1;
  return(0);
} /* is_team */

get_nba_day(month,day)
int month,day;
{
  int nba_day = 0;

  for (month--;month > 0;month--)
    nba_day += days[month-1];
  nba_day += day;
  
  if ((nba_day < 95) || (nba_day >= 277)) {
    fprintf(stderr,"The MLB regular season runs from 4/5 to 10/3.\n");
    return (-1);
  } /* if ((nba_day < ..)) */
  nba_day = nba_day - 95;
  return (nba_day);
} /* get_nba_day */

/*
 * Argument "team" is added by toshi@nml.t.u-tokyo.ac.jp
 * to print out a specific team(Sep 26, 1992).
 */
void
do_long_sched(month,day,nba_day,team,teamtwo)
int     month;
int     day;
register  int nba_day;
int team;
int teamtwo;
{
  register  int i;
  register  int j;
  int   home;
  int   visitor;
  int   tip_off;
  int   alt_site;
  int   footer;
  int   tv_game;
  int   day_o_week;
  int   found;
  char  tmpVisitor[128], tmpHome[128];


  day_o_week = nba_day % 7;

  if (team == -1)
    if (nba_day == 9)
      fprintf(stdout,"\nMLB schedule for today...\n");
    else
      fprintf(stdout,"\nMLB schedule for %s, %d/%d...\n",
              weekday[day_o_week],month,day);

  if ((team == -1) && (nba_schedule[nba_day][0] == '\0')) {
    fprintf(stdout,"          No games scheduled\n");
    return;
  } /* if (nba_schedule[][] ..) */

  for (i=footer=found=0;nba_schedule[nba_day][i] != '\0';) {
    /*
     * The first character is the visiting team.
     */
    visitor = nba_schedule[nba_day][i++] - 'a';

    /*
     * If the next character is a digit...look up the
     * alternate game site
     */
    if (isdigit(nba_schedule[nba_day][i]))
      alt_site = nba_schedule[nba_day][i++] - '0';
    else
      alt_site = 4;

    /*
     * The next charater is the home team.
     */
    home = nba_schedule[nba_day][i++] - 'a';

    /*
     * The next character is the tip-off time.
     */
    tip_off = nba_schedule[nba_day][i++] - '=' - TZ_FIX;

    /*
     * If the next character is a digit...look up the
     * TV coverage.
     */
    if (isdigit(nba_schedule[nba_day][i]))
      tv_game = nba_schedule[nba_day][i++] - '0';
    else
      tv_game = 10;

/* I'm not sure this works as intended mbn@greyskul.hf.intel.com
   but then again, I'm not sure what the intent is :-)  */
    if (tv_game % 2 == 1)
      footer = 1;

    /*
     * If any team isn't specified, print out every entry in data.
     */
    if (team == -1) {
      fprintf(stdout,"%8s  %-12s at %-12s %s %s\n",
              tv_coverage[tv_game],
              nba_teams[visitor],
              nba_teams[home],
              game_time[tip_off],
              alternate_site[alt_site]);
    } /* if (team == -1) */

    /*
     * A specified team is found.
     */

/* LOOKING FOR SPECIFIC MATCHUP   [BOSTON vs UTAH] */
    if (teamtwo != -1){
        if (((visitor ==team) && (home == teamtwo)) || ((visitor == teamtwo) &&
(home == team))){
        strcpy(tmpHome, nba_teams[home]);
        strcpy(tmpVisitor, nba_teams[visitor]);
                fprintf(stdout,"%-6s %10s, %2d/%2d %-12s at %-12s %s %s\n",
                        tv_coverage[tv_game],
                        weekday[day_o_week],
                        month, day,
                        tmpVisitor,
                        tmpHome,
                        game_time[tip_off],
                        alternate_site[alt_site]);

                found++;
                break;
        }
    }           
        
    if ((teamtwo == -1) && ((visitor == team) || (home == team))) {

      /*
       * The name of a specified team is CAPITALIZED.
       */
      if (visitor == team) {
      /* When it is a visitor team. */
        strcpy(tmpHome, nba_teams[home]);

        for (j = 0; j < strlen(nba_teams[visitor]); j++)
          if (isupper(nba_teams[visitor][j]))
            tmpVisitor[j] = nba_teams[visitor][j];
          else
            tmpVisitor[j] = toupper(nba_teams[visitor][j]);
        tmpVisitor[j] = '\0';
      } /* if (visitor == team) */
      else {
      /* When it is a home team. */
        strcpy(tmpVisitor, nba_teams[visitor]);

        for (j = 0; j < strlen(nba_teams[home]); j++)
          if (isupper(nba_teams[home][j]))
            tmpHome[j] = nba_teams[home][j];
          else
            tmpHome[j] = toupper(nba_teams[home][j]);
        tmpHome[j] = '\0';
      } /* else */
      
      fprintf(stdout,"%-6s %10s, %2d/%2d %-12s at %-12s %s %s\n",
              tv_coverage[tv_game],
              weekday[day_o_week],
              month, day,
              tmpVisitor,
              tmpHome,
              game_time[tip_off],
              alternate_site[alt_site]);
      
        found++;
        break;
    } /* if ((visitor ==..)) */

  } /* for (i=footer..) */

  if ((nba_schedule[nba_day][i] != '\0') && (found == 0)) {
    fprintf(stdout,"          No games scheduled\n");
    return;
  } /* if (nba_schedule[][] ..) */

  if ((footer == 1) && (team == -1))
    fprintf(stdout,"\n      * Specific TV game not determined yet.\n");

  return;
} /* do_long_sched */

void
do_summary_sched(month,day,nba_day,team)
int     month;
int     day;
register  int nba_day;
int     team;
{
  register  int i;
  register  int j;
  register  int k;
  int   home;
  int   visitor;
  int   alt_site;
  char    footer[3];
  char    footers[9];
  int   tv_game;
  int   day_o_week;
  int   most_lines = 3;
  char    summary_matrix[7][18][14];

  /*
   * Initialize the matrix for the summary display.
   */
for (j=0;j<7;j++){
    strcpy(summary_matrix[j][0],  "-----------");
    strcpy(summary_matrix[j][2],  "-----------");
    strcpy(summary_matrix[j][17], "-----------");

    day_o_week = (nba_day + j) % 7;
    sprintf(summary_matrix[j][1],"| %s %2d/%-2d ",
      summary_weekday[day_o_week],month,day);
    day++;
    if (day > days[month-1]) {
      day = 1;
      if (++month == 13)
        month = 1;
    } /* if (day > ..) */

    for (k=3;k<=16;k++)
      strcpy(summary_matrix[j][k],"|          ");
  } /* for (j=0;..) */

  for (k=0;k<=17;k++) {
    if ((k == 0) || (k == 2) || (k == 17))
      strcat(summary_matrix[6][k],"-\n");
    else
      strcat(summary_matrix[6][k],"|\n");
  } /* for (k=0;..) */

  strcpy(footers,"00000000");
  for (j=0;j<7;j++) {
    if ((nba_day+j) >= 182) {
      /* We just went past end of season! */
      strcpy(summary_matrix[j][3],"|  SEASON  ");
      strcpy(summary_matrix[j][4],"|  IS OVER ");

      if (j == 6) {
        strcat(summary_matrix[j][3],"|\n");
        strcat(summary_matrix[j][4],"|\n");
      } /* if (j == 6) */

      if (most_lines < 4)
        most_lines = 4;

      continue;
    } /* if ((nba_day+j)) */

    if (nba_schedule[nba_day+j][0] == '\0') {
      /* No games scheduled */
      continue;
    } /* if (nba_schedule[][]..) */

    for (i=0,k=3; nba_schedule[nba_day+j][i] != '\0';k++) {
      footer[0] = footer[1] = footer[2] = '\0';

      /*
       * The first character is the visiting team.
       */
      visitor = nba_schedule[nba_day+j][i++] - 'a';

      /*
       * If the next character is a digit...look up the
       * alternate game site
       */
      if (isdigit(nba_schedule[nba_day+j][i])) {
        alt_site = nba_schedule[nba_day+j][i++] - '0';
        strncat(footer,sum_alt_site[alt_site],1);
        footers[alt_site+4] = '1';
      } /* if (isdigit()) */

      /*
       * The next charater is the home team.
       */
      home = nba_schedule[nba_day+j][i++] - 'a';

      /*
       * The next character is the tip-off time....skip it!
       */
      i++;

      /*
       * If the next character is a digit...look up the
       * TV coverage.
       */
      if (isdigit(nba_schedule[nba_day+j][i])) {
        tv_game = nba_schedule[nba_day+j][i++] - '0';
        strncat(footer,sum_tv_coverage[tv_game],1);
        footers[tv_game] = '1';
      } /* if (isdigit()) */
if (((team==visitor) || (team==home)) || (team ==-1)){
      sprintf(summary_matrix[j][k],"| %3s-%-3s%2s",
        nba_summary_teams[visitor],
        nba_summary_teams[home],
        footer);

      if (j == 6)
        strcat(summary_matrix[j][k],"|\n");
      if (k > most_lines)
        most_lines = k;
}
    } /* for (i=0,k=3;..) */
  } /* for (j=0;..) */

  /*
   * Now print out the summary matrix...
   */
  for (k=0;k<=most_lines;k++) {
    for (j=0;j<7;j++){
if (summary_matrix[j][k] != NULL);
      fprintf(stdout,"%s",summary_matrix[j][k]);
}
  } /* for (k=0;..) */
  for (j=0;j<7;j++){
if (summary_matrix[j][k] != NULL);
    fprintf(stdout,"%s",summary_matrix[j][17]);
}
  /*
   * Print out any footnotes...
    modified 11/12/92 mbn@greyskul.hf.com not fully tested   */
/*  for (j=0;j<10;j++)
 *   if (footers[j] == '1')
 *     fprintf(stdout,"%s\n",sum_tv_coverage[j]);
 * for (j=10;j<14;j++)
 *   if (footers[j] == '1')
 *     fprintf(stdout,"%s\n",sum_alt_site[j-10]);
 */
  return;
} /* do_summary_sched */

/* EOF */
/* 
/* 
/* 
/* -- 
/*  Robert J. Nations (TCP/IP: nationsr@gtephx) 
/*   AG Communications Systems (formerly GTE)   (602) - 581-4678 
/*   2500 West Utopia Road, PO Box 52179, Phoenix, Az. 85072-2179
/* UUCP: {ncar!noao!enuucp | uunet!zardoz!hrc | att}!gtephx!nationsr
*/
