liberipc/src/eripcsetup.c File Reference

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "eripc.h"
#include "eripcclient.h"
#include "eripcsetup.h"
#include "eripcparser.h"

Go to the source code of this file.

Functions

int stGotoPage (erClientChannel_t channel, int page)
int stParseCommand (char *szCommand, erIpcCmd_t *pCmd)


Function Documentation

int stGotoPage ( erClientChannel_t  channel,
int  page 
)

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

Definition at line 39 of file eripcsetup.c.

00040 {
00041     erIpcCmd_t cmd;
00042 
00043     strcpy(cmd.name, "stGotoPage");
00044     cmd.cc = (int) ccStGotoPage;
00045     cmd.nArg = 1;
00046     sprintf(cmd.arg[0], "%d", page);
00047 
00048     return erIpcSndCommand(channel, &cmd);
00049 }

Here is the call graph for this function:

int stParseCommand ( char *  szCommand,
erIpcCmd_t pCmd 
)

Definition at line 55 of file eripcsetup.c.

00056 {
00057     int     i;
00058     char   *pChar;
00059     char    szToken[TB_MAXCHARONLINE];
00060     int     nReqArgs = 0;
00061 
00062     pCmd->cc = (int) ccStUndefined;
00063     for (i = 0; i < TB_N_ARG; i++)
00064     {
00065         strcpy(pCmd->arg[i], "");
00066     }
00067 
00068     // Parse Command
00069     pChar = szCommand;
00070     i = 0;
00071     while (*pChar != '\0')
00072     {
00073         szToken[i] = '\0';
00074         if (*pChar == ',')
00075         {
00076             pChar++;
00077             break;
00078         }
00079         szToken[i] = *pChar++;
00080         i++;
00081         szToken[i] = '\0';
00082     }
00083 
00084     // We have found the command Token. Figure out what the command is.
00085 
00086     // TODO: stop doing this hardcoded, rely on a smart datastructure instead.
00087 
00088     if (!strcmp(szToken, "stGotoPage") || !strcmp(szToken, "0"))
00089     {
00090         strcpy(pCmd->name, szToken);
00091         pCmd->cc = (int) ccStGotoPage;
00092         nReqArgs = 1;
00093         pCmd->nArg = 1;
00094     }
00095     else
00096     {
00097         strcpy(pCmd->name, "Undefined");
00098         pCmd->cc = (int) ccStUndefined;
00099         fprintf(stderr, "%s: Command %s \n", __FUNCTION__, szToken);
00100         fprintf(stderr, "Error parsing (%s). Command undefined\n", szCommand);
00101         pCmd->nArg = -1;
00102         return -1;
00103     }
00104 
00105     if (nReqArgs > 0)
00106     {
00107         erIpcGetArgs(pChar, pCmd, nReqArgs);
00108     }
00109     return 0;
00110 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:11:46 2008 by  doxygen 1.5.6