- 論壇徽章:
- 0
|
今天下午沒事很么事干.于是在sourceforge上下了tftp服務器和客戶端的源碼.linux平臺上的. 這個代碼看的我真是火大.
代碼寫的簡直讓人無法閱讀... 亂七八糟的縮進. 一行超出整個屏幕.更別說在80個字符以內了.即使再簡單.作者也不應該這樣來編碼.奶奶的熊...
原先還以為是VC的毛病. 換到linux上.用vim來看...依舊如此...不曉得作者用的神馬編輯器.
特此來發(fā)泄一下不滿... 貼上代碼片段.- while (1) /* our break statement will escape us when we are done */
- {
- acked = 0;
- ssize = fread (filebuf, 1, datasize, fp);
- if (debug)
- {
- printf
- ("The first data block has been read from the file and will be sent to the server\n");
- printf ("The size read from the file is: %d\n", ssize);
- }
- count++; /* count number of datasize byte portions we read from the file */
- if (count == 1) /* we always look for an ack on the FIRST packet */
- bcount = 0;
- else if (count == 2) /* The second packet will always start our counter at zreo. This special case needs to exist to avoid a DBZ when count = 2 - 2 = 0 */
- bcount = 0;
- else
- bcount = (count - 2) % ackfreq;
復制代碼 |
|