The Birthday Game program I wrote for CLO EUS.

Mest Lover

Not Sea Org Qualified
Here is another of the many programs I wrote for CLO EUS. This was to help the A-data aide calculate the birthday game stats each week at stat evolution.

Code:
/*
    @(#) bday.c 3.0  90/10/27.   COPYRIGHT (C) Q.U.E. computers 1990.
                                 ALL RIGHTS RESERVED.

    THIS C SORCE FILE PROGRAM WAS DESIGNED AND WRITTEN BY ANDRUE C. CARR
    FOR Q.U.E. computers AND IS FOR EXCLUSIVE USE BY CLO EUS.  EXPRESSED
    WRITTEN PERMISSION FROM:  Q.U.E. computers, ANDRUE C. CARR, OR
    3F PRODUCTIONS IS REQUIRED FOR ITS: COMERCIAL USE, COMPILATION,
    DUPLICATION, MODIFICATION, OR EXECUTION.

    IN THE EVENT THAT THE WORKING COPY FOUND IN THE DIRECTORY: /usr/bin
    IS RENDERED NON-EXECUTABLE OR ERASED, WRITTEN PERMISSION IS HEREBY
    GRANTED TO COMPILE THE SORCE CODE FOUND IN THE DIRECTORY:
    /usr/local/cprog AND DUPLICATE THE OBJECT FILE TO THE DIRECTORY:
    /usr/bin BY ANY Q.U.E. computers OR CLO EUS AUTHORIZED C LANGUAGE
    PROGRAMMER FOR THE SOLE PURPOSE OF RESTORING A WORKING COPY OF THIS
    PROGRAM TO THE CLO EUS XENIX SYSTEM V 386 COMPUTER.  BACKUP OR
    HARDCOPIES MAY BE OBTAINED BY CONTACTING ANDRUE C. CARR.
    ALL CURRENT APPLICABLE COPYRIGHT LAWS DO APPLY.

    THIS PROGRAM HAS BEEN MERGED WITH D6BDAY.C AND QLBDAY.C TO FORM
    A SINGULAR VERSION EXECUTABLE BY EACH BDAY PROGRAM NEED.

   o compile as usual:      cc bday.c
     copy to /usr/bin:      cp a.out /usr/bin/bday.o


                *) :-)  *===>   -----}|

*/

#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <ctype.h>

/* global variables  */

char    bell = '\007', mess_flag[6][20], *todo[100], lower[2][2];
char    quart_file[1][28], cum_file[1][28], qbkp_file[1][28];
char cumbkp_file[1][28], qold_file[1][28], cumold_file[1][28];
char    target_file[1][28], duptgt_file[1][28], head_file[1][28];
char    tail_file[1][28], mid_file[1][28], ID[1][4], input_string[1][256];
int     tot_amount, i, j, c, test_flag = 0;     /* if test_flag == 1 then   */
int  user, tnum, converted_string;          /* wont write to data files */
FILE    *end_f, *copy_f;

/*********************/
/* SET ORG STRUCTURE */
/*********************/

typedef struct
        {
             char      orgname[50][6];
             int       points[50];
        } ORG;

/***************************************/
/*  SET UP VARIABLES PER EACH USER ID  */
/***************************************/

