int prev;
prev = disable_ctrlc(1);
- for (i = 0; i < cd_count[file]; i++) {
- dev = console_devices[file][i];
+ for_each_console_dev(i, file, dev) {
if (dev->tstc != NULL) {
ret = dev->tstc(dev);
if (ret > 0) {
int i;
struct stdio_dev *dev;
- for (i = 0; i < cd_count[file]; i++) {
- dev = console_devices[file][i];
+ for_each_console_dev(i, file, dev) {
if (dev->putc != NULL)
dev->putc(dev, c);
}
int i;
struct stdio_dev *dev;
- for (i = 0; i < cd_count[file]; i++) {
- bool is_serial;
+ for_each_console_dev(i, file, dev) {
+ bool is_serial = console_dev_is_serial(dev);
- dev = console_devices[file][i];
- is_serial = console_dev_is_serial(dev);
if (dev->puts && serial_only == is_serial)
dev->puts(dev, s);
}
int i;
struct stdio_dev *dev;
- for (i = 0; i < cd_count[file]; i++) {
- dev = console_devices[file][i];
+ for_each_console_dev(i, file, dev) {
if (dev->puts != NULL)
dev->puts(dev, s);
}
int i;
struct stdio_dev *dev;
- for (i = 0; i < cd_count[console]; i++) {
- dev = console_devices[console][i];
+ for_each_console_dev(i, console, dev)
printf("%s ", dev->name);
- }
printf("\n");
}
*/
extern int cd_count[MAX_FILES];
+#define for_each_console_dev(i, file, dev) \
+ for (i = 0, dev = console_devices[file][i]; \
+ i < cd_count[file]; \
+ i++, dev = console_devices[file][i])
+
int iomux_match_device(struct stdio_dev **, const int, struct stdio_dev *);
int iomux_doenv(const int, const char *);
void iomux_printdevs(const int);