abyss_token.c

Go to the documentation of this file.
00001 /******************************************************************************
00002 **
00003 ** token.c
00004 **
00005 ** This file is part of the ABYSS Web server project.
00006 **
00007 ** Copyright (C) 2000 by Moez Mahfoudh <mmoez@bigfoot.com>.
00008 ** All rights reserved.
00009 **
00010 ** Redistribution and use in source and binary forms, with or without
00011 ** modification, are permitted provided that the following conditions
00012 ** are met:
00013 ** 1. Redistributions of source code must retain the above copyright
00014 **    notice, this list of conditions and the following disclaimer.
00015 ** 2. Redistributions in binary form must reproduce the above copyright
00016 **    notice, this list of conditions and the following disclaimer in the
00017 **    documentation and/or other materials provided with the distribution.
00018 ** 3. The name of the author may not be used to endorse or promote products
00019 **    derived from this software without specific prior written permission.
00020 ** 
00021 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00022 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024 ** ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00025 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00027 ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030 ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031 ** SUCH DAMAGE.
00032 **
00033 *******************************************************************************/
00034 
00035 #include <xmlrpc-c/abyss.h>
00036 
00037 #include "abyss_token.h"
00038 
00039 void
00040 NextToken(const char ** const pP) {
00041 
00042     abyss_bool gotToken;
00043 
00044     gotToken = FALSE;
00045 
00046     while (!gotToken) {
00047         switch (**pP) {
00048         case '\t':
00049         case ' ':
00050             ++(*pP);
00051             break;
00052         default:
00053             gotToken = TRUE;
00054         };
00055     }
00056 }
00057 
00058 
00059 
00060 char *
00061 GetToken(char ** const pP) {
00062 
00063     char * p0;
00064         
00065     p0 = *pP;
00066 
00067     while (1) {
00068         switch (**pP) {
00069         case '\t':
00070         case ' ':
00071         case CR:
00072         case LF:
00073         case '\0':
00074             if (p0 == *pP)
00075                 return NULL;
00076 
00077             if (**pP) {
00078                 **pP = '\0';
00079                 ++(*pP);
00080             };
00081             return p0;
00082 
00083         default:
00084             ++(*pP);
00085         };
00086     }
00087 }
00088 

Generated on Thu May 17 10:00:23 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6