varset()
{

if ( user == 0 )       /*    root main clo bday game  */
   {
        sprintf (quart_file, "/usr/lib/bday/quart.doc");
        sprintf (cum_file, "/usr/lib/bday/cuml.doc");
        sprintf (qbkp_file, "/usr/lib/bday/quart.bkp");
        sprintf (cumbkp_file, "/usr/lib/bday/cuml.bkp");
        sprintf (qold_file, "/usr/lib/bday/quart.old");
        sprintf (cumold_file, "/usr/lib/bday/cuml.old");
        sprintf (target_file, "/usr/lib/bday/points.doc");
        sprintf (head_file, "/usr/lib/bday/bday.head");
        sprintf (mid_file, "/usr/lib/bday/bday.mid");
        sprintf (tail_file, "/usr/lib/bday/bday.tail");
     sprintf (ID, "");
        tnum = 601;
     return (0);
   }

if ( user == 231 )     /*    snrqual  qual bday game   */
   {
        sprintf (quart_file, "/usr/lib/bday/qlquart.doc");
        sprintf (cum_file, "/usr/lib/bday/qlcuml.doc");
        sprintf (qbkp_file, "/usr/lib/bday/qlquart.bkp");
        sprintf (cumbkp_file, "/usr/lib/bday/qlcuml.bkp");
        sprintf (qold_file, "/usr/lib/bday/qlquart.old");
        sprintf (cumold_file, "/usr/lib/bday/qlcuml.old");
        sprintf (target_file, "/usr/lib/bday/qlpoints.doc");
        sprintf (head_file, "/usr/lib/bday/qlbday.head");
        sprintf (mid_file, "/usr/lib/bday/qlbday.mid");
        sprintf (tail_file, "/usr/lib/bday/qlbday.tail");
     sprintf (ID, "ql");
     tnum = 602;
     return (0);
   }


if ( user == 245 )     /*  tsaide  div 6 bday game   */
   {
        sprintf (quart_file, "/usr/lib/bday/d6quart.doc");
        sprintf (cum_file, "/usr/lib/bday/d6cuml.doc");
        sprintf (qbkp_file, "/usr/lib/bday/d6quart.bkp");
        sprintf (cumbkp_file, "/usr/lib/bday/d6cuml.bkp");
        sprintf (qold_file, "/usr/lib/bday/d6quart.old");
        sprintf (cumold_file, "/usr/lib/bday/d6cuml.old");
        sprintf (target_file, "/usr/lib/bday/d6points.doc");
        sprintf (head_file, "/usr/lib/bday/d6bday.head");
        sprintf (mid_file, "/usr/lib/bday/bday.mid");
        sprintf (tail_file, "/usr/lib/bday/d6bday.tail");
     sprintf (ID, "d6");
     tnum = 603;
     return (0);
   }

exit (0);
}

/***************************************/
/* LOAD ORG NAMES FROM BDAY.ORGS FILE  */
/***************************************/

name (name_var)

ORG     name_var[1];

{
    FILE    *org_file;

    sprintf (mess_flag[0], "ORGS");
    org_file = fopen ("/usr/lib/bday/bday.orgs", "r");
    checkfile (org_file, mess_flag[0]);
    i = 0;
    do
         {
            fscanf (org_file, "%s", name_var[0].orgname[i]);
            ++i;
         }
    while ( (c = getc (org_file)) != EOF );
    fclose (org_file);
    tot_amount = i - 1;
}

/**************************/
/*  PERFORM SYSTEM CALLS  */
/**************************/

callout (cmd)

char  *cmd[][40];

{
      system (cmd);
}

/***************************/
/* POINT SORTING FUNCTION  */
/***************************/

sort (a, n)

int    n;
ORG    a[1];

{
   char   tname;
   int    temp_org;

   for ( i = 0; i < n -1; ++i )
       for ( j = i + 1; j < n; ++j )
           if ( a[0].points[i] <  a[0].points[j] )
              {
                 temp_org = a[0].points[i];
                 a[0].points[i] = a[0].points[j];
                 a[0].points[j] = temp_org;
                 strcpy (tname, a[0].orgname[i]);
                 strcpy (a[0].orgname[i], a[0].orgname[j]);
                 strcpy (a[0].orgname[j], tname);
              }
}

/***************************************************/
/*   VERIFY THAT THE FILE EXIST AND CAN BE OPENED  */
/***************************************************/

checkfile (poter, message)

char    *message[1][20];
FILE    *poter;

{
   if ( poter == (FILE *) NULL )
      {
         printf ("\n\n%c", bell);
         printf ("****** YOU DO NOT HAVE A %s FILE AVAILABLE ******", message);
         printf ("\n\n");
         exit (1);
      }
}

/*  clear screen */

clearit ()
{
    sprintf (todo, "home");
    callout (todo);
    wait ();
}

/**********************************************/
/* PERFORM DISPLAY OR UPDATE ON Q OR C POINTS */
/**********************************************/

update (fix)

char    *fix[1][4];

