//  [c]
error_t httpParseParam(const char_t **pos, HttpParam *param)
{
   error_t error;
   size_t i;
   uint8_t c;
   bool_t escapeFlag;
   bool_t separatorFound;
   const char_t *p;

   //Check parameters
   if(pos == NULL || param == NULL)
      return ERROR_INVALID_PARAMETER;

   //Initialize structure
   param->name = NULL;
   param->nameLen = 0;
   param->value = NULL;
   param->valueLen = 0;

   //Initialize variables
   escapeFlag = FALSE;
   separatorFound = FALSE;

   //Initialize status code
   error = ERROR_IN_PROGRESS;

   //Point to the first character
   i = 0;
   p = *pos;

   //Loop through the list of parameters
   while(error == ERROR_IN_PROGRESS)
   {
      //Get current character
      c = (uint8_t) p[i];

      //Check current state
      if(param->name == NULL)
      {
         //Check current character
         if(c == '\0')
         {
            //The list of parameters is empty
            error = ERROR_NOT_FOUND;
         }
         else if(c == ' ' || c == '\t' || c == ',' || c == ';')
         {
            //Discard whitespace and separator characters
         }
         else if(isalnum(c) || osStrchr("!#$%&'*+-.^_`|~", c) || c >= 128)
         {
            //Point to the first character of the parameter name
            param->name = p + i;
         }
         else
         {
            //Invalid character
            error = ERROR_INVALID_SYNTAX;
         }
      }
      else if(param->nameLen == 0)
      {
         //Check current character
         if(c == '\0' || c == ',' || c == ';')
         {
            //Save the length of the parameter name
            param->nameLen = p + i - param->name;
            //Successful processing
            error = NO_ERROR;
         }
         else if(c == ' ' || c == '\t')
         {
            //Save the length of the parameter name
            param->nameLen = p + i - param->name;
         }
         else if(c == '=')
         {
            //The key/value separator has been found
            separatorFound = TRUE;
            //Save the length of the parameter name
            param->nameLen = p + i - param->name;
         }
         else if(isalnum(c) || osStrchr("!#$%&'*+-.^_`|~", c) || c >= 128)
         {
            //Advance data pointer
         }
         else
         {
            //Invalid character
            error = ERROR_INVALID_SYNTAX;
         }
      }
      else if(!separatorFound)
      {
         //Check current character
         if(c == '\0' || c == ',' || c == ';')
         {
            //Successful processing
            error = NO_ERROR;
         }
         else if(c == ' ' || c == '\t')
         {
            //Discard whitespace characters
         }
         else if(c == '=')
         {
            //The key/value separator has been found
            separatorFound = TRUE;
         }
         else if(c == '\"')
         {
            //Point to the first character that follows the parameter name
            i = param->name + param->nameLen - p;
            //Successful processing
            error = NO_ERROR;
         }
         else if(isalnum(c) || osStrchr("!#$%&'*+-.^_`|~", c) || c >= 128)
         {
            //Point to the first character that follows the parameter name
            i = param->name + param->nameLen - p;
            //Successful processing
            error = NO_ERROR;
         }
         else
         {
            //Invalid character
            error = ERROR_INVALID_SYNTAX;
         }
      }
      else if(param->value == NULL)
      {
         //Check current character
         if(c == '\0' || c == ',' || c == ';')
         {
            //Successful processing
            error = NO_ERROR;
         }
         else if(c == ' ' || c == '\t')
         {
            //Discard whitespace characters
         }
         else if(c == '\"')
         {
            //A string of text is parsed as a single word if it is quoted
            //using double-quote marks (refer to RFC 7230, section 3.2.6)
            param->value = p + i;
         }
         else if(isalnum(c) || osStrchr("!#$%&'*+-.^_`|~", c) || c >= 128)
         {
            //Point to the first character of the parameter value
            param->value = p + i;
         }
         else
         {
            //Invalid character
            error = ERROR_INVALID_SYNTAX;
         }
      }
      else
      {
         //Quoted string?
         if(param->value[0] == '\"')
         {
            //Check current character
            if(c == '\0')
            {
               //The second double quote is missing
               error = ERROR_INVALID_SYNTAX;
            }
            else if(escapeFlag)
            {
               //Recipients that process the value of a quoted-string must
               //handle a quoted-pair as if it were replaced by the octet
               //following the backslash
               escapeFlag = FALSE;
            }
            else if(c == '\\')
            {
               //The backslash octet can be used as a single-octet quoting
               //mechanism within quoted-string and comment constructs
               escapeFlag = TRUE;
            }
            else if(c == '\"')
            {
               //Advance pointer over the double quote
               i++;
               //Save the length of the parameter value
               param->valueLen = p + i - param->value;
               //Successful processing
               error = NO_ERROR;
            }
            else if(isprint(c) || c == '\t' || c >= 128)
            {
               //Advance data pointer
            }
            else
            {
               //Invalid character
               error = ERROR_INVALID_SYNTAX;
            }
         }
         else
         {
            //Check current character
            if(c == '\0' || c == ' ' || c == '\t' || c == ',' || c == ';')
            {
               //Save the length of the parameter value
               param->valueLen = p + i - param->value;
               //Successful processing
               error = NO_ERROR;
            }
            else if(isalnum(c) || osStrchr("!#$%&'*+-.^_`|~", c) || c >= 128)
            {
               //Advance data pointer
            }
            else
            {
               //Invalid character
               error = ERROR_INVALID_SYNTAX;
            }
         }
      }

      //Point to the next character of the string
      if(error == ERROR_IN_PROGRESS)
         i++;
   }

   //Check whether the parameter value is a quoted string
   if(param->valueLen >= 2 && param->value[0] == '\"')
   {
      //Discard the surrounding quotes
      param->value++;
      param->valueLen -= 2;
   }

   //Actual position if the list of parameters
   *pos = p + i;

   //Return status code
   return error;
}