XINU
|
Go to the source code of this file.
Functions | |
int | atoi (char *) |
ASCII文字列をint型に変換する。 More... | |
shellcmd | xsh_udpecho (int nargs, char *args[]) |
int atoi | ( | char * | p | ) |
ASCII文字列をint型に変換する。
処理の流れは、
Step1. 「不要な文字(空白、TAB)の削除」もしくは「正数/負数の判定」を行う
Step2. 0〜9の範囲の値であれば、一桁ずつ記録する。それ以外の文字は呼び飛ばす
ASCIIコードとして、0=0x30、1=0x31、2=0x32、…、9=0x39であるため、
「0x30〜0x39の範囲のASCIIコード値(0〜9の値) - '0'(=0x30)」と計算すれば、
0〜9の整数値が得られる。
Step3. Step.1で取得した符号情報(±)を反映した整数を返す。
[in] | p | ASCII文字列 |
Definition at line 19 of file atoi.c.
Referenced by xsh_udpecho().
shellcmd xsh_udpecho | ( | int | nargs, |
char * | args[] | ||
) |
Definition at line 14 of file xsh_udpecho.c.
References atoi(), delay(), dot2ip(), fprintf(), printf(), stderr, strncmp(), strnlen(), SYSERR, TIMEOUT, udp_recv(), udp_register(), udp_release(), and udp_send().