{
    ORG     doorg[1], checkorg[2];
    char    write_file[1][25], input[2];
    int     disp_flag, reset_flag;
    FILE    *do_file;

    clearit();

    if ( (c = strcmp ("d", fix)) == 0)
       {
          disp_flag = 1;
          sprintf (mess_flag[5], "DISPLAY POINTS");
       }
    else if ( (c = strcmp ("r", fix)) == 0)
            {
              reset_flag = 1;
              sprintf (mess_flag[5], "RESET POINTS");
            }
    else
            {
              sprintf (mess_flag[5], "UPDATE POINTS");
            }

    printf ("TO %s ENTER A LETTER: ", mess_flag[5]);
    printf ("(q) = QUARTERLY,  (c) = CUMULATIVE\n\n");
    printf ("ENTER A LETTER FROM ABOVE: ");
    scanf ("%s", input);

    /* if lower case make it upper case */
    if( islower(*(input)) )
      *(input) = toupper( *(input) );
    strcpy (fix, input);

    if ((c = strcmp ("Q", fix)) == 0)
       {
          sprintf (mess_flag[5], "QUARTERLY POINTS");
          sprintf (write_file[0],"%s", quart_file);
          do_file = fopen (write_file[0], "r");
       }
    else if ((c = strcmp ("C", fix)) == 0)
            {
                sprintf (mess_flag[5], "CUMULATIVE POINTS");
                sprintf (write_file[0],"%s", cum_file);
                do_file = fopen (write_file[0], "r");
            }
    else
            {
               printf ("\n\n%c*** BAD ARGUMENT SUPPLIED***\n\n", bell);
               exit (1);
            }

   checkfile (do_file, mess_flag[5]);
   clearit ();

   /* for reseting points */

    if (reset_flag == 1)
       {
         do_file = fopen (write_file[0], "w");
         for ( i = 0; i < tot_amount; ++i )
             fprintf (do_file, "0");
         fclose (do_file);
         printf ("\n\n\n\n%c                THE %s ",bell, mess_flag[5]);
         printf ("FILE HAS BEEN RESET TO ZERO!\n\n");
         exit (0);
       }

   name (doorg);
   for ( i = 0; i < tot_amount; ++i )
      fscanf (do_file, "%d", &doorg[0].points[i]);
   fclose (do_file);

/* for displaying points */

    if (disp_flag == 1)
       {
          sort (doorg, tot_amount);
          printf ("\n                     B'DAY GAME %s\n\n", mess_flag[5]);
          printf ("                       CURRENT %s\n", mess_flag[5]);
          printf ("                       =========================\n\n");
          j = tot_amount / 2 + 1;
          for ( i = 0; i < j; ++i )
          printf ("             %2d.  %-6s  %4d              %2d.  %-6s  %4d\n",
                     (i + 1), doorg[0].orgname[i],  doorg[0].points[i],
                     (j + i +1), doorg[0].orgname[j + i],
                                 doorg[0].points[j + i]);
          fclose (do_file);
          exit (0);
       }

/* for updating quarterly and cumulative points */

   printf ("\n\n");
   printf ("                    ENTER ONE OF THE ABBREVIATED ORGS BELOW");
   printf ("\n\n");
   j = 0;
   for ( i = 0; i < tot_amount; ++i )
       {
           printf ("    %-6s", doorg[0].orgname[i]);
           ++j;
           if ( j % 7 == 0)
              printf ("\n");
       }
j = 0;
do
     {
          if ( j >= 1 )
             {
                printf ("%c%c%c\nBAD ORG FORMAT, ", bell, bell, bell);
                printf ("ENTER ONLY CAPITOL LETTERS\n");
             }
          printf ("\n\nENTER ORG: ");
          scanf ("%s", checkorg[1].orgname[1]);

         /* if lower case make it upper case */
          c = strlen (checkorg[1].orgname[1]);
          for (i = 0; i < c; ++i)
              {
          sprintf (lower[0], "%c", checkorg[1].orgname[1][i]);

              if( islower(*(lower[0]) ) )
                {
                   *(lower[0]) = toupper( *(lower[0]) );
                   strcat (lower[1], lower[0]);
             }
           }
       sprintf (checkorg[1].orgname[1], "%s", lower[1]);
          printf ("\n\n");
          ++j;
      }
while ( (c = strpbrk (checkorg[1].orgname[1], "1234567890;-=/.,[]") != 0) );
   for ( i = 0; i < tot_amount; ++i )
        if ( (c = strcmp (checkorg[1].orgname[1], doorg[0].orgname[i])) == 0)
           checkorg[1].points[1] = doorg[0].points[i];
   printf ("CURRENT %s FOR %s ARE SET AT: %d\n\n",
                  mess_flag[5], checkorg[1].orgname[1], checkorg[1].points[1]);
   printf ("ENTER THE CORRECTED AMOUNT: ");
   scanf ("%d", &checkorg[1].points[1]);
   for ( i = 0; i < tot_amount; ++i )
          if ( (c = strcmp (checkorg[1].orgname[1], doorg[0].orgname[i])) == 0)
             doorg[0].points[i] = checkorg[1].points[1];
   do_file = fopen (write_file[0], "w");
   for ( i = 0; i < tot_amount; ++i )
       fprintf (do_file, "%d\n", doorg[0].points[i]);
   fclose (do_file);
   exit (0);
}

