int main () { int32_t fd, cnt; uint8_t buf[1024]; if (0 != ece391_getargs (buf, 1024)) { ece391_fdputs (1, (uint8_t*)"could not read arguments\n"); return 3; } if (-1 == (fd = ece391_open (buf))) { ece391_fdputs (1, (uint8_t*)"file not found\n"); return 2; } while (0 != (cnt = ece391_read (fd, buf, 1024))) { if (-1 == cnt) { ece391_fdputs (1, (uint8_t*)"file read failed\n"); return 3; } if (-1 == ece391_write (1, buf, cnt)) return 3; } return 0; }
int main () { int32_t fd, cnt; uint8_t buf[SBUFSIZE]; uint8_t search[BUFSIZE]; if (0 != ece391_getargs (search, BUFSIZE)) { ece391_fdputs (1, (uint8_t*)"could not read argument\n"); return 3; } if (-1 == (fd = ece391_open ((uint8_t*)"."))) { ece391_fdputs (1, (uint8_t*)"directory open failed\n"); return 2; } while (0 != (cnt = ece391_read (fd, buf, SBUFSIZE-1))) { if (-1 == cnt) { ece391_fdputs (1, (uint8_t*)"directory entry read failed\n"); return 3; } if ('.' == buf[0]) /* a directory... */ continue; buf[cnt] = '\0'; if (0 != do_one_file ((char*)search, (char*)buf)) return 3; } return 0; }
int main () { uint8_t buf[BUFSIZE]; if (0 != ece391_getargs (buf, BUFSIZE)) { ece391_fdputs (1, (uint8_t*)"could not read filename\n"); return 3; } if (ece391_soundctrl(CTRL_PLAY_FILE, (int8_t*) buf) < 0) { ece391_fdputs(1, (uint8_t*)"could not play; is something else playing or did you pass a non-existant file?\n"); } return 0; }