xLib/isnet.c File Reference

ISNETプロトコル用ライブラリ. More...

#include "isnet.h"
#include "isnet_server.c"
#include "isnet_client.c"
Include dependency graph for isnet.c:

Go to the source code of this file.

Functions

Buffer get_command (Buffer msg)
Buffer get_operand (Buffer msg)
Buffer get_comment (Buffer msg)

Detailed Description

Author:
Fumi.Iseki (C)
Attention:
make_Buffer() の確保チェックを行っていない.

Definition in file isnet.c.


Function Documentation

Buffer get_command ( Buffer  msg  ) 

Buffer get_command(Buffer msg)

Buffer (命令)からコマンド部を取り出す.小文字は大文字に変換する.

Parameters:
msg 命令を格納した Buffer.改行コードは入れない.
Returns:
コマンド部を格納した Buffer
Attention:
注: 命令は comannd_operand_comment (_は複数の空白) の形をしている.comment自体は空白を含んでも良い.

Definition at line 37 of file isnet.c.

References Buffer::buf, cawk_Buffer(), and make_Buffer().

Referenced by send_command_recv_ans().

00038 {
00039     unsigned int i;
00040     Buffer com;
00041 
00042     com = cawk_Buffer(msg, ' ', 1);
00043     if (com.buf==NULL) {
00044         com = make_Buffer(1);
00045         return com;
00046     }
00047 
00048     for (i=0; i<strlen((const char*)com.buf); i++) {
00049         if (com.buf[i]>='a' && com.buf[i]<='z') com.buf[i] += - 'a' + 'A';
00050     }
00051     return com;
00052 }

Here is the call graph for this function:

Here is the caller graph for this function:

Buffer get_comment ( Buffer  msg  ) 

Buffer get_comment(Buffer msg)

Buffer(命令)からコメント部を取り出す.空白も含む.

Parameters:
msg 命令を格納した Buffer.改行コードは入れない.
Returns:
コメント部を格納した Buffer
Attention:
注: 命令は comannd_operand_comment (_は複数の空白) の形をしている.comment自体は空白を含んでも良い.

Definition at line 90 of file isnet.c.

References Buffer::buf, make_Buffer(), and Buffer::vldsz.

00091 {
00092     int i, j, pos, cnt;
00093     char*  buf;
00094     Buffer com;
00095 
00096     buf = (char*)msg.buf;
00097     for(i=0, j=0; j<2; j++) {
00098         while (buf[i]!='\0' && buf[i]!=' ') i++;
00099         while (buf[i]!='\0' && buf[i]==' ') i++;
00100     }
00101 
00102     pos = i;
00103     while (buf[i]!='\0') i++;
00104     cnt = i - pos;
00105     com = make_Buffer(cnt+1);
00106 
00107     if (com.buf==NULL) com = make_Buffer(1);
00108     else {
00109         for (i=0; i<cnt; i++) com.buf[i] = buf[pos+i];
00110         com.vldsz = cnt;
00111     }
00112 
00113     return com;
00114 }

Here is the call graph for this function:

Buffer get_operand ( Buffer  msg  ) 

Buffer get_operand(Buffer msg)

Buffer(命令)からオペランド部を取り出す.小文字は大文字に変換する.

Parameters:
msg 命令を格納した Buffer.改行コードは入れない.
Returns:
オペランド部を格納した Buffer
Attention:
注: 命令は comannd_operand_comment (_は複数の空白) の形をしている.comment自体は空白を含んでも良い.

Definition at line 67 of file isnet.c.

References Buffer::buf, cawk_Buffer(), and make_Buffer().

Referenced by send_command_recv_ans().

00068 {
00069     Buffer opr;
00070 
00071     opr = cawk_Buffer(msg, ' ', 2);
00072     if (opr.buf==NULL) opr = make_Buffer(1);
00073 
00074     return opr;
00075 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 15 Nov 2023 for JunkBox_Lib by  doxygen 1.6.1