/*********************/
/* FILE COPY MODULE  */
/*********************/

copyfile (file_name, spot_file)

char file_name[1][28], spot_file[1][28];

{
     end_f = fopen (spot_file, "a");
     fprintf (end_f, "\n");
     copy_f = fopen (file_name, "r");
     while ( (c = getc (copy_f)) != EOF )
                putc (c, end_f);
        fclose (copy_f);
     fclose (end_f);
}

/**************/
/*   MAIN ()  */
/**************/

main (argc, argv)

char    *argv[];
int     argc;

{

ORG     ptorg[1], qtorg[1], cumorg[1], qtbkp[1], cumbkp[1];
char    win[22][40], *date_v[26], *tlx_num[26], temp[13][6], month[1][6];
char    *we_date[26], pt_str[1][4], qt_str[1][4], cum_str[1][4];
int  pt_num, qt_num, cum_num;
FILE    *quart_pt, *quart_bkp, *quart_old, *cuml_pt, *cuml_bkp, *cuml_old;

/* who is using this and go to variable setups */

user = getuid();
varset();

/* go for updates */

if ( argc >= 2 )
   update (argv[1]);
clearit();

/** Get time of day **/

{
     /* Get system time */

        struct tm *date;

     char * ctime();
     long   clock;
     int    flip1, check_day, thurs, month_num, year;

     /* Get system time */

     time (&clock);

     /* Pass system time to converter */

     date = localtime(&clock);

     /* compensate and make it thursdays date if not thursday */

     if ( date->tm_wday >= 4 )
        {
              flip1 = date->tm_wday - 4;
           }
        else
           {
              flip1 = 3 + date->tm_wday;
           }

        check_day = (date->tm_mday - (flip1)); /* subtracts from day*/
        month_num = date->tm_mon;
        year = date->tm_year;

        /* if thursday is near the end of the month then adjust appropriat */

     if ( check_day > 0 )
           {
             thurs = check_day;
                ++month_num;      /* now increment to make proper month */
        }
     else
        {                           /* dont ++month cuz it is last mnth*/
          if ( month_num == 2 )
             {
               if ( (year % 4) == 0 )
                  thurs = 29 + check_day;
               else
                  thurs = 28 + check_day;
             }
          else
             {
               if ( (month_num == 4) || (month_num == 6) ||
                             (month_num == 9) || (month_num == 11) )
                           thurs = 30 + check_day;
                        else
                           thurs = 31 + check_day;
                     if ( month_num == 0 )
                           {
                       --year;
                    month_num = 12;
                  }
                   }
        }

        /* make w/e date for w/e: in telex */

     sprintf (date_v, "%d/%d/%d", thurs, month_num, year);

        /* if there is only one digit for day or month add a 0 in front */

     if ( thurs < 10 )
        sprintf (temp[0], "0%d", thurs );
     else
           sprintf (temp[0], "%d", thurs );
        if ( month_num < 10 )
        sprintf (temp[1], "0%d", month_num);
     else
        sprintf (temp[1], "%d", month_num);

        /* make telex number + duplicate target file */

     sprintf (tlx_num, "%s%s%d", temp[0], temp[1], tnum );
        sprintf (duptgt_file, "/usr/lib/bday/%spoints.%d%d", ID,
                                                              temp[1], temp[0]);

           /* alphatize the month_num   */

     sprintf ( temp[1], "JAN");
     sprintf ( temp[2], "FEB");
     sprintf ( temp[3], "MAR");
     sprintf ( temp[4], "APR");
     sprintf ( temp[5], "MAY");
     sprintf ( temp[6], "JUNE");
     sprintf ( temp[7], "JULY");
     sprintf ( temp[8], "AUG");
     sprintf ( temp[9], "SEPT");
     sprintf ( temp[10], "OCT");
     sprintf ( temp[11], "NOV");
     sprintf ( temp[12], "DEC");
        for ( i = 0; i < 13; ++i)
            if ( i == month_num )
            sprintf (month, "%s", temp[i]);
     sprintf (we_date, "%d %s %d", thurs, month, year);

/* messages */
       if ( (month_num == 5) && (thurs == 9))
          {
                clearit();
                 printf ("\n\n\n%c%c",bell, bell);
        printf ("\n\n                    HAPPY DIANETICS ANIVERSARY DAY!! ");
           sleep (5);
       }
       if ( (month_num == 3) && (thurs == 13))
          {
                clearit();
                 printf ("\n\n\n%c%c",bell, bell);
       printf ("\n\n                    HAPPY BIRTHDAY L. RON HUBBARD!! ");
           sleep (5);
       }



}

/*********************/
/*  NAME THOSE ORGS  */
/*********************/

name (ptorg);
name (qtorg);
name (cumorg);
name (qtbkp);
name (cumbkp);

/***********************************************************/
/*  PERFORM FILE CHECKS AND TAKE IN POINTS IF FILES ARE OK */
/***********************************************************/
/*   quarterly pt points taken into qtorg[0].points[i]      */
/*   cumulative pt points taken into cumorg[0].points[i]    */
/*   quarterly bkp points taken into qtbkp[0].points[i]     */
/*   cumulative bkp points taken into cumbkp[0].points[i]   */

quart_pt = fopen (quart_file, "r");
cuml_pt = fopen (cum_file, "r");
quart_bkp = fopen (qbkp_file, "r");
cuml_bkp = fopen (cumbkp_file, "r");

sprintf (mess_flag[1], "QUARTERLY POINTS");
sprintf (mess_flag[2], "CUMULATIVE POINTS");
sprintf (mess_flag[3], "QUARTERLY BACKUP");
sprintf (mess_flag[4], "CUMULATIVE BACKUP");

checkfile (quart_pt, mess_flag[1]);
checkfile (cuml_pt, mess_flag[2]);
checkfile (quart_bkp, mess_flag[3]);
checkfile (cuml_bkp, mess_flag[4]);

for ( i = 0; i < tot_amount; i++ )
    {
      fscanf (quart_pt, "%d", &qtorg[0].points[i]);
      fscanf (cuml_pt, "%d", &cumorg[0].points[i]);
      fscanf (quart_bkp, "%d", &qtbkp[0].points[i]);
      fscanf (cuml_bkp, "%d", &cumbkp[0].points[i]);
    }

fclose (quart_pt);
fclose (quart_bkp);
fclose (cuml_pt);
fclose (cuml_bkp);

/******************************/
/* INPUT OF THIS WEEKS POINTS */
/******************************/

printf ("\n\n%c", bell);
printf ("                  ENTER EACH ORGS PRESENT TIME POINTS BELOW\n");
printf ("                     OR PRESS THE DELETE KEY FOR THE MENU\n\n");
for ( i = 0; i < tot_amount; ++i )
    {


/**********************************/
/* CHECKS FOR ALPHAS IN INPUT AND */
/* ONLY ACCEPTS DIGITS.           */
/**********************************/
{
int  re_do;

do
     {
            re_do = 0;
               printf ("ENTER %s\'S POINTS: ", ptorg[0].orgname[i]);
            scanf ("%s", input_string);
            if ((c = strcmp ("\033Q", input_string)) == 0)
               exit (0);       /* delete key on ibm */
            converted_string = atoi (input_string);
            if ( converted_string != 0 )
                   ptorg[0].points[i] = converted_string;
            else
             {
                 if ((c = strcmp ("0", input_string)) == 0 )
                             ptorg[0].points[i] = converted_string;
                 else
                         {
                          printf ("%c%c%c\n",bell, bell, bell);
                    printf ("              ****** ");
                    printf ("BAD POINT FORMAT, ENTER ");
                    printf ("ONLY NUMBERS ******\n\n");
                          re_do = 1;
                         }     /*   FOR ERROR CHECK  */
             }
     }
while (re_do == 1);
}



    }
clearit();
printf ("\n\n%c                         PROCESSING DATA WAIT!\n\n", bell);

/*****************************************/
/*  ADDITION OF PT POINTS TO OLD POINTS  */
/*****************************************/

for ( i = 0; i < tot_amount; i++ )
    {
        qtorg[0].points[i] = qtorg[0].points[i] + ptorg[0].points[i];
        cumorg[0].points[i] = cumorg[0].points[i] + ptorg[0].points[i];
    }

/***************************************************************/
/*  WRITE THE NEW POINTS TO THE APPROPRIATE FILES FOR STORAGE  */
/***************************************************************/

if ( test_flag == 0 )
   {
     quart_pt = fopen (quart_file, "w");
     cuml_pt = fopen (cum_file, "w");
     quart_bkp = fopen (qbkp_file, "w");
     cuml_bkp = fopen (cumbkp_file, "w");
     quart_old = fopen (qold_file, "w");
     cuml_old = fopen (cumold_file, "w");

     for ( i = 0; i < tot_amount; i++ )
         {
               fprintf (quart_pt, "%d\n", qtorg[0].points[i]);
               fprintf (cuml_pt, "%d\n", cumorg[0].points[i]);
             fprintf (quart_bkp, "%d\n", qtorg[0].points[i]);
               fprintf (cuml_bkp, "%d\n", cumorg[0].points[i]);
               fprintf (quart_old, "%d\n", qtbkp[0].points[i]);
               fprintf (cuml_old, "%d\n", cumbkp[0].points[i]);
         }

     fclose (quart_pt);
     fclose (quart_bkp);
     fclose (quart_old);
     fclose (cuml_pt);
     fclose (cuml_bkp);
     fclose (cuml_old);
   }   /* if test_flag == 1 above in globals then it wont write */

/***********************/
/*  SORT THOSE POINTS  */
/***********************/

sort (ptorg, tot_amount);
sort (qtorg, tot_amount);
sort (cumorg, tot_amount);

/********************************************/
/* CLEAR FINAL FILE BY WRITING TO IT FIRST  */
/********************************************/

copy_f = fopen (target_file, "w");   /* open and close to wipe it out */
fclose (copy_f);
copyfile (head_file, target_file);
end_f = fopen (target_file, "a");
fprintf (end_f, "\n%s CLO EUS", tlx_num);

          /* set up telex headers depending on whose game it is */

if ( user == 0 )
   {
fprintf (end_f, "  //////RUSH - BDAY GAME STANDINGS");
fprintf (end_f, "//////\n");
fprintf (end_f, "ED'S ALL EUS ORGS\nINFO: BDAY GAME I/C'S, READ TO STAFF,");
fprintf (end_f, " POST ON STAFF AND PUBLIC NOTICE BOARDS,\nEC, AC\n");
fprintf (end_f, "RE: STANDINGS FOR W/E %s", we_date);
fprintf (end_f, "\n\n\n\n");
   }

if ( user == 231 )
   {
fprintf (end_f, " //////RUSH BIRHTDAY GAME//////\n");
fprintf (end_f, "QUAL SEC'S ALL EUS ORG\n");
fprintf (end_f, "INFO: ED'S, OES' ALL EUS ORGS, PGM CHFS EUS, CO CLO EUS\n");
fprintf (end_f, "RE: THE QUAL BIRTHDAY GAME\n");
fprintf (end_f, "HERE ARE THE STANDINGS OF THE WEEKLY QUAL BIRTHDAY GAME,");
fprintf (end_f, " FOR WEEK ENDING:\n");
fprintf (end_f, "%s:", we_date);
fprintf (end_f, "\n\n\n");
   }

if (user == 245 )
   {
fprintf (end_f, "  //////RUSH HANDROUTE//////\n");
fprintf (end_f, "PES'S ALL EUS ORGS\n");
fprintf (end_f, "INFO:DSIEI, FEI, PUB EXEC OFF FB, PUB CONTACT AIDE FB");
fprintf (end_f, ", PUB SERV AIDE FB,\n");
fprintf (end_f, "FIELD CONTROL AIDE FB, CO CLO EUS, CO FLEUS, A/PGMS AIDE");
fprintf (end_f, " EUS, BIRTHDAY GAME\nI/C FB, BIRTHDAY GAME I/C EUS\n");
fprintf (end_f, "RE:DIV 6 BIRTHDAY GAME\n");
fprintf (end_f, "HERE ARE THE STANDINGS OF THE WEEKLY DIV 6 BIRTHDAY GAME,");
fprintf (end_f, " FOR WEEK ENDING:\n");
fprintf (end_f, "%s:", we_date);
fprintf (end_f, "\n\n\n");
   }

fclose (end_f);
copyfile (mid_file, target_file);
end_f = fopen (target_file, "a");
fprintf (end_f, "***************************************");
fprintf (end_f, "***************************************\n");
fclose (end_f);

/*********************************************************************/
/* CHECK IF MULTIPLE WINNERS, AND WRITE BANNER (S) TO THE FINAL FILE */
/*********************************************************************/

j = 1;
sprintf (win[0], "/usr/lib/bday/%s.ban", ptorg[0].orgname[0]);
for ( i = 1; i < 21; ++i )
    {
     if ( ptorg[0].points[0] == ptorg[0].points[i] )
        {
              sprintf (win[i], "/usr/lib/bday/%s.ban", ptorg[0].orgname[i]);
           ++j;
        }
    }
for ( i = 0; i < j; ++i )     /* reverses order of winners so alphabetical */
    {
     copyfile (win[i], target_file);
        end_f = fopen (target_file, "a");
        fprintf (end_f, "\n");
        fclose (end_f);
    }

/***********************************************************/
/* WRITE THE POINTS TO THE FINAL FILE UNDER THE BANNER (S) */
/***********************************************************/

end_f = fopen (target_file, "a");
fprintf (end_f, "***************************************");
fprintf (end_f, "***************************************");
fprintf (end_f, "\n   W/E: %-8s  W/E: %-8s  W/E: %-8s  W/E: %-8s  W/E: %-8s",
                    date_v, date_v, date_v, date_v, date_v);
fprintf (end_f, "\n***************************************");
fprintf (end_f, "***************************************");
fprintf (end_f, "\n\n           WEEKLY                 QUARTERLY");
fprintf (end_f, "               CUMULATIVE\n");
fprintf (end_f, "           ======                 =========");
fprintf (end_f, "               ==========\n\n");
for ( i = 0; i < tot_amount; ++i )
    {
     /* this stuff will set the numbers for the standings
      * so that if the place is the same the number will
      * be a space or else the number will be increased
      */

     ++pt_num;           /* increment the place numbers */
     ++qt_num;
     ++cum_num;

     if ( ptorg[0].points[i] != ptorg[0].points[i - 1] )
        sprintf (pt_str, "%d.", pt_num);
     else
        strcpy (pt_str, "");
     if ( qtorg[0].points[i] != qtorg[0].points[i - 1] )
        sprintf (qt_str, "%d.", qt_num);
     else
        strcpy (qt_str, "");
     if ( cumorg[0].points[i] != cumorg[0].points[i - 1] )
        sprintf (cum_str, "%d.", cum_num);
     else
        strcpy (cum_str, "");

        /* print the results to the file */

     fprintf (end_f,
        "     %3s  %-6s  %3d        %3s  %-6s  %4d       %3s  %-6s  %4d\n",
                      (pt_str),  ptorg[0].orgname[i],   ptorg[0].points[i],
                      (qt_str),  qtorg[0].orgname[i],   qtorg[0].points[i],
                      (cum_str), cumorg[0].orgname[i],  cumorg[0].points[i]);
    }

fprintf (end_f, "\n***************************************");
fprintf (end_f, "***************************************\n\n");
fclose (end_f);

copyfile (tail_file, target_file);

/* copy final file to current directory  and place a dated copy in bday dir */

copy_f = fopen ("./points.doc", "w");   /* open and close to wipe it out */
fclose (copy_f);

copyfile (target_file, "./points.doc");
copyfile (target_file, duptgt_file);

/****************************/
/*  TELEX THE FINAL FILE NOW*/
/****************************/

if ( test_flag == 0 )
   {
     sprintf (todo, "tlx -n %s",target_file);
     callout (todo);
     wait ();

     /* print the results */

     sprintf (todo, "lp -s %s", target_file);
     callout (todo);
     wait ();
   }     /* for testing if test_flag is set to 1 wont do this */

/* display the results */

sprintf (todo, "more -dwl %s", target_file);
callout (todo);
wait ();
exit (0);
}
 

