Don't use for each loops
The hare compiler on OpenBSD doesn't support them :(
This commit is contained in:
parent
d921a2b144
commit
ea527a2065
@ -116,14 +116,16 @@ export fn post(input: io::handle, board: str, user_name: (str | void)) (void | e
|
||||
};
|
||||
|
||||
export fn list(output: io::handle) (void | error) = {
|
||||
for (let directory .. bulb_path) list_boards_in(output, directory)?;
|
||||
for (let index = 0z; index < len(bulb_path); index += 1) {
|
||||
list_boards_in(output, bulb_path[index])?;
|
||||
};
|
||||
};
|
||||
|
||||
export fn look_up_board(board: str) (str | no_such_board | invalid_board) = {
|
||||
validate_board_name(board)?;
|
||||
static let buf = path::buffer { ... };
|
||||
for (let directory .. bulb_path) {
|
||||
let location = path::set(&buf, directory, board)!;
|
||||
for (let index = 0z; index < len(bulb_path); index += 1) {
|
||||
let location = path::set(&buf, bulb_path[index], board)!;
|
||||
match (os::stat(location)) {
|
||||
case fs::filestat => return location;
|
||||
case => void;
|
||||
@ -150,8 +152,8 @@ export fn validate_board_name(board: str) (void | invalid_board) = {
|
||||
fn list_boards_in(output: io:: handle, directory: str) (void | error) = {
|
||||
let entries = os::readdir(directory)?;
|
||||
defer fs::dirents_free(entries);
|
||||
for (let entry .. entries) {
|
||||
fmt::fprintln(output, entry.name)?;
|
||||
for (let index = 0z; index < len(entries); index += 1) {
|
||||
fmt::fprintln(output, entries[index].name)?;
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user