Main Functions for Specific Situations.

The following code is used to process the information found in the HTML forms used on the web site. These programs also integrate files from the server into the web.

To view the code in its original form (not interpreted by the web browser) view the source of this document.

q_new_user.c


/* Includes */

#include 

#include 

#include 

#include 

#include 

#include 





/* Definition of structure used in linked list of variables */

typedef struct _argument

   {

   char *VariableName;

   char *Value;

   struct _argument *pNext;

   } PARMLIST, *PPARMLIST;

FILE *config, *confirm, *user_list;

/* Function definitions */

int ErrMsg (char *msg);

PPARMLIST ReadArguments(int InputLength);

static void PlusesToSpaces(char *Str);

static int HexVal(char c);

static void TranslateEscapes(char *Str);



/******************************************************************************/

/*                                                                            */

/* Function       : main                                                      */

/*                                                                            */

/* Description    : This is a CGI program which takes the output of a form    */

/*                  submitted with a method of POST, and displays a list      */

/*                  of the variable names and values.                         */

/*                                                                            */

/******************************************************************************/



main(int argc, char *argv)

  {

  char *requestMethod;

  char *contentLength;

  char filename[120];

  char buffer[200];

  int argLength;

  int in_char;

  int i, status;

  long int position=0;

  PPARMLIST pParm = NULL;

  PPARMLIST pHead = NULL;



  /* This CGI program must be called with a method of POST */

  requestMethod = getenv("REQUEST_METHOD");



  if ((requestMethod == NULL) || (stricmp(requestMethod, "POST")))

    {

    ErrMsg("REQUEST_METHOD environment variable not properly set to POST\n");

    }

  else

    {

    /* Get the length of the arguments passed in to this program */

    contentLength = getenv("CONTENT_LENGTH");



  if (contentLength == NULL)

    {

    ErrMsg("CONTENT_LENGTH environment variable not set\n");

    }

  else

    {

    if ((config = fopen("qchat.cfg", "r")) == NULL)

      {

      ErrMsg("Error opening configuration file\n");

      }

    else

    {

    fscanf (config, "%s",&filename);

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "qconfirm.html");

    if ((confirm = fopen(buffer, "r")) == NULL)

      {

      ErrMsg(buffer);

      }

    else

      {

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "user.data");

    if ((user_list = fopen(buffer, "r+")) == NULL)

      {

      ErrMsg("Error opening user.data file");

      }

    else

      {

      /* Begin output of HTML to display results of CGI program */

      /* Read the arguments passed in to this program and place them in */

      /* a singly linked list - one link per variable                   */

      argLength = atoi(contentLength);

      pHead = ReadArguments(argLength);

      pParm = pHead;



      /* Output the list of variable names and values */

     status = 0;

     status = fscanf(user_list, "%s",&buffer);

     while (status != EOF)

        { if(strcmp(buffer, pParm->Value) == 0)  {

             ErrMsg("Username already in use, please go back to the previous form and select another.");

             return (0);  }

             status = fscanf(user_list, "%s",&buffer);

        }



     printf( "Content-type: text/html\n\n");

     in_char = getc(confirm);

     while (in_char != EOF)

        { putchar(in_char);

          in_char = getc(confirm);

        }

     pParm = pHead;

     fseek(user_list, 0L , SEEK_END);

     printf( "
Username: %s
\n",pParm->Value); fprintf(user_list, "%s\n",pParm->Value); pParm = pParm->pNext; printf( "
Name: %s
\n",pParm->Value); fprintf(user_list, "%s\n",pParm->Value); pParm = pParm->pNext; printf( "
E-mail Address: %s
\n",pParm->Value,pParm->Value); fprintf(user_list, "%s\n",pParm->Value); pParm = pParm->pNext; if (strstr(pParm->Value,"http://")==NULL) { printf( "
Homepage URL: http://%s
\n",pParm->Value,pParm->Value); fprintf(user_list, "http://%s\n",pParm->Value); } else { printf( "
Homepage URL: %s
\n",pParm->Value,pParm->Value); fprintf(user_list, "%s\n",pParm->Value); } fprintf(user_list, "*****************************************\n"); /* Output the remainder of the HTML used to display the results */ printf( "
\n"); printf( "\n"); printf( "\n"); } } } } } fclose(confirm); fclose(user_list); return(0); }
q_prefs.c


/* Includes */

#include 

#include 

#include 

#include 

#include 

#include 





/* Definition of structure used in linked list of variables */

typedef struct _argument

   {

   char *VariableName;

   char *Value;

   struct _argument *pNext;

   } PARMLIST, *PPARMLIST;

FILE *config, *confirm, *user_list;

/* Function definitions */

int ErrMsg (char *msg);

PPARMLIST ReadArguments(int InputLength);

static void PlusesToSpaces(char *Str);

static int HexVal(char c);

static void TranslateEscapes(char *Str);



/******************************************************************************/

/*                                                                            */

/* Function       : main                                                      */

/*                                                                            */

/* Description    : This is a CGI program which takes the output of a form    */

/*                  submitted with a method of POST, and displays a list      */

/*                  of the variable names and values.                         */

/*                                                                            */

/******************************************************************************/



main(int argc, char *argv)

  {

  char *requestMethod;

  char *contentLength;

  char filename[120];

  char buffer[200];

  char buffer2[100][200];

  char *buffer3;

  int argLength;

  int in_char;

  int i, status, fini;

  long int position=0;

  PPARMLIST pParm = NULL;

  PPARMLIST pHead = NULL;



  /* This CGI program must be called with a method of POST */

  requestMethod = getenv("REQUEST_METHOD");



  if ((requestMethod == NULL) || (stricmp(requestMethod, "POST")))

    {

    ErrMsg("REQUEST_METHOD environment variable not properly set to POST\n");

    }

  else

    {

    /* Get the length of the arguments passed in to this program */

    contentLength = getenv("CONTENT_LENGTH");



  if (contentLength == NULL)

    {

    ErrMsg("CONTENT_LENGTH environment variable not set\n");

    }

  else

    {

    if ((config = fopen("qchat.cfg", "r")) == NULL)

      {

      ErrMsg("Error opening configuration file\n");

      }

    else

    {

    fscanf (config, "%s",&filename);

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "qconfirm.html");

    if ((confirm = fopen(buffer, "r")) == NULL)

      {

      ErrMsg(buffer);

      }

    else

      {

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "user.prefs");

    if ((user_list = fopen(buffer, "r+")) == NULL)

      {

      ErrMsg("Error opening user.prefs file");

      }

    else

      {

      /* Begin output of HTML to display results of CGI program */

      /* Read the arguments passed in to this program and place them in */

      /* a singly linked list - one link per variable                   */

      argLength = atoi(contentLength);

      pHead = ReadArguments(argLength);

      pParm = pHead;



      /* Output the list of variable names and values */

     printf( "Content-type: text/html\n\n");

     in_char = getc(confirm);

     while (in_char != EOF)

        { putchar(in_char);

          in_char = getc(confirm);

        }

     i = 0;

     fseek(user_list, 0L , SEEK_SET);

     status = fscanf(user_list, "%s", &buffer2[i]);

     while (status != EOF)

        {

          i++;

          status = fscanf(user_list, "%s", &buffer2[i]);

        }

     fini = i;

     fseek(user_list, 0L , SEEK_SET);

     status = 0;

     for (i=0; iValue) == 0)  

           {

             status = 1;

             pParm = pHead;

             printf( "
Username: %s
\n",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "

Applet Size: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Font: %s,",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "%s
\n",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf("
Color Selections:
\n"); printf( "
Main Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Main Background: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Text Display Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Text Display Background: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Input Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Input Background: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Button Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Button Background: %s
",pParm->Value); fprintf(user_list, "%s\n",pParm->Value); pParm = pParm->pNext; } else { fprintf(user_list, "%s\n", buffer2[i]); } } if (status == 0) { fseek(user_list, 0L , SEEK_END); pParm = pHead; printf( "
Username: %s
\n",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "

Applet Size: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Font: %s,",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "%s
\n",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf("
Color Selections:
\n"); printf( "
Main Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Main Background: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Text Display Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Text Display Background: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Input Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Input Background: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Button Foreground: %s ",pParm->Value); fprintf(user_list, "%s|",pParm->Value); pParm = pParm->pNext; printf( "
Button Background: %s ",pParm->Value); fprintf(user_list, "%s\n",pParm->Value); pParm = pParm->pNext; } /* Output the remainder of the HTML used to display the results */ printf( "Diags: fini:%i
\n", fini); printf( "
\n"); printf( "\n"); printf( "\n"); } } } } } fclose(confirm); fclose(user_list); return(0); }
q_registered.c


/* Includes */

#include 

#include 

#include 

#include 

#include 

#include 





/* Definition of structure used in linked list of variables */

typedef struct _argument

   {

   char *VariableName;

   char *Value;

   struct _argument *pNext;

   } PARMLIST, *PPARMLIST;

FILE *config, *confirm, *channel_list;

/* Function definitions */

int ErrMsg (char *msg);

PPARMLIST ReadArguments(int InputLength);

static void PlusesToSpaces(char *Str);

static int HexVal(char c);

static void TranslateEscapes(char *Str);



/******************************************************************************/

/*                                                                            */

/* Function       : main                                                      */

/*                                                                            */

/* Description    : This is a CGI program which takes the output of a form    */

/*                  submitted with a method of POST, and displays a list      */

/*                  of the variable names and values.                         */

/*                                                                            */

/******************************************************************************/



main(int argc, char *argv)

  {

  char *requestMethod;

  char *contentLength;

  char filename[120];

  char buffer[200];

  int argLength;

  int in_char;

  int i, status;

  long int position=0;

  PPARMLIST pParm = NULL;

  PPARMLIST pHead = NULL;



  /* This CGI program must be called with a method of POST */

  requestMethod = getenv("REQUEST_METHOD");



  if ((requestMethod == NULL) || (stricmp(requestMethod, "POST")))

    {

    ErrMsg("REQUEST_METHOD environment variable not properly set to POST\n");

    }

  else

    {

    /* Get the length of the arguments passed in to this program */

    contentLength = getenv("CONTENT_LENGTH");



  if (contentLength == NULL)

    {

    ErrMsg("CONTENT_LENGTH environment variable not set\n");

    }

  else

    {

    if ((config = fopen("qchat.cfg", "r")) == NULL)

      {

      ErrMsg("Error opening configuration file\n");

      }

    else

    {

    fscanf (config, "%s",&filename);

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "qreg.html");

    if ((confirm = fopen(buffer, "r")) == NULL)

      {

      ErrMsg(buffer);

      }

    else

      {

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "channel.list");

    if ((channel_list = fopen(buffer, "r")) == NULL)

      {

      ErrMsg("Error opening channel.list file");

      }

    else

      {

      /* Begin output of HTML to display results of CGI program */

      /* Read the arguments passed in to this program and place them in */

      /* a singly linked list - one link per variable                   */

      argLength = atoi(contentLength);

      pHead = ReadArguments(argLength);

      pParm = pHead;



      /* Output the list of variable names and values */

     printf( "Content-type: text/html\n\n");

     in_char = getc(confirm);

     while (in_char != EOF)

        { putchar(in_char);

          in_char = getc(confirm);

        }

     status = 0;

     status = fscanf(channel_list, "%s",&buffer);

     while (status != EOF)

        { printf( "%s
\n",buffer); status = fscanf(channel_list, "%s",&buffer); } /* Output the remainder of the HTML used to display the results */ printf( "
\n"); printf( "\n"); printf( "\n"); } } } } } fclose(confirm); fclose(channel_list); return(0); }
q_start.c


/* Includes */

#include 

#include 

#include 

#include 

#include 

#include 





/* Definition of structure used in linked list of variables */

typedef struct _argument

   {

   char *VariableName;

   char *Value;

   struct _argument *pNext;

   } PARMLIST, *PPARMLIST;

FILE *config, *confirm, *data, *prefs;

/* Function definitions */

int ErrMsg (char *msg);

PPARMLIST ReadArguments(int InputLength);

static void PlusesToSpaces(char *Str);

static int HexVal(char c);

static void TranslateEscapes(char *Str);



/******************************************************************************/

/*                                                                            */

/* Function       : main                                                      */

/*                                                                            */

/* Description    : This is a CGI program which takes the output of a form    */

/*                  submitted with a method of POST, and displays a list      */

/*                  of the variable names and values.                         */

/*                                                                            */

/******************************************************************************/



main(int argc, char *argv)

  {

  char *requestMethod;

  char *contentLength;

  char filename[120];

  char buffer[200], *buffer2;

  int argLength;

  int in_char;

  int i, status;

  long int position=0;

  PPARMLIST pParm = NULL;

  PPARMLIST pHead = NULL;



  /* This CGI program must be called with a method of POST */

  requestMethod = getenv("REQUEST_METHOD");



  if ((requestMethod == NULL) || (stricmp(requestMethod, "POST")))

    {

    ErrMsg("REQUEST_METHOD environment variable not properly set to POST\n");

    }

  else

    {

    /* Get the length of the arguments passed in to this program */

    contentLength = getenv("CONTENT_LENGTH");



  if (contentLength == NULL)

    {

    ErrMsg("CONTENT_LENGTH environment variable not set\n");

    }

  else

    {

    if ((config = fopen("qchat.cfg", "r")) == NULL)

      {

      ErrMsg("Error opening configuration file\n");

      }

    else

    {

    fscanf (config, "%s",&filename);

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "qstart.html");

    if ((confirm = fopen(buffer, "r")) == NULL)

      {

      ErrMsg(buffer);

      }

    else

      {

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "user.data");

    if ((data = fopen(buffer, "r")) == NULL)

      {

      ErrMsg("Error opening user.data file");

      }

    else

      {

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "user.prefs");

    if ((prefs = fopen(buffer, "r")) == NULL)

      {

      ErrMsg("Error opening user.prefs file");

      }

    else

      {

      /* Begin output of HTML to display results of CGI program */

      /* Read the arguments passed in to this program and place them in */

      /* a singly linked list - one link per variable                   */

      argLength = atoi(contentLength);

      pHead = ReadArguments(argLength);

      pParm = pHead;



      /* Output the list of variable names and values */

     status = 0, i=0;

     status = fscanf(data, "%s",&buffer);

     while (status != EOF)

        { if(strcmp(buffer, pParm->Value) == 0)  {

             i=1;  }

             status = fscanf(data, "%s",&buffer);

        }

     if(i==0)  {

	ErrMsg("Username not registered, please go back to the previous form and select another or fill out the registration form.");

	return(0);

        }

     status = 0, i=0;

     status = fscanf(prefs, "%s",&buffer);

     while (status != EOF)

        {    buffer2=strtok(buffer,"|");

	     if(strcmp(buffer2, pParm->Value) == 0)  {

             i=1;  

	     break;  }

             status = fscanf(prefs, "%s",&buffer);

        }



     printf( "Content-type: text/html\n\n");

     in_char = getc(confirm);

     while (in_char != EOF)

        { putchar(in_char);

          in_char = getc(confirm);

        }

     pParm = pHead;

     if (i==1)  {

     printf( "\n",strtok(NULL,"|"),strtok(NULL,"|"));

     printf( "\n",pParm->Value);

     pParm = pParm->pNext;

     printf( "\n",pParm->Value);

     pParm = pParm->pNext;

     printf( "\n",pParm->Value);

     pParm = pParm->pNext;

     printf( "\n",pParm->Value);

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n",strtok(NULL,"|"));

     printf( "\n");

	}

     else {

     printf( "\n");

     printf( "\n",pParm->Value);

     pParm = pParm->pNext;

     printf( "\n",pParm->Value);

     pParm = pParm->pNext;

     printf( "\n",pParm->Value);

     pParm = pParm->pNext;

     printf( "\n",pParm->Value);

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

     printf( "\n");

	}

     /* Output the remainder of the HTML used to display the results */

     printf( "
\n"); printf( "\n"); printf( "\n"); } } } } } } fclose(data); fclose(prefs); fclose(confirm); return(0); }
q_userchannel.c


/* Includes */

#include 

#include 

#include 

#include 

#include 

#include 





/* Definition of structure used in linked list of variables */

typedef struct _argument

   {

   char *VariableName;

   char *Value;

   struct _argument *pNext;

   } PARMLIST, *PPARMLIST;

FILE *config, *confirm, *channel_list;

/* Function definitions */

int ErrMsg (char *msg);

PPARMLIST ReadArguments(int InputLength);

static void PlusesToSpaces(char *Str);

static int HexVal(char c);

static void TranslateEscapes(char *Str);



/******************************************************************************/

/*                                                                            */

/* Function       : main                                                      */

/*                                                                            */

/* Description    : This is a CGI program which takes the output of a form    */

/*                  submitted with a method of POST, and displays a list      */

/*                  of the variable names and values.                         */

/*                                                                            */

/******************************************************************************/



main(int argc, char *argv)

  {

  char *requestMethod;

  char *contentLength;

  char filename[120];

  char buffer[200];

  int argLength;

  int in_char;

  int i, status;

  long int position=0;

  PPARMLIST pParm = NULL;

  PPARMLIST pHead = NULL;



  /* This CGI program must be called with a method of POST */

  requestMethod = getenv("REQUEST_METHOD");



  if ((requestMethod == NULL) || (stricmp(requestMethod, "POST")))

    {

    ErrMsg("REQUEST_METHOD environment variable not properly set to POST\n");

    }

  else

    {

    /* Get the length of the arguments passed in to this program */

    contentLength = getenv("CONTENT_LENGTH");



  if (contentLength == NULL)

    {

    ErrMsg("CONTENT_LENGTH environment variable not set\n");

    }

  else

    {

    if ((config = fopen("qchat.cfg", "r")) == NULL)

      {

      ErrMsg("Error opening configuration file\n");

      }

    else

    {

    fscanf (config, "%s",&filename);

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "quserchannel.html");

    if ((confirm = fopen(buffer, "r")) == NULL)

      {

      ErrMsg(buffer);

      }

    else

      {

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "user_on_channel.list");

    if ((channel_list = fopen(buffer, "r")) == NULL)

      {

      ErrMsg("Error opening user_on_channel.list file");

      }

    else

      {

      /* Begin output of HTML to display results of CGI program */

      /* Read the arguments passed in to this program and place them in */

      /* a singly linked list - one link per variable                   */

      argLength = atoi(contentLength);

      pHead = ReadArguments(argLength);

      pParm = pHead;



      /* Output the list of variable names and values */

     printf( "Content-type: text/html\n\n");

     in_char = getc(confirm);

     while (in_char != EOF)

        { putchar(in_char);

          in_char = getc(confirm);

        }

     status = 0;

     i=0;

     status = fscanf(channel_list, "%s",&buffer);

     while (status != EOF)

        { printf( "%s",buffer);

          printf( " ");

          status = fscanf(channel_list, "%s",&buffer);

          i++;

          if (i==6) {

             printf( "
\n"); i=0; } } /* Output the remainder of the HTML used to display the results */ printf( "
\n"); printf( "\n"); printf( "\n"); } } } } } fclose(confirm); fclose(channel_list); return(0); }
q_userlist.c


/* Includes */

#include 

#include 

#include 

#include 

#include 

#include 





/* Definition of structure used in linked list of variables */

typedef struct _argument

   {

   char *VariableName;

   char *Value;

   struct _argument *pNext;

   } PARMLIST, *PPARMLIST;

FILE *config, *confirm, *channel_list;

/* Function definitions */

int ErrMsg (char *msg);

PPARMLIST ReadArguments(int InputLength);

static void PlusesToSpaces(char *Str);

static int HexVal(char c);

static void TranslateEscapes(char *Str);



/******************************************************************************/

/*                                                                            */

/* Function       : main                                                      */

/*                                                                            */

/* Description    : This is a CGI program which takes the output of a form    */

/*                  submitted with a method of POST, and displays a list      */

/*                  of the variable names and values.                         */

/*                                                                            */

/******************************************************************************/



main(int argc, char *argv)

  {

  char *requestMethod;

  char *contentLength;

  char filename[120];

  char buffer[200];

  int argLength;

  int in_char;

  int i, status;

  long int position=0;

  PPARMLIST pParm = NULL;

  PPARMLIST pHead = NULL;



  /* This CGI program must be called with a method of POST */

  requestMethod = getenv("REQUEST_METHOD");



  if ((requestMethod == NULL) || (stricmp(requestMethod, "POST")))

    {

    ErrMsg("REQUEST_METHOD environment variable not properly set to POST\n");

    }

  else

    {

    /* Get the length of the arguments passed in to this program */

    contentLength = getenv("CONTENT_LENGTH");



  if (contentLength == NULL)

    {

    ErrMsg("CONTENT_LENGTH environment variable not set\n");

    }

  else

    {

    if ((config = fopen("qchat.cfg", "r")) == NULL)

      {

      ErrMsg("Error opening configuration file\n");

      }

    else

    {

    fscanf (config, "%s",&filename);

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "quserlist.html");

    if ((confirm = fopen(buffer, "r")) == NULL)

      {

      ErrMsg(buffer);

      }

    else

      {

    i = sprintf (buffer, "%s",filename);

    sprintf (buffer+i, "%s", "user.list");

    if ((channel_list = fopen(buffer, "r")) == NULL)

      {

      ErrMsg("Error opening user.list file");

      }

    else

      {

      /* Begin output of HTML to display results of CGI program */

      /* Read the arguments passed in to this program and place them in */

      /* a singly linked list - one link per variable                   */

      argLength = atoi(contentLength);

      pHead = ReadArguments(argLength);

      pParm = pHead;



      /* Output the list of variable names and values */

     printf( "Content-type: text/html\n\n");

     in_char = getc(confirm);

     while (in_char != EOF)

        { putchar(in_char);

          in_char = getc(confirm);

        }

     status = 0;

     status = fscanf(channel_list, "%s",&buffer);

     while (status != EOF)

        { printf( "%s
\n",buffer); status = fscanf(channel_list, "%s",&buffer); } /* Output the remainder of the HTML used to display the results */ printf( "
\n"); printf( "\n"); printf( "\n"); } } } } } fclose(confirm); fclose(channel_list); return(0); }