Stat

Gold Meritorious Patron
I think this is perhaps why they declared you and SP - you subjected them to The Wall of MU's. :omg: Nice coding job. :biggrin:
 

Mest Lover

Not Sea Org Qualified
No backdoors in the programs I submitted here.

I had a password stealing program that nabbed all their passwords and logged them for me. I doubt they have that system running anymore. I am sure it blew up on its own from lack of maintenance on my programs within about 3 months of me leaving. they only had an 80mb drive.
 

Mest Lover

Not Sea Org Qualified
I think this is perhaps why they declared you and SP - you subjected them to The Wall of MU's. :omg: Nice coding job. :biggrin:

As far as I am aware I was never declared.


I used i, j, and c variables for a reason, I thought it looked funny next to int throughout the coding.

I tought myself how to code in UNIX shell and C while I was at CLO EUS by using the Sysadmin manuals, I got better at it after I left but I don't use it anymore.

I mainly started coding in C because it had array structures and the Bourne shell they ran didn't, I had to do all kinds of strange things to simulate arrays in my shell scripts. As I learned C, I started converting the shell modules to either use the parts I finished or entirely swap out to the C programs because they ran faster.
 
Last edited:

SchwimmelPuckel

Genuine Meatball
No backdoors in the programs I submitted here.

I had a password stealing program that nabbed all their passwords and logged them for me. I doubt they have that system running anymore. I am sure it blew up on its own from lack of maintenance on my programs within about 3 months of me leaving. they only had an 80mb drive.
Okeee.. I wuz just trolling the OSA lurkers anyway.. Imagining I could get 'em to do an emergency re-install of all OS software everywhere.

