ISNETプロトコル用ライブラリ. More...
#include "isnet.h"
#include "isnet_server.c"
#include "isnet_client.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) |
Definition in file isnet.c.
Buffer get_command(Buffer msg)
Buffer (命令)からコマンド部を取り出す.小文字は大文字に変換する.
msg | 命令を格納した Buffer.改行コードは入れない. |
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 }
Buffer get_comment(Buffer msg)
Buffer(命令)からコメント部を取り出す.空白も含む.
msg | 命令を格納した Buffer.改行コードは入れない. |
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 }
Buffer get_operand(Buffer msg)
Buffer(命令)からオペランド部を取り出す.小文字は大文字に変換する.
msg | 命令を格納した Buffer.改行コードは入れない. |
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 }