QString ParamConverter::convertString(QString str)
{
    if(str.isEmpty())
    {
        return str;
    }

    clearSpace(str, 0);
    str.insert(0, '-');
    int indexEnd = str.indexOf(':');
    if(-1 == indexEnd)
    {
        str.clear();
        return str;
    }
    clearSpace(str, indexEnd+1);
    clearRSpace(str, indexEnd - 1);
    clearRSpace(str, str.length() - 1);

    indexEnd = str.indexOf(':');
    str.replace(indexEnd, 1, ' ');
    str.insert(indexEnd+1, '\'');

    str.insert(str.length(), '\'');

    return str;
}
	void eHealthDisplayClass::printValuesScreen(void)
	{

		delay(100);

		//Prints the current value of diastolic pressure.
		if (pulse != eHealth.getBPM()) {
			pulse = eHealth.getBPM();
			clearSpace(70, 40, 90, 47);
			coordinates(70,47);	Serial.print(pulse);
			delay(10);
		}

		//Stores the current value of skin conductance.
		float conductance = eHealth.getSkinConductance();
		delay(20);

		//If conductance == -1, the sensor is no connected.
		if ( conductance == -1 ) {
			coordinates(70,35);	Serial.print(F("NOCN")); //No connected message.
			delay(10);
		}
		else {
			coordinates(70,35);	Serial.print(conductance,2);
			delay(10);
		}

		if (oxygen != eHealth.getOxygenSaturation())
		{
			oxygen = eHealth.getOxygenSaturation();
			clearSpace(70, 15, 90, 22);
			coordinates(70, 22);	Serial.print(oxygen);
			delay(10);
		}

		//Prints the current value of temperature.
		coordinates(70,9);	Serial.print(eHealth.getTemperature(),2);
		delay(10);

		//If no changes in position, don't refresh the screen.
		if (bodyPosition != eHealth.getBodyPosition()) {

			bodyPosition = eHealth.getBodyPosition();
			clearSpace(95, 34, 117, 50); // Clear the previous position.

				 if (bodyPosition == 1) supinePosition();
			else if (bodyPosition == 2) leftLateralPosition();
			else if (bodyPosition == 3) rigthLateralPosition();
			else if (bodyPosition == 5) standPosition();
			else pronePosition();
		}

		delay(10);
	}
Example #3
0
void dumpInput() {
    int ch;
    clearSpace();
    while((ch = getc(ifp))!= '\n') {
        if(ch == ' ' || ch == '\t') {
            clearSpace();
            printf(" ");
        }
        else
            printf("%c", ch);
    }
    printf("\n");
}
		void MemoryBundleStorage::clear()
		{
			ibrcommon::MutexLock l(_bundleslock);

			for (bundle_list::const_iterator iter = _bundles.begin(); iter != _bundles.end(); ++iter)
			{
				const dtn::data::Bundle &bundle = (*iter);

				// raise bundle removed event
				eventBundleRemoved(bundle);
			}

			_bundles.clear();
			_priority_index.clear();
			_list.clear();
			_bundle_lengths.clear();

			// set the storage size to zero
			clearSpace();
		}
Example #5
0
/**************************************************************************************************
*    function   :   load system.ini file
*    para       :   {char *conf} system.ini path
*
*    return     :   {int} -1:error;0:ok.
*
*    history    :   {2013.8.9 wujun} frist create;
**************************************************************************************************/
int config(char *conf)
{
    int k=0;
    FILE *fp;
    fp = fopen(conf, "r");

    char buff[1000];
    memset(buff, 0, 1000);

    FtpServer * fsNode;

    fs=(FtpServer *)malloc(sizeof(FtpServer));
    memset(fs, 0, sizeof(FtpServer));
    fs->next = NULL;

    sl = (StationList *)malloc(sizeof(StationList));
    memset(sl,0,sizeof(StationList));
    sl->next = NULL;

    uploadPath = (UploadPath*)malloc(sizeof(UploadPath));
    memset(uploadPath, 0, sizeof(UploadPath));


    if(fp == NULL)
    {
        printf("open file error.\n");
        return -1;
    }

    while(fgets(buff, 1000, fp) != NULL)
    {
        if((buff[0] == '#') || (buff[0] == '\n') )
        {
            continue;
        }

        clearSpace(buff);
        //printf("%s\n",buff);

        int i, j;
        i = j =0;
        while(buff[i++] != ':');
        char *name;
        name = (char *)malloc(i);
        memset(name, 0, i);
        strncpy(name, buff, i-1);
        j = i;
        clearSpace(name);

        int parNum = 0;
        if( !strcmp(name,"productCenterFtp"))
        {
            fsNode = (FtpServer*)malloc(sizeof(FtpServer));
            memset(fsNode, 0, sizeof(FtpServer));
            printf("new node addr: \t%o\n",fsNode);

            while(buff[i-1] !='\n')
            {
                while(buff[i++] != '\t' && buff[i-1] != '\n');
                switch( ++parNum )
                {
                case 1://ftp server ip
                {
                    fsNode->ip = (char *)malloc(i-j);
                    memset(fsNode->ip, 0, i-j);
                    strncpy(fsNode->ip,buff+j, i-j-1);
                    j = i;
#ifdef DEBUG
                    printf("ip:%s\n",fsNode->ip);
#endif
                    break;
                }
                case 2://port
                {
                    char port[10] = {0};
                    strncpy(port,buff+j, i-j-1);
                    fsNode->port = atoi(port);
                    j = i;
#ifdef DEBUG
                    printf("port:%d\n",fsNode->ip);
#endif
                    break;
                }
                case 3://username
                {
                    fsNode->username = (char *)malloc(i-j);
                    memset(fsNode->username, 0, i-j);
                    strncpy(fsNode->username,buff+j, i-j-1);
                    j = i;


                    if( buff[i-1] == '\n')
                    {
                        fsNode->passwd = (char *)malloc(1);
                        memset(fsNode->passwd, 0, 1);

                    }

#ifdef DEBUG
                    printf("username:%s\n",fsNode->username);
#endif
                    break;
                }
                case 4://passwd
                {
                    fsNode->passwd = (char *)malloc(i-j);
                    memset(fsNode->passwd, 0, i-j);
                    strncpy(fsNode->passwd,buff+j, i-j-1);

#ifdef DEBUG
                    printf("passwd:%s\n",fsNode->passwd);
#endif
                    break;

                }
                default:
                    break;
                }

            }

            //make sure the product cener fpt info placed in the first node.
            fs->next = fsNode;
            printf("fs:%o\tnode%o\n",fs->next,fsNode);


            printf("fsNode->ip:%s\n",fsNode->ip);
            printf("fs:%o\tnode%o\n",fs->next,fsNode);
            fsNode ->next = NULL;
            fsNode = NULL;

        }


        if( !strcmp(name,"dataCenterFtp"))
        {
            fsNode = (FtpServer*)malloc(sizeof(FtpServer));
            memset(fsNode, 0, sizeof(FtpServer));
            parNum = 0;
            while(buff[i-1] !='\n')
            {
                while(buff[i++] != '\t' && buff[i-1] != '\n');
                switch( ++parNum )
                {
                case 1://ftp server ip
                {
                    fsNode->ip = (char *)malloc(i-j);
                    memset(fsNode->ip, 0, i-j);
                    strncpy(fsNode->ip,buff+j, i-j-1);
                    j = i;

#ifdef DEBUG
                    printf("fsNode->ip:%s\n",fsNode->ip);
#endif
                    break;
                }
                case 2://port
                {
                    char port[10] = {0};
                    strncpy(port,buff+j, i-j-1);
                    fsNode->port = atoi(port);
                    j = i;
#ifdef DEBUG
                    printf("port:%d\n",fsNode->ip);
#endif
                    break;
                }
                case 3://username
                {
                    fsNode->username = (char *)malloc(i-j);
                    memset(fsNode->username, 0, i-j);
                    strncpy(fsNode->username,buff+j, i-j-1);
                    j = i;


                    if( buff[i-1] == '\n')
                    {
                        fsNode->passwd = NULL;
                    }

#ifdef DEBUG
                    printf("username:%s\n",fsNode->username);
#endif
                    break;
                }
                case 4://passwd
                {
                    fsNode->passwd = (char *)malloc(i-j);
                    memset(fsNode->passwd, 0, i-j);
                    strncpy(fsNode->passwd,buff+j, i-j-1);

#ifdef DEBUG
                    printf("passwd:%s\n",fsNode->passwd);
#endif
                    break;

                }
                default:
                    break;
                }

            }

            //make sure the product cener fpt info placed in the first node.
            if(fs->next == NULL)
            {
                fsNode ->next = NULL;
                fs->next = fsNode;

            } else
            {
                FtpServer * tmp = fs->next->next;
                fsNode ->next = tmp;
                fs->next->next = fsNode;


            }

            fsNode = NULL;

        }

        if( !strcmp(name,"stations"))
        {
            printf("buf:%s\n",buff);
            while(buff[i-1] !='\n')
            {
                while(buff[i++] != '\t' && buff[i-1] != '\n');
                char *statesionFileName;
                statesionFileName = (char *)malloc(i-j);
                memset(statesionFileName, 0, i-j);
                strncpy(statesionFileName,buff+j, i-j-1);

                j = i;
                printf("statesionFileName:%s\n",statesionFileName);

                StationList *slNode;
                slNode = (StationList *)malloc(sizeof(StationList));
                memset(slNode, 0, sizeof(StationList));

                FILE *fp = fopen(statesionFileName,"r");
                if(fp == NULL)
                {
                    printf("The file %s does not exist.\n",statesionFileName);
                    return -1;
                }

                char buf[7];
                char (*station)[5];

                while(fgets(buf,7,fp))
                {
                    k++;
                }

                printf("k = %d\n",k);

                station = (char **)malloc(k*5);
                memset(station,0,k*5);

                fseek(fp, 0,SEEK_SET);
                while(fgets(buf,7,fp))
                {
                    strncpy(station[--k], buf, 4);
                    //printf("%s\n",station[k]);
                }

                slNode ->name = statesionFileName;
                slNode ->station = station;
                sl->next = slNode;
                slNode ->next = NULL;

                //free(station);
                fclose(fp);
                k = 0;
            }
        }

        if( !strcmp(name,"tempDownloadFileSuffix"))
        {
            while(buff[i++] !='\n');
            tempDownloadFileSuffix = (char *)malloc(i-j);
            memset(tempDownloadFileSuffix, 0, i-j);
            strncpy( tempDownloadFileSuffix, buff+j, i-j-1);
            clearSpace(tempDownloadFileSuffix);
            j = i;
            printf("%s\n",tempDownloadFileSuffix);
        }

        if( !strcmp(name,"tempUploadFileSuffix"))
        {
            while(buff[i++] !='\n');
            tempUploadFileSuffix = (char *)malloc(i-j);
            memset(tempUploadFileSuffix, 0, i-j);
            strncpy( tempUploadFileSuffix, buff+j, i-j-1);
            clearSpace(tempUploadFileSuffix);
            j = i;
            printf("%s\n",tempUploadFileSuffix);
        }

        if( !strcmp(name,"BDLocalPathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->BDLocalPathPrefix = (char *)malloc(i-j);
            memset(uploadPath->BDLocalPathPrefix, 0, i-j);
            strncpy( uploadPath->BDLocalPathPrefix, buff+j, i-j-1);
            clearSpace(uploadPath->BDLocalPathPrefix);
            j = i;
            printf("%s\n",uploadPath->BDLocalPathPrefix);

        }

        if( !strcmp(name,"GNSSLocalPathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->GNSSLocalPathPrefix = (char *)malloc(i-j);
            memset(uploadPath->GNSSLocalPathPrefix, 0, i-j);
            strncpy( uploadPath->GNSSLocalPathPrefix, buff+j, i-j-1);
            clearSpace(uploadPath->GNSSLocalPathPrefix);
            j = i;
            printf("%s\n",uploadPath->GNSSLocalPathPrefix);

        }

        if( !strcmp(name,"BDLocalPathPrefixBak"))
        {
            while(buff[i++] !='\n');
            uploadPath->BDLocalPathPrefixBak = (char *)malloc(i-j);
            memset(uploadPath->BDLocalPathPrefixBak, 0, i-j);
            strncpy( uploadPath->BDLocalPathPrefixBak, buff+j, i-j-1);
            clearSpace(uploadPath->BDLocalPathPrefixBak);
            j = i;
            printf("%s\n",uploadPath->BDLocalPathPrefixBak);
        }


        if( !strcmp(name,"GNSSLocalPathPrefixBak"))
        {
            while(buff[i++] !='\n');
            uploadPath->GNSSLocalPathPrefixBak = (char *)malloc(i-j);
            memset(uploadPath->GNSSLocalPathPrefixBak, 0, i-j);
            strncpy( uploadPath->GNSSLocalPathPrefixBak, buff+j, i-j-1);
            clearSpace(uploadPath->GNSSLocalPathPrefixBak);
            j = i;
            printf("%s\n",uploadPath->GNSSLocalPathPrefixBak);

        }

        if( !strcmp(name,"BDRemotePathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->BDRemotePathPrefix = (char *)malloc(i-j);
            memset(uploadPath->BDRemotePathPrefix, 0, i-j);
            strncpy( uploadPath->BDRemotePathPrefix, buff+j, i-j-1);
            clearSpace(uploadPath->BDRemotePathPrefix);
            j = i;
            printf("%s\n",uploadPath->BDRemotePathPrefix);

        }


        if( !strcmp(name,"GNSSRemotePathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->GNSSRemotePathPrefix = (char *)malloc(i-j);
            memset(uploadPath->GNSSRemotePathPrefix, 0, i-j);
            strncpy( uploadPath->GNSSRemotePathPrefix, buff+j, i-j-1);
            clearSpace(uploadPath->GNSSRemotePathPrefix);
            j = i;
            printf("%s\n",uploadPath->GNSSRemotePathPrefix);

        }

    }


    fclose(fp);
}
Example #6
0
int main(int argc, char * argv[], char * envp[]) {

    char s[100]; //Maximum assumed length of any command word
    int ch;
    char * temp;
    char * hostName;
    hostName = (char *) malloc(sizeof(char) * HOST_NAME_MAX);
    gethostname(hostName, HOST_NAME_MAX);
    char result[ PATH_MAX ];
    ssize_t count = readlink( "/proc/self/exe", result, PATH_MAX );
    setenv("SHELL",result,1);
    ifp = stdin;
    if(argc > 1) {
        ifp = fopen(argv[1], "r");
        if(ifp == NULL) {
            printf("Unable to open file. User can enter commands manually.\n");
            ifp = stdin;
        }
    }

    while(!feof(ifp)) {
        if(argc <= 1) {
            printf("|%s@%s:%s$| ", getenv("USER"), hostName, getcwd(temp,PATH_MAX));
        }
        fscanf(ifp, "%s", s); //Read next command

        if(strcmp(s, "clr") == 0) {
            clear();
            printf("\033[2J\033[1;1H");
            /* The first one (\033[2J) clears the entire screen (J) from top to bottom (2). The second code (\033[1;1H) positions 				the cursor at row 1, column 1.*/
        }
        // Home command
        else if(strcmp(s, "HOME") == 0) {
            printf("%s\n", getenv(s));
        }
        // ls or dir command
        else if(strcmp(s, "dir") == 0) {
            clearSpace();
            if((ch = getchar()) == '\n')
                listDir(getcwd(temp, PATH_MAX));
            else {
                ungetc(ch, ifp);
                fscanf(ifp, "%s", s);
                listDir(s);
            }
        }
        // environ command
        else if(strcmp(s, "environ") == 0 ) {
            printEnvList(envp);
        }
        // echo command
        else if(strcmp(s, "echo") == 0) {
            dumpInput();
        }
        // quit command
        else if(strcmp(s, "quit") == 0) {
            exit(0);
        }
        // pwd command
        else if(strcmp(s, "pwd") == 0) {
            printf("%s\n", getenv("PWD"));
        }
        // pause command
        else if(strcmp(s, "pause") == 0) {
            while((ch = getc(ifp)) != '\n'); //For clearing input buffer from the same line of pause
            printf("Press enter or return key to resume.\n");
            while((ch = getc(ifp)) != '\n');
            //pause();
        }
        // help command
        else if(strcmp(s, "help") == 0) {
            clearSpace();
            if((ch = getc(ifp)) == '\n') {
                help();
            }
            else {
                ungetc(ch, ifp);
                fscanf(ifp, "%s", s);
                ind_help(s);
            }
        }
        // change directory command
        else if(strcmp(s, "cd") == 0) {
            clearSpace();
            if((ch = getc(ifp)) == '\n')
                printf("%s\n", getcwd(temp, PATH_MAX));
            else {
                ungetc(ch, ifp);
                fscanf(ifp, "%s", s);
                if(chdir(s) != 0)
                    printf("Error changing directory.\n");
                else setenv("PWD", getcwd(temp, PATH_MAX), 1);
            }
        }
    }//End of while(1)
    return 0;
}
Example #7
0
/**************************************************************************************************
*    function   :   load system.ini file
*    para       :   {char *conf} system.ini path
*
*    return     :   {int} -1:error;0:ok.
*
*    history    :   {2013.8.9 wujun} frist create;
**************************************************************************************************/
int loadSystem(char *conf)
{
    int k=0;
    FILE *fp = fopen(conf, "r");
    if(fp == NULL)
    {
        #ifdef DEBUG
        printf("Fun(loadSystem):%s open error.\n",conf);
        #endif
        return -1;
    }

    FtpServer  *fsNode;

    uploadPath = (UploadPath*)malloc(sizeof(UploadPath));
    if( uploadPath == NULL )
    {
        printf("Fun(loadSystem): malloc 'uploadPath' error.\n");
        return -1;
    }
    memset(uploadPath, 0, sizeof(UploadPath));

    char buff[1000];
    memset(buff, 0, 1000);
    while(fgets(buff, 1000, fp) != NULL)
    {
        if((buff[0] == '#') || (buff[0] == '\n') )
        {
            continue;
        }

        clearSpace(buff);

        int i, j;
        i = j =0;
        while(buff[i++] != ':');
        char *name;
        name = (char *)malloc(i);
        if(name == NULL)
        {
            #ifdef DEBUG
            printf("Fun(loadSystem): malloc \"name\" error.\n");
            #endif
            return -1;
        }

        memset(name, 0, i);
        strncpy(name, buff, i-1);
        j = i;

        int parNum = 0;
        if( !strcmp(name,"productCenterFtp"))
        {
            fsNode = (FtpServer*)malloc(sizeof(FtpServer));
            if(fsNode == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc product center \"fsNode\" error.\n");
                #endif
                return -1;
            }
            memset(fsNode, 0, sizeof(FtpServer));

            while(buff[i-1] !='\n')
            {
                while(buff[i++] != '\t' && buff[i-1] != '\n');
                switch( ++parNum )
                {
                    case 1://ftp server ip
                    {
                        fsNode->ip = (char *)malloc(i-j);
                        if( fsNode->ip == NULL )
                        {
                            #ifdef DEBUG
                            printf("Fun(loadSystem): malloc \"fsNode->ip\" error.\n");
                            #endif
                            return -1;
                        }
                        memset(fsNode->ip, 0, i-j);
                        strncpy(fsNode->ip,buff+j, i-j-1);
                        j = i;
                        break;
                    }
                    case 2://port
                    {
                        char port[10] = {0};
                        strncpy(port,buff+j, i-j-1);
                        fsNode->port = atoi(port);
                        j = i;
                        break;
                    }
                    case 3://username
                    {
                        fsNode->username = (char *)malloc(i-j);
                        if( fsNode->username == NULL )
                        {
                            #ifdef DEBUG
                            printf("Fun(loadSystem): malloc \"fsNode->username\" error.\n");
                            #endif
                            return -1;
                        }
                        memset(fsNode->username, 0, i-j);
                        strncpy(fsNode->username,buff+j, i-j-1);
                        j = i;

                        if( buff[i-1] == '\n')
                        {
                            fsNode->passwd = NULL;
                        }
                        break;
                    }
                    case 4://passwd
                    {
                        fsNode->passwd = (char *)malloc(i-j);
                        if( fsNode->passwd == NULL )
                        {
                            #ifdef DEBUG
                            printf("Fun(loadSystem): malloc \"fsNode->passwd\" error.\n");
                            #endif
                            return -1;
                        }
                        memset(fsNode->passwd, 0, i-j);
                        strncpy(fsNode->passwd,buff+j, i-j-1);
                        break;
                    }
                    default:break;
                }
            }

            //make sure the product cener fpt info placed in the first node.
            fs->next = fsNode;
            fsNode ->next = NULL;
            fsNode = NULL;
        }

        if( !strcmp(name,"dataCenterFtp"))
        {
            fsNode = (FtpServer*)malloc(sizeof(FtpServer));
            if( fsNode == NULL )
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc dataCenter \"fsNode\" error.\n");
                #endif
                return -1;
            }

            memset(fsNode, 0, sizeof(FtpServer));
            parNum = 0;
            while(buff[i-1] !='\n')
            {
                while(buff[i++] != '\t' && buff[i-1] != '\n');
                switch( ++parNum )
                {
                    case 1://ftp server ip
                    {
                        fsNode->ip = (char *)malloc(i-j);
                        if( fsNode->ip == NULL )
                        {
                            #ifdef DEBUG
                            printf("Fun(loadSystem): malloc dataCenter \"fsNode->ip\" error.\n");
                            #endif
                            return -1;
                        }
                        memset(fsNode->ip, 0, i-j);
                        strncpy(fsNode->ip,buff+j, i-j-1);
                        j = i;
                        break;
                    }
                    case 2://port
                    {
                        char port[10] = {0};
                        strncpy(port,buff+j, i-j-1);
                        fsNode->port = atoi(port);
                        j = i;
                        break;
                    }
                    case 3://username
                    {
                        fsNode->username = (char *)malloc(i-j);
                        if( fsNode->username == NULL )
                        {
                            #ifdef DEBUG
                            printf("Fun(loadSystem): malloc dataCenter \"fsNode->username\" error.\n");
                            #endif
                            return -1;
                        }
                        memset(fsNode->username, 0, i-j);
                        strncpy(fsNode->username,buff+j, i-j-1);
                        j = i;

                        if( buff[i-1] == '\n')
                        {
                            fsNode->passwd = NULL;
                        }
                        break;
                    }
                    case 4://passwd
                    {
                        fsNode->passwd = (char *)malloc(i-j);
                        if( fsNode->passwd == NULL )
                        {
                            #ifdef DEBUG
                            printf("Fun(loadSystem): malloc dataCenter \"fsNode->passwd\" error.\n");
                            #endif
                            return -1;
                        }
                        memset(fsNode->passwd, 0, i-j);
                        strncpy(fsNode->passwd,buff+j, i-j-1);

                        break;
                    }
                    default:break;
                }
            }

            //make sure the product cener fpt info placed in the first node.
            if(fs->next == NULL)
            {
                fsNode ->next = NULL;
                fs->next = fsNode;

            }else
            {
                FtpServer  *tmp = fs->next->next;
                fsNode ->next = tmp;
                fs->next->next = fsNode;
            }

            fsNode = NULL;
        }

        if( !strcmp(name,"stations"))
        {
            while(buff[i-1] !='\n')
            {
                while(buff[i++] != '\t' && buff[i-1] != '\n');
                char *statesionFileName;
                statesionFileName = (char *)malloc(i-j);
                if( statesionFileName == NULL )
                {
                    #ifdef DEBUG
                    printf("Fun(loadSystem): malloc \"statesionFileName\" error.\n");
                    #endif
                    return -1;
                }
                memset(statesionFileName, 0, i-j);
                strncpy(statesionFileName,buff+j, i-j-1);

                j = i;

                StationNode *slNode,*temp;
                slNode = (StationNode *)malloc(sizeof(StationNode));
                if( slNode == NULL )
                {
                    #ifdef DEBUG
                    printf("Fun(loadSystem): malloc \"slNode\" error.\n");
                    #endif
                    return -1;
                }
                memset(slNode, 0, sizeof(StationNode));

                FILE *fp = fopen(statesionFileName,"r");
                if(fp == NULL)
                {
                    #ifdef DEBUG
                    printf("Fun(loadSystem): %s does not exist.\n",statesionFileName);
                    #endif
                    return -1;
                }

                char buf[7];
                char (*station)[5];

                while(fgets(buf,7,fp))
                {
                    k++;
                }

                station = (char **)malloc(k*5);
                if(station == NULL)
                {
                    #ifdef DEBUG
                    printf("Fun(loadSystem): malloc \"station\" error.\n");
                    #endif
                    return -1;
                }
                memset(station,0,k*5);

                fseek(fp, 0,SEEK_SET);
                int t = 0;
                 while(fgets(buf,7,fp))
                {
                    if(t<k)
                    {
                        strncpy(station[t++], buf, 4);
                    }
                    memset(buf, 0, 7);

                }

                slNode ->name = statesionFileName;
                slNode ->station = station;
                slNode ->stationNum = k;
                temp = sl->next;
                sl->next = slNode;
                slNode ->next = temp;

                fclose(fp);
                delay();
                k = 0;
            }
        }

        if( !strcmp(name,"tempDownloadFileSuffix"))
        {
            while(buff[i++] !='\n');
            tempDownloadFileSuffix = (char *)malloc(i-j);
            if(tempDownloadFileSuffix == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"tempDownloadFileSuffix\" error.\n");
                #endif
                return -1;
            }
            memset(tempDownloadFileSuffix, 0, i-j);
            strncpy( tempDownloadFileSuffix, buff+j, i-j-1);
            j = i;

        }

        if( !strcmp(name,"tempUploadFileSuffix"))
        {
            while(buff[i++] !='\n');
            tempUploadFileSuffix = (char *)malloc(i-j);
            if(tempUploadFileSuffix == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"tempUploadFileSuffix\" error.\n");
                #endif
                return -1;
            }
            memset(tempUploadFileSuffix, 0, i-j);
            strncpy( tempUploadFileSuffix, buff+j, i-j-1);
            j = i;
        }

        if( !strcmp(name,"maxDownloadTaskNum"))
        {
            while(buff[i++] !='\n');
            char *num = (char *)malloc(i-j);
            if(num == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"num\" error.\n");
                #endif
                return -1;
            }
            memset(num, 0, i-j);
            strncpy( num, buff+j, i-j-1);
            j = i;
            maxDownloadTaskNum = atoi(num);

        }

        if( !strcmp(name,(const char *)"BDLocalPathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->BDLocalPathPrefix = (char *)malloc(i-j);
            if(uploadPath->BDLocalPathPrefix == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"uploadPath->BDLocalPathPrefix\" error.\n");
                #endif
                return -1;
            }
            memset(uploadPath->BDLocalPathPrefix, 0, i-j);
            strncpy( uploadPath->BDLocalPathPrefix, buff+j, i-j-1);
            j = i;
        }

        if( !strcmp(name,"GNSSLocalPathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->GNSSLocalPathPrefix = (char *)malloc(i-j);
            if(uploadPath->GNSSLocalPathPrefix == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"uploadPath->GNSSLocalPathPrefix\" error.\n");
                #endif
                return -1;
            }
            memset(uploadPath->GNSSLocalPathPrefix, 0, i-j);
            strncpy( uploadPath->GNSSLocalPathPrefix, buff+j, i-j-1);
            j = i;

        }

        if( !strcmp(name,"BDLocalPathPrefixBak"))
        {
            while(buff[i++] !='\n');
            uploadPath->BDLocalPathPrefixBak = (char *)malloc(i-j);
            if(uploadPath->BDLocalPathPrefixBak == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"uploadPath->BDLocalPathPrefixBak\" error.\n");
                #endif
                return -1;
            }
            memset(uploadPath->BDLocalPathPrefixBak, 0, i-j);
            strncpy( uploadPath->BDLocalPathPrefixBak, buff+j, i-j-1);
            j = i;

        }


        if( !strcmp(name,"GNSSLocalPathPrefixBak"))
        {
            while(buff[i++] !='\n');
            uploadPath->GNSSLocalPathPrefixBak = (char *)malloc(i-j);
            if(uploadPath->GNSSLocalPathPrefixBak == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"uploadPath->GNSSLocalPathPrefixBak\" error.\n");
                #endif
                return -1;
            }
            memset(uploadPath->GNSSLocalPathPrefixBak, 0, i-j);
            strncpy( uploadPath->GNSSLocalPathPrefixBak, buff+j, i-j-1);
            j = i;

        }

        if( !strcmp(name,"BDRemotePathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->BDRemotePathPrefix = (char *)malloc(i-j);
            if(uploadPath->BDRemotePathPrefix == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"uploadPath->BDRemotePathPrefix\" error.\n");
                #endif
                return -1;
            }
            memset(uploadPath->BDRemotePathPrefix, 0, i-j);
            strncpy( uploadPath->BDRemotePathPrefix, buff+j, i-j-1);
            j = i;

        }


        if( !strcmp(name,"GNSSRemotePathPrefix"))
        {
            while(buff[i++] !='\n');
            uploadPath->GNSSRemotePathPrefix = (char *)malloc(i-j);
            if(uploadPath->GNSSRemotePathPrefix == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"uploadPath->GNSSRemotePathPrefix\" error.\n");
                #endif
                return -1;
            }
            memset(uploadPath->GNSSRemotePathPrefix, 0, i-j);
            strncpy( uploadPath->GNSSRemotePathPrefix, buff+j, i-j-1);
            j = i;

        }

        if( !strcmp(name,"downloadInfoFile"))
        {

            while(buff[i++] !='\n');
            downloadInfoFile = (char *)malloc(i-j);
            if(downloadInfoFile == NULL)
            {
                #ifdef DEBUG
                printf("Fun(loadSystem): malloc \"downloadInfoFile\" error.\n");
                #endif
                return -1;
            }
            memset(downloadInfoFile, 0, i-j);
            strncpy( downloadInfoFile, buff+j, i-j-1);
            j = i;

        }
    }

    fclose(fp);
    delay();
}