:yes:
 

Mest Lover

Not Sea Org Qualified
Okeee.. I wuz just trolling the OSA lurkers anyway.. Imagining I could get 'em to do an emergency re-install of all OS software everywhere.

:yes:

OSA may want to do that anyway, I am not sure how far my stuff went into their system, I didn't follow it after I left.
 

Rene Descartes

Gold Meritorious Patron
Here is another of the many programs I wrote for CLO EUS. This was to help the A-data aide calculate the birthday game stats each week at stat evolution.

QUOTE]

Wow you worked well at that and I could see in there your routine with the dates something that annoyingly had to be done back in the day before there were easily accessible date functions.

I did some programs for my org back in the 80s so that people wouldn't have to sit for hours tabulating OCA scores, typing in stats to send to CLO each night and to print out address labels for bulk mail in an order where the staff would have to stay up half the night sorting by zip code, they just had to pop on the address stickers in the groups and rubber band them.

All the work that staff had to do then was so inefficient. I am not sure if any upper level staff or sea orgger "ruling class" has a clue about how hard their juniors worked. It was always "work harder, work faster, get help, get more help".

And that is somethign that the Data Evaluator isn't going to find. He is just going to find the WHO and not find as the why that there is some real world technology not being applied.

Here's to you. I tip my hat,

