/*****************************************************************************
******************************************************************************
*****                          RSERRORS.C  v1.1                          *****
*****    Copyright (c) 1990 by Joyce C. Miller.  All rights reserved.    *****
*****                                                                    *****
***** This header file contains the error message functions used in  the *****
*****           RESTSITE programs written by Joyce C. Miller.            *****
*****                                                                    *****
******************************************************************************
*****************************************************************************/
/* #include <stdio.h> */
/* #include <rstypes.h> */   /* customized type definitions & symbolic constants */
/*****************************************************************************
**                        ERROR FUNCTION PROTOTYPES                         **
*****************************************************************************/
/*************************** COMMAND LINE ERRORS ****************************/
void rserror101();                                    /* command line error */
/******************************* DATA ERRORS ********************************/
void rserror200(char c);        /* character that was input is out of range */
void rserror201(char fl1[],char fl2[],char str[],int ln); /* line too short */
void rserror202(char fl1[],char fl2[],char str[],int ln);  /* line too long */
void rserror203(char fl1[],char fl2[],char str[],int ln);  /* idnm too long */
void rserror204(char fl1[],char fl2[],char str[],int ln);  /* key1 too long */
void rserror205(char fl1[],char fl2[],char str[],int ln);  /* key2 too long */
void rserror206(char fl1[],char fl2[],char str[],int ln);  /* key3 too long */
void rserror207(char fl1[],char fl2[],char str[],int ln);  /* key4 too long */
void rserror208(char fl1[],char fl2[],char str[],int ln);   /* prb too long */
void rserror209(char fl1[],char fl2[],char str[],int ln);   /* enz too long */
void rserror210();                         /* error if over 999,000 records */
void rserror211(char c);                          /* error if too many OTUs */
void rserror212();           /* error if too many probe/enzyme combinations */
void rserror213();                      /* error if too many enzyme classes */
void rserror214(char key);    /* error if existing data files are incorrect */
void rserror215(char otu[],char prb[],char enz[]); /* error if we hit MAXFS */
void rserror216(int k);      /* error if number input is larger than MAXOTU */
/******************************* FILE ERRORS ********************************/
void rserror300(char fl1[]);                          /* file doesn't exist */
void rserror301(char fl1[]);                           /* file create error */
void rserror302(char fl1[], char fl2[]);               /* file rename error */
void rserror303(char fl1[]);                                 /* FSEEK error */
/*---------------------------- file read errors ----------------------------*/
void rserror310(char fl1[]);                      /* open for reading error */
void rserror311(char fl1[]);                                  /* read error */
void rserror312(char fl1[], char fl2[], char fl3[]); /* read error/bak made */
void rserror313();                               /* read error in temp file */
/*--------------------------- file write errors ----------------------------*/
void rserror320(char fl1[]);                      /* open for writing error */
void rserror321(char fl1[]);                                 /* write error */
void rserror322(char fl1[], char fl2[]);            /* write error/bak made */
void rserror323();                              /* write error in temp file */
/*-------------------------- file append errors ----------------------------*/
void rserror330(char fl1[]);                    /* open for appending error */
/************************* MEMORY ALLOCATION ERRORS *************************/
void rserror400();              /* generic not enough memory to run program */
void rserror401();                         /* not enough memory for PECLIST */
void rserror402();                          /* not enough memory for BJLIST */
/************************ OTHER ASSOCIATED FUNCTIONS ************************/
void lineinfo(char fl1[],char fl2[],char str[],int ln);  /* prints bad line */
void toomany();                    /* asks user if he/she wants to continue */
/*****************************************************************************
******************************************************************************
*****                                                                    *****
*****                        COMMAND-LINE ERRORS                         *****
*****                                                                    *****
******************************************************************************
*****************************************************************************/
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR101                            **
**                                                                          **
** This  function  is  invoked if the  command-line argument contained less **
** than three items  (program name,  text file,  data file).  It  prints an **
** error message, and exits.                                                **
*****************************************************************************/
void rserror101()
{
  printf("\a\r\nError 101:  No datafile or no textfile specified.  The ");
  printf("proper format of\r\n            the command line should be:");
  printf("\r\n\n            PROGNAME FILE.IN FILE.OUT\r\n\n");
  printf("            All three items are necessary.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR101 */
/*****************************************************************************
******************************************************************************
*****                                                                    *****
*****                            DATA ERRORS                             *****
*****                                                                    *****
******************************************************************************
*****************************************************************************/
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR200                            **
**                                                                          **
** This  function is invoked if, in  response to a prompt, the user input a **
** character  that  was  not  in  the  acceptable  range.  It prints  out a **
** warning, and exits.                                                      **
*****************************************************************************/
void rserror200(char c)
{
  printf("\a\r\nError 200:  %c is not a valid choice.\r\n\n",c);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR200 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR201                            **
**                                                                          **
** This function  is invoked  if there are not enough items on a text line. **
** It prints out a warning with the line number,  the contents of the line, **
** a statement that  the datafile being written  to exists as a  .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror201(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 201:  Not enough data on line.\r\n");
  printf("            At least %d items per line required.\r\n",PREWORDS+1);
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR201 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR202                            **
**                                                                          **
** This function is invoked if there are too many items on a text line.  It **
** prints out  a warning with the line number,  the contents of the line, a **
** statement  that the datafile  being written  to exists as a  .BAK  file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror202(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 202:  Too much data on line.\r\n");
  printf("            Only %d items per line allowed.\r\n",PREWORDS+NUMFS);
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR202 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR203                            **
**                                                                          **
** This function  is invoked if the  ID NUMBER  on a text line is too long. **
** It prints out a warning with the line number,  the contents of the line, **
** a statement  that  the datafile  being written to exists as a .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror203(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 203:  Length of ID NUMBER too long.\r\n");
  printf("            Maximum length is %d characters.\r\n",(IDLEN-1));
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR203 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR204                            **
**                                                                          **
** This function  is invoked if the  KEY #1  on  a  text line  is too long. **
** It prints out a warning with the line number,  the contents of the line, **
** a statement  that  the datafile  being written to exists as a .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror204(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 204:  Length of KEY #1 too long.\r\n");
  printf("            Maximum length is %d characters.\r\n",(KEYLEN-1));
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR204 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR205                            **
**                                                                          **
** This  function  is  invoked  if the  KEY #2  on a text line is too long. **
** It prints out a warning with the line number,  the contents of the line, **
** a statement  that  the  datafile being written to exists as a .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror205(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 205:  Length of KEY #2 too long.\r\n");
  printf("            Maximum length is %d characters.\r\n",(KEYLEN-1));
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR205 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR206                            **
**                                                                          **
** This  function  is  invoked if the  KEY #3  on a  text line is too long. **
** It  prints out a warning with the line number, the contents of the line, **
** a statement  that the  datafile being written to exists as a  .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror206(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 206:  Length of KEY #3 too long.\r\n");
  printf("            Maximum length is %d characters.\r\n",(KEYLEN-1));
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR206 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR207                            **
**                                                                          **
** This  function  is  invoked if the  KEY #4  on  a text line is too long. **
** It prints out a warning with the line number,  the contents of the line, **
** a statement  that  the  datafile being written to exists as a .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror207(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 207:  Length of KEY #4 too long.\r\n");
  printf("            Maximum length is %d characters.\r\n",(KEYLEN-1));
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR207 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR208                            **
**                                                                          **
** This function  is  invoked if the  PROBE  on a  text  line  is too long. **
** It prints out a warning with the line number,  the contents of the line, **
** a statement that  the datafile  being written to exists as a  .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror208(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 208:  Length of PROBE too long.\r\n");
  printf("            Maximum length is %d characters.\r\n",(PRBLEN-1));
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR208 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR209                            **
**                                                                          **
** This  function  is  invoked if the  ENZYME  on  a text line is too long. **
** It prints out a warning with the line number,  the contents of the line, **
** a statement that  the datafile  being written to exists as a  .BAK file, **
** removes the datafile being written to, and exits.                        **
*****************************************************************************/
void rserror209(char fl1[], char fl2[], char str[], int ln)
{
  printf("\a\r\nError 209:  Length of ENZYME too long.\r\n");
  printf("            Maximum length is %d characters.\r\n",(ENZLEN-1));
  lineinfo(fl1,fl2,str,ln);
}                                             /* END OF FUNCTION RSERROR209 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR210                            **
**                                                                          **
** This  function is invoked  if  there are  too  many data records for the **
** program WRITETXT to handle (now set at 999,000 records.  It prints out a **
** warning, and exits.                                                      **
*****************************************************************************/
void rserror210()
{
  printf("\r\n\nError 210:  There are too many data records in this data ");
  printf("file.\r\n            999 files of %d lines each have been ",FLLMT);
  printf("created.  Please refer to\r\n            the documentation for ");
  printf("more information.\r\n\n            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR210 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR211                            **
**                                                                          **
** This function is  invoked if  more than MAXOTU  OTUs were encountered in **
** the data  file(s).  It prints  out a warning message, and passes control **
** to FUNCTION TOOMANY, which asks the user if he/she would like to go on.  **
**                                                                          **
** Functions called:                                                        **
** toomany        --  asks the user if  he/she  would like to continue with **
**                    the program.                                          **
*****************************************************************************/
void rserror211(char c)
{
  printf("\a\r\nError 211:  The maximum number of OTUs has been reached.");
  printf("  If there are\r\n            more than %d OTUs in ",MAXOTU);
  printf("key%c of the datafile, they will not\r\n            be ",c);
  printf("included in the analysis.\r\n\n");
  toomany();
}                                             /* END OF FUNCTION RSERROR211 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR212                            **
**                                                                          **
** This  function is invoked if more than MAXPEC  probe/enzyme combinations **
** were encountered in the data  file(s).  It prints out a warning message, **
** and  passes control to FUNCTION TOOMANY,  which asks  the user if he/she **
** would like to go on.                                                     **
**                                                                          **
** Functions called:                                                        **
** toomany        --  asks the user if  he/she  would like to continue with **
**                    the program.                                          **
*****************************************************************************/
void rserror212()
{
  printf("\a\r\nError 212:  The maximum number of probe/enzyme ");
  printf("combinations has been\r\n            reached.  If there are more");
  printf(" than %d probe/enzyme\r\n            combinations in the ",MAXPEC);
  printf("datafile, they will not be included\r\n            in the ");
  printf("analysis.\r\n\n");
  toomany();
}                                             /* END OF FUNCTION RSERROR212 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR213                            **
**                                                                          **
** This  function  is  invoked  if  more  than  MACRVS  enzyme classes were **
** encountered in the data  file(s).  It  prints out a warning message, and **
** passes control to FUNCTION TOOMANY, which asks the user if he/she  would **
** like to go on.                                                           **
**                                                                          **
** Functions called:                                                        **
** toomany        --  asks the user if  he/she  would like to continue with **
**                    the program.                                          **
*****************************************************************************/
void rserror213()
{
  printf("\a\r\nError 213:  The maximum number of enzyme classes has been ");
  printf("reached.  If\r\n            there are more than %d enzyme",MAXRVS);
  printf(" classes represented in the\r\n            datafile, they will ");
  printf("not be included in the analysis.\r\n\n");
  toomany();
}                                             /* END OF FUNCTION RSERROR213 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR214                            **
**                                                                          **
** This  function  is  invoked  if the  user  entered the  "T"  option (use **
** existing temporary files, rather than re-pooling the data), and the OTUs **
** in the data  file do not match those in the temporary pooled data files. **
** A warning is printed, and the program terminates.                        **
*****************************************************************************/
void rserror214(char key)
{
  printf("\a\r\nError 214:  The OTUs in the existing data files do not ");
  printf("match the OTUs\r\n            that were specified in KEY%c.",key);
  printf("  Run the program again without\r\n            the 'T' ");
  printf("option.\r\n\n");
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR214 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR215                            **
**                                                                          **
** This function is invoked if MAXFS different sites or fragments are found **
** in an OTU in a probe/enzyme combination.   It prints a warning, and then **
** call on FUNCTION TOOMANY to ask the user if he/she wishes to continue.   **
*****************************************************************************/
void rserror215(char otu[], char prb[], char enz[])
{
  printf("\a\r\nError 215:  The maximum number of different sites or ");
  printf("fragments per OTU per\r\n            probe/enzyme combination ");
  printf("has been reached.  In OTU %s,\r\n            for probe ",otu);
  printf("%s and enzyme %s, more than %d different\r\n",prb,enz,MAXFS);
  printf("            sites or fragments were found.  Any new sites or\r\n");
  printf("            fragments found will not be included in the ");
  printf("analysis.\r\n\n");
  toomany();
}                                             /* END OF FUNCTION RSERROR215 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR216                            **
**                                                                          **
** This function is invoked if  the number input by the user is larger than **
** MAXFS.   It prints a warning, and exits.                                 **
*****************************************************************************/
void rserror216(int k)
{
  printf("\a\r\nError 216:  The number input, %d, is larger than ",k);
  printf("%d, the maximum number\r\n            of OTUs allowed ",MAXOTU);
  printf("by program RESTSITE.\r\n\n            Program terminating.\r\n\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR216 */
/*****************************************************************************
******************************************************************************
*****                                                                    *****
*****                            FILE ERRORS                             *****
*****                                                                    *****
******************************************************************************
*****************************************************************************/
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR300                            **
**                                                                          **
** This function is invoked  if a specified file does not exist.  It prints **
** out a warning with the name of the file, and exits.                      **
*****************************************************************************/
void rserror300(char fl1[])
{
  printf("\a\r\nError 300:  File %s does not exist.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR300 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR301                            **
**                                                                          **
** This  function  is  invoked  if there  is  an error creating a file.  It **
** prints out a warning with the name of the file, and exits.               **
*****************************************************************************/
void rserror301(char fl1[])
{
  printf("\a\r\nError 301:  Error creating file %s.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR301 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR302                            **
**                                                                          **
** This  function  is  invoked  if  there  is an error renaming a file.  It **
** prints out a warning with the old and new file names, and exits.         **
*****************************************************************************/
void rserror302(char fl1[], char fl2[])
{
  printf("\a\r\nError 302:  Error renaming %s to %s.\r\n\n",fl1,fl2);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR302 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR303                            **
**                                                                          **
** This function is invoked if there is an error in FSEEK.  It prints out a **
** warning, and exits.                                                      **
*****************************************************************************/
void rserror303(char fl1[])
{
  printf("\a\r\nError 303:  Error reading file %s.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR303 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR310                            **
**                                                                          **
** This  function  is  invoked  if there  is an  error  opening a file  for **
** reading.  It prints out a warning with the name of the file, and exits.  **
*****************************************************************************/
void rserror310(char fl1[])
{
  printf("\a\r\nError 310:  Error opening %s for reading.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR310 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR311                            **
**                                                                          **
** This function is invoked if there is an error reading a file.  It prints **
** out a warning with the name of the file, and exits.                      **
*****************************************************************************/
void rserror311(char fl1[])
{
  printf("\a\r\nError 311:  Error reading %s.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR311 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR312                            **
**                                                                          **
** This function is invoked if there is an error reading a file.  It prints **
** out a warning with the name of the file, the statement that it exists as **
** a .BAK file, and exits.                                                  **
*****************************************************************************/
void rserror312(char fl1[], char fl2[], char fl3[])
{
  printf("\a\r\nError 312:  Error reading %s.\r\n",fl1);
  printf("            %s has been copied to %s.\r\n\n",fl2,fl3);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR312 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR313                            **
**                                                                          **
** This  function is invoked if there is an error reading a temporary file. **
** It prints out a warning, and exits.                                      **
*****************************************************************************/
void rserror313()
{
  printf("\a\r\nError 313:  Error reading temporary file.\r\n");
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR313 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR320                            **
**                                                                          **
** This  function  is  invoked  if  there  is  an  error opening a file for **
** writing.  It prints out a warning with the name of the file, and exits.  **
*****************************************************************************/
void rserror320(char fl1[])
{
  printf("\a\r\nError 320:  Error opening %s for writing.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR320 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR321                            **
**                                                                          **
** This  function  is invoked  if there  is an error writing to a file.  It **
** prints out a warning with the name of the file, and exits.               **
*****************************************************************************/
void rserror321(char fl1[])
{
  printf("\a\r\nError 321:  Error writing to %s.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR321 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR322                            **
**                                                                          **
** This  function  is  invoked  if there is an error writing to a file.  It **
** prints out a warning with the name of the file, a statment that the file **
** exists as a .BAK file, and exits.                                        **
*****************************************************************************/
void rserror322(char fl1[], char fl2[])
{
  printf("\a\r\nError 322:  Error writing to %s.\r\n",fl1);
  printf("            %s has been copied to %s.\r\n\n",fl1,fl2);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR322 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR323                            **
**                                                                          **
** This  function is  invoked if there is an  error  writing to a temporary **
** file.  It prints out a warning, and exits.                               **
*****************************************************************************/
void rserror323()
{
  printf("\a\r\nError 323:  Error writing to temporary file.\r\n");
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR323 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR330                            **
**                                                                          **
** This  function  is  invoked  if  there  is  an  error opening a file for **
** appending.  It  prints out  a warning  with the  name of  the  file, and **
** exits.                                                                   **
*****************************************************************************/
void rserror330(char fl1[])
{
  printf("\a\r\nError 330:  Error opening %s for appending.\r\n\n",fl1);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR330 */
/*****************************************************************************
******************************************************************************
*****                                                                    *****
*****                      MEMORY ALLOCATION ERRORS                      *****
*****                                                                    *****
******************************************************************************
*****************************************************************************/
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR400                            **
**                                                                          **
** This  function  is  invoked  if  there was  not enough  memory to  run a **
** program.                                                                 **
*****************************************************************************/
void rserror400()
{
  printf("\a\r\nError 400:  There is not enough memory to run this ");
  printf("program.\r\n");
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR400 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR401                            **
**                                                                          **
** This  function is invoked if there was not  enough memory to hold a list **
** of MAXPEC probe/enzyme combinations.                                     **
*****************************************************************************/
void rserror401()
{
  printf("\a\r\nError 401:  There is not enough memory to hold a list of ");
  printf("%d\r\nprobe/enzyme combinations.\r\n\n",MAXPEC);
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR401 */
/*****************************************************************************
**                                                                          **
**                           FUNCTION RSERROR402                            **
**                                                                          **
** This  function  is  invoked if  there was not  enough  memory to  hold a **
** working copy of the data.                                                **
*****************************************************************************/
void rserror402()
{
  printf("\a\r\nError 402:  There is not enough memory to hold the data\r\n");
  printf("in memory.\r\n\n");
  printf("            Program terminating.\r\n");
  exit(0);
}                                             /* END OF FUNCTION RSERROR402 */
/*****************************************************************************
******************************************************************************
*****                                                                    *****
*****                     OTHER ASSOCIATED FUNCTIONS                     *****
*****                                                                    *****
******************************************************************************
*****************************************************************************/
/*****************************************************************************
**                                                                          **
**                            FUNCTION LINEINFO                             **
**                                                                          **
** This  function is called by FUNCTIONS RSERROR201 - 210.  It  prints  out **
** the ASCII data line  with the error  that  caused those  functions to be **
** called.  After printing out the offending data line, the function exits. **
*****************************************************************************/
void lineinfo(char fl1[], char fl2[], char str[], int ln)
{
  printf("            Refer to documentation for more information.\r\n\n");
  printf("            Line number: %d\r\n", ln);
  printf("            Contents of line:\r\n\n");
  printf("            %s\r\n\n", str);
  printf("            %s has been copied to %s.\r\n\n",fl1,fl2);
  printf("            Program terminating.\r\n");
  remove(fl1);
  exit(0);
}                                               /* END OF FUNCTION LINEINFO */
/*****************************************************************************
**                                                                          **
**                             FUNCTION TOOMANY                             **
**                                                                          **
** This  function is invoked by several  other functions.  It asks the user **
** if  he/she  would  like the  program to continue.  If yes, the situation **
** that  caused this  function to be  called is ignored, if no, the program **
** terminates.                                                              **
*****************************************************************************/
void toomany()
{
  char answer[10];
  char *a;

  printf("            Do you wish to continue anyway?  (Y/N)  ");
  a = gets(answer);
  if ((answer[0] == 'N') || (answer[0] == 'n')) {
    printf("\r\n\n            Program terminating.\r\n");
    exit(0);
  }
}                                                /* END OF FUNCTION TOOMANY */
/****************************************************************************/