Rd00
 

Mest Lover

Not Sea Org Qualified
Here is another of the many programs I wrote for CLO EUS. This was to help the A-data aide calculate the birthday game stats each week at stat evolution.

QUOTE]

Wow you worked well at that and I could see in there your routine with the dates something that annoyingly had to be done back in the day before there were easily accessible date functions.

I did some programs for my org back in the 80s so that people wouldn't have to sit for hours tabulating OCA scores, typing in stats to send to CLO each night and to print out address labels for bulk mail in an order where the staff would have to stay up half the night sorting by zip code, they just had to pop on the address stickers in the groups and rubber band them.

All the work that staff had to do then was so inefficient. I am not sure if any upper level staff or sea orgger "ruling class" has a clue about how hard their juniors worked. It was always "work harder, work faster, get help, get more help".

And that is somethign that the Data Evaluator isn't going to find. He is just going to find the WHO and not find as the why that there is some real world technology not being applied.

Here's to you. I tip my hat,

Rd00

Yep, dates and spelling were my worst nightmares, so much error trapping needed and fixes to adjust for possibilities... I had time though back then, I worked on programming every night (or played ultrarogue to take a break) for about a year and a half. It kept me sane and less burdened by the depression of never knowing when I would be free again.

I can see now just how much time I really had back then, perfectly indented, tons and tons of commenting and even some fun with the code. I don't do nearly enough of that these days.

before I wrote these programs the staff was up all night graphing and getting stats.
After I wrote them and Erik Knaurhaus used his graph making program to take my cable files and plot them it was done in a couple hours.

CLO was an utter waste of time on stat evolution. Nobody ever thanked me for what I did except 1 person, Lala Jones thanked me one day for the menu system I had running on the computer.

James Goodison was irate one day when he saw my logo on the screens of their computers, he demanded to know why some company was programming their computers.

When he found out it was me he was relieved, he thought I was an idiot.

Dave Henderson called me a "two bit hacker" the day before I left.
 

Mest Lover

Not Sea Org Qualified
Geez I had bad spelling back then but good coding ethics.

BTW: I hereby give written permission to absolutely anyone to copy, spread, rewrite, re-engineer, compile, render to executable, transfer et al, make fun of, or otherwise hereto F WITH THIS!

I have about 40 other programs I am thinking of dumping code for also.
 
Top