diff --git a/Makefile b/Makefile index 95d7697c7..fbb484656 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ all: .config include/autoconf.h $(MAKE) -C bootblocks all $(MAKE) -C elkscmd all $(MAKE) -C image all -ifneq ($(shell uname), Darwin) +ifeq ($(shell uname), Linux) $(MAKE) -C elksemu PREFIX='$(TOPDIR)/cross' elksemu endif @@ -28,7 +28,7 @@ clean: $(MAKE) -C bootblocks clean $(MAKE) -C elkscmd clean $(MAKE) -C image clean -ifneq ($(shell uname), Darwin) +ifeq ($(shell uname), Linux) $(MAKE) -C elksemu clean endif @echo diff --git a/build.sh b/build.sh index 082724518..a1addc617 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This build script is called in main.yml by GitHub Continuous Integration # Full build (including the cross tool chain) diff --git a/clean.sh b/clean.sh index 38e3b194a..80b48b0d2 100755 --- a/clean.sh +++ b/clean.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Full clean (except the cross build chain) diff --git a/config/lxdialog/Makefile b/config/lxdialog/Makefile index 7f4f7c19f..1244e57e2 100644 --- a/config/lxdialog/Makefile +++ b/config/lxdialog/Makefile @@ -1,22 +1,25 @@ ######################################################################### # Where are the curses libraries? -ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) +ifeq ($(shell pkg-config --exists ncurses ; echo $$?), 0) + CURSES_INC := $(shell pkg-config --cflags-only-I ncurses) + CURSES_LOC := "" + CURSES_LIBS := $(shell pkg-config --libs ncurses) +else ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) CURSES_INC = -I/usr/include/ncurses CURSES_LOC = "" -else -ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) +else ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) CURSES_INC = -I/usr/include/ncurses CURSES_LOC = "" -else -ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) +else ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) CURSES_INC = CURSES_LOC = "" else CURSES_INC = CURSES_LOC = "" endif -endif +ifeq ($(CURSES_LIBS), ) + CURSES_LIBS = -lncurses endif ######################################################################### @@ -26,11 +29,7 @@ CC = gcc CFLAGS = -std=c99 -O2 -Wall -pedantic -DLOCALE $(CURSES_INC) LDFLAGS = -s -LDLIBS = $(shell pkg-config ncurses --libs) -ifeq ($(LDLIBS), ) - LDLIBS = -lncurses -endif -#LDLIBS = /usr/local/opt/ncurses/lib/libncurses.a +LDLIBS = $(CURSES_LIBS) ######################################################################### # What do we compile? @@ -61,8 +60,8 @@ $(PGM): $(OBJS) # Write a custom header for curses. local-curses.h: - @x=`find /lib/ /lib64/ /usr/lib/ /usr/lib64/ /usr/local/lib/ /usr/local/lib64/ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/ -maxdepth 2 -name 'libncurses.*'` ;\ - if [ ! "$$x" ]; then \ + @if ! pkg-config --exists ncurses && \ + ! find /lib/ /lib64/ /usr/lib/ /usr/lib64/ /usr/local/lib/ /usr/local/lib64/ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/ -maxdepth 2 -name 'libncurses.*' | grep . ; then \ echo -e "\007" ;\ echo ">> Unable to find the Ncurses libraries." ;\ echo ">>" ;\ diff --git a/config/lxdialog/checklist.c b/config/lxdialog/checklist.c index 345999195..c76e8e7b2 100644 --- a/config/lxdialog/checklist.c +++ b/config/lxdialog/checklist.c @@ -54,12 +54,12 @@ static void print_item(WINDOW * win, const char *item, int status, /* * Print the scroll indicators. */ -static void print_arrows(WINDOW * win, int choice, int item_no, int scroll, +static void print_arrows(WINDOW * win, int choice, int item_no, int nscroll, int y, int x, int height) { wmove(win, y, x); - if (scroll > 0) { + if (nscroll > 0) { wattrset(win, uarrow_attr); waddch(win, ACS_UARROW); waddstr(win, "(-)"); @@ -74,7 +74,7 @@ static void print_arrows(WINDOW * win, int choice, int item_no, int scroll, y = y + height + 1; wmove(win, y, x); - if ((height < item_no) && (scroll + choice < item_no - 1)) { + if ((height < item_no) && (nscroll + choice < item_no - 1)) { wattrset(win, darrow_attr); waddch(win, ACS_DARROW); waddstr(win, "(+)"); @@ -110,7 +110,7 @@ int dialog_checklist(const char *title, const char *prompt, int height, const char *const *items, int flag) { WINDOW *dialog, *list; - int *status, key = 0, button = 0, choice = 0, scroll = 0, max_choice; + int *status, key = 0, button = 0, choice = 0, nscroll = 0, max_choice; int i, x, y, box_x, box_y; checkflag = flag; @@ -181,19 +181,19 @@ int dialog_checklist(const char *title, const char *prompt, int height, item_x = check_x + 4; if (choice >= list_height) { - scroll = choice - list_height + 1; - choice -= scroll; + nscroll = choice - list_height + 1; + choice -= nscroll; } /* Print the list */ for (i = 0; i < max_choice; i++) { - print_item(list, items[(scroll + i) * 3 + 1], - status[i + scroll], i, i == choice); + print_item(list, items[(nscroll + i) * 3 + 1], + status[i + nscroll], i, i == choice); } wnoutrefresh(list); - print_arrows(dialog, choice, item_no, scroll, + print_arrows(dialog, choice, item_no, nscroll, box_y, box_x + check_x + 5, list_height); print_buttons(dialog, height, width, 0); @@ -202,7 +202,7 @@ int dialog_checklist(const char *title, const char *prompt, int height, key = wgetch(dialog); for (i = 0; i < max_choice; i++) - if (toupper(key) == toupper(items[(scroll + i) * 3 + 1][0])) + if (toupper(key) == toupper(items[(nscroll + i) * 3 + 1][0])) break; @@ -210,23 +210,23 @@ int dialog_checklist(const char *title, const char *prompt, int height, key == '+' || key == '-') { if (key == KEY_UP || key == '-') { if (!choice) { - if (!scroll) + if (!nscroll) continue; /* Scroll list down */ if (list_height > 1) { /* De-highlight current first item */ - print_item(list, items[scroll * 3 + 1], - status[scroll], 0, FALSE); + print_item(list, items[nscroll * 3 + 1], + status[nscroll], 0, FALSE); scrollok(list, TRUE); wscrl(list, -1); scrollok(list, FALSE); } - scroll--; - print_item(list, items[scroll * 3 + 1], - status[scroll], 0, TRUE); + nscroll--; + print_item(list, items[nscroll * 3 + 1], + status[nscroll], 0, TRUE); wnoutrefresh(list); - print_arrows(dialog, choice, item_no, scroll, + print_arrows(dialog, choice, item_no, nscroll, box_y, box_x + check_x + 5, list_height); wrefresh(dialog); @@ -236,26 +236,26 @@ int dialog_checklist(const char *title, const char *prompt, int height, i = choice - 1; } else if (key == KEY_DOWN || key == '+') { if (choice == max_choice - 1) { - if (scroll + choice >= item_no - 1) + if (nscroll + choice >= item_no - 1) continue; /* Scroll list up */ if (list_height > 1) { /* De-highlight current last item before scrolling up */ print_item(list, - items[(scroll + max_choice - 1) * 3 + 1], - status[scroll + max_choice - 1], + items[(nscroll + max_choice - 1) * 3 + 1], + status[nscroll + max_choice - 1], max_choice - 1, FALSE); scrollok(list, TRUE); scroll(list); scrollok(list, FALSE); } - scroll++; - print_item(list, items[(scroll + max_choice - 1) * 3 + 1], - status[scroll + max_choice - 1], + nscroll++; + print_item(list, items[(nscroll + max_choice - 1) * 3 + 1], + status[nscroll + max_choice - 1], max_choice - 1, TRUE); wnoutrefresh(list); - print_arrows(dialog, choice, item_no, scroll, + print_arrows(dialog, choice, item_no, nscroll, box_y, box_x + check_x + 5, list_height); wrefresh(dialog); @@ -266,12 +266,12 @@ int dialog_checklist(const char *title, const char *prompt, int height, } if (i != choice) { /* De-highlight current item */ - print_item(list, items[(scroll + choice) * 3 + 1], - status[scroll + choice], choice, FALSE); + print_item(list, items[(nscroll + choice) * 3 + 1], + status[nscroll + choice], choice, FALSE); /* Highlight new item */ choice = i; - print_item(list, items[(scroll + choice) * 3 + 1], - status[scroll + choice], choice, TRUE); + print_item(list, items[(nscroll + choice) * 3 + 1], + status[nscroll + choice], choice, TRUE); wnoutrefresh(list); wrefresh(dialog); } @@ -299,18 +299,18 @@ int dialog_checklist(const char *title, const char *prompt, int height, case '\n': if (!button) { if (flag == FLAG_CHECK) { - status[scroll + choice] = !status[scroll + choice]; + status[nscroll + choice] = !status[nscroll + choice]; wmove(list, choice, check_x); wattrset(list, check_selected_attr); - wprintw(list, "[%c]", status[scroll + choice] ? 'X' : ' '); + wprintw(list, "[%c]", status[nscroll + choice] ? 'X' : ' '); } else { - if (!status[scroll + choice]) { + if (!status[nscroll + choice]) { for (i = 0; i < item_no; i++) status[i] = 0; - status[scroll + choice] = 1; + status[nscroll + choice] = 1; for (i = 0; i < max_choice; i++) - print_item(list, items[(scroll + i) * 3 + 1], - status[scroll + i], i, i == choice); + print_item(list, items[(nscroll + i) * 3 + 1], + status[nscroll + i], i, i == choice); } } wnoutrefresh(list); diff --git a/config/lxdialog/inputbox.c b/config/lxdialog/inputbox.c index da42baf50..d6f08097c 100644 --- a/config/lxdialog/inputbox.c +++ b/config/lxdialog/inputbox.c @@ -46,7 +46,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, WINDOW *dialog; char *instr = dialog_input_result; int i, x, y, box_y, box_x, box_width; - int input_x = 0, scroll = 0, key = 0, button = -1; + int input_x = 0, nscroll = 0, key = 0, button = -1; /* center dialog box on screen */ x = (COLS - width) / 2; @@ -97,10 +97,10 @@ int dialog_inputbox(const char *title, const char *prompt, int height, input_x = strlen(instr); if (input_x >= box_width) { - scroll = input_x - box_width + 1; + nscroll = input_x - box_width + 1; input_x = box_width - 1; for (i = 0; i < box_width - 1; i++) - waddch(dialog, instr[scroll + i]); + waddch(dialog, instr[nscroll + i]); } else waddstr(dialog, instr); @@ -123,19 +123,19 @@ int dialog_inputbox(const char *title, const char *prompt, int height, continue; case KEY_BACKSPACE: case 127: - if (input_x || scroll) { + if (input_x || nscroll) { wattrset(dialog, inputbox_attr); if (!input_x) { - scroll = scroll < box_width - 1 ? - 0 : scroll - (box_width - 1); + nscroll = nscroll < box_width - 1 ? + 0 : nscroll - (box_width - 1); wmove(dialog, box_y, box_x); for (i = 0; i < box_width; i++) - waddch(dialog, instr[scroll + input_x + i] ? - instr[scroll + input_x + i] : ' '); - input_x = strlen(instr) - scroll; + waddch(dialog, instr[nscroll + input_x + i] ? + instr[nscroll + input_x + i] : ' '); + input_x = strlen(instr) - nscroll; } else input_x--; - instr[scroll + input_x] = '\0'; + instr[nscroll + input_x] = '\0'; mvwaddch(dialog, box_y, input_x + box_x, ' '); wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); @@ -143,15 +143,15 @@ int dialog_inputbox(const char *title, const char *prompt, int height, continue; default: if (key < 0x100 && isprint(key)) { - if (scroll + input_x < MAX_LEN) { + if (nscroll + input_x < MAX_LEN) { wattrset(dialog, inputbox_attr); - instr[scroll + input_x] = key; - instr[scroll + input_x + 1] = '\0'; + instr[nscroll + input_x] = key; + instr[nscroll + input_x + 1] = '\0'; if (input_x == box_width - 1) { - scroll++; + nscroll++; wmove(dialog, box_y, box_x); for (i = 0; i < box_width - 1; i++) - waddch(dialog, instr[scroll + i]); + waddch(dialog, instr[nscroll + i]); } else { wmove(dialog, box_y, input_x++ + box_x); waddch(dialog, key); diff --git a/config/lxdialog/menubox.c b/config/lxdialog/menubox.c index a6c6aa5b9..50f673911 100644 --- a/config/lxdialog/menubox.c +++ b/config/lxdialog/menubox.c @@ -82,7 +82,7 @@ static void print_item(WINDOW * win, const char *item, int choice, /* * Print the scroll indicators. */ -static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, +static void print_arrows(WINDOW * win, int item_no, int nscroll, int y, int x, int height) { int cur_y, cur_x; @@ -91,7 +91,7 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, wmove(win, y, x); - if (scroll > 0) { + if (nscroll > 0) { wattrset(win, uarrow_attr); waddch(win, ACS_UARROW); waddstr(win, "(-)"); @@ -106,7 +106,7 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, y = y + height + 1; wmove(win, y, x); - if ((height < item_no) && (scroll + height < item_no)) { + if ((height < item_no) && (nscroll + height < item_no)) { wattrset(win, darrow_attr); waddch(win, ACS_DARROW); waddstr(win, "(+)"); @@ -145,7 +145,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, { WINDOW *dialog, *menu; FILE *f; - int key = 0, button = 0, scroll = 0, choice = 0, first_item = 0; + int key = 0, button = 0, nscroll = 0, choice = 0, first_item = 0; int i, j, x, y, box_x, box_y, max_choice; max_choice = MIN(menu_height, item_no); @@ -205,11 +205,11 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, /* get the scroll info from the temp file */ if ((f = fopen("lxdialog.scrltmp", "r")) != NULL) { - if ((fscanf(f, "%d\n", &scroll) == 1) && (scroll <= choice) && - (scroll + max_choice > choice) && (scroll >= 0) && - (scroll + max_choice <= item_no)) { - first_item = scroll; - choice = choice - scroll; + if ((fscanf(f, "%d\n", &nscroll) == 1) && (nscroll <= choice) && + (nscroll + max_choice > choice) && (nscroll >= 0) && + (nscroll + max_choice <= item_no)) { + first_item = nscroll; + choice = choice - nscroll; fclose(f); } else { remove("lxdialog.scrltmp"); @@ -219,10 +219,10 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, } if ((choice >= max_choice) || (f == NULL && choice >= max_choice / 2)) { if (choice >= item_no - max_choice / 2) - scroll = first_item = item_no - max_choice; + nscroll = first_item = item_no - max_choice; else - scroll = first_item = choice - max_choice / 2; - choice = choice - scroll; + nscroll = first_item = choice - max_choice / 2; + choice = choice - nscroll; } /* Print the menu */ @@ -232,7 +232,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, wnoutrefresh(menu); - print_arrows(dialog, item_no, scroll, + print_arrows(dialog, item_no, nscroll, box_y, box_x + item_x + 1, menu_height); print_buttons(dialog, height, width, 0); @@ -247,14 +247,14 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, i = max_choice; else { for (i = choice + 1; i < max_choice; i++) { - j = first_alpha(items[(scroll + i) * 2 + 1], "YyNnMm"); - if (key == tolower(items[(scroll + i) * 2 + 1][j])) + j = first_alpha(items[(nscroll + i) * 2 + 1], "YyNnMm"); + if (key == tolower(items[(nscroll + i) * 2 + 1][j])) break; } if (i == max_choice) for (i = 0; i < max_choice; i++) { - j = first_alpha(items[(scroll + i) * 2 + 1], "YyNnMm"); - if (key == tolower(items[(scroll + i) * 2 + 1][j])) + j = first_alpha(items[(nscroll + i) * 2 + 1], "YyNnMm"); + if (key == tolower(items[(nscroll + i) * 2 + 1][j])) break; } } @@ -263,40 +263,40 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, key == KEY_UP || key == KEY_DOWN || key == '-' || key == '+' || key == KEY_PPAGE || key == KEY_NPAGE) { - print_item(menu, items[(scroll + choice) * 2 + 1], choice, FALSE, - (items[(scroll + choice) * 2][0] != ':')); + print_item(menu, items[(nscroll + choice) * 2 + 1], choice, FALSE, + (items[(nscroll + choice) * 2][0] != ':')); if (key == KEY_UP || key == '-') { - if (choice < 2 && scroll) { + if (choice < 2 && nscroll) { /* Scroll menu down */ scrollok(menu, TRUE); wscrl(menu, -1); scrollok(menu, FALSE); - scroll--; + nscroll--; - print_item(menu, items[scroll * 2 + 1], 0, FALSE, - (items[scroll * 2][0] != ':')); + print_item(menu, items[nscroll * 2 + 1], 0, FALSE, + (items[nscroll * 2][0] != ':')); } else choice = MAX(choice - 1, 0); } else if (key == KEY_DOWN || key == '+') { - print_item(menu, items[(scroll + choice) * 2 + 1], choice, - FALSE, (items[(scroll + choice) * 2][0] != ':')); + print_item(menu, items[(nscroll + choice) * 2 + 1], choice, + FALSE, (items[(nscroll + choice) * 2][0] != ':')); if ((choice > max_choice - 3) && - (scroll + max_choice < item_no)) { + (nscroll + max_choice < item_no)) { /* Scroll menu up */ scrollok(menu, TRUE); scroll(menu); scrollok(menu, FALSE); - scroll++; + nscroll++; - print_item(menu, items[(scroll + max_choice - 1) * 2 + 1], + print_item(menu, items[(nscroll + max_choice - 1) * 2 + 1], max_choice - 1, FALSE, - (items[(scroll + max_choice - 1) * 2][0] != + (items[(nscroll + max_choice - 1) * 2][0] != ':')); } else choice = MIN(choice + 1, max_choice - 1); @@ -304,11 +304,11 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, } else if (key == KEY_PPAGE) { scrollok(menu, TRUE); for (i = 0; (i < max_choice); i++) { - if (scroll > 0) { + if (nscroll > 0) { wscrl(menu, -1); - scroll--; - print_item(menu, items[scroll * 2 + 1], 0, FALSE, - (items[scroll * 2][0] != ':')); + nscroll--; + print_item(menu, items[nscroll * 2 + 1], 0, FALSE, + (items[nscroll * 2][0] != ':')); } else { if (choice > 0) choice--; @@ -318,15 +318,15 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, } else if (key == KEY_NPAGE) { for (i = 0; (i < max_choice); i++) { - if (scroll + max_choice < item_no) { + if (nscroll + max_choice < item_no) { scrollok(menu, TRUE); scroll(menu); scrollok(menu, FALSE); - scroll++; + nscroll++; print_item(menu, - items[(scroll + max_choice - 1) * 2 + 1], + items[(nscroll + max_choice - 1) * 2 + 1], max_choice - 1, FALSE, - (items[(scroll + max_choice - 1) * 2][0] != + (items[(nscroll + max_choice - 1) * 2][0] != ':')); } else { if (choice + 1 < max_choice) @@ -337,10 +337,10 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, } else choice = i; - print_item(menu, items[(scroll + choice) * 2 + 1], choice, TRUE, - (items[(scroll + choice) * 2][0] != ':')); + print_item(menu, items[(nscroll + choice) * 2 + 1], choice, TRUE, + (items[(nscroll + choice) * 2][0] != ':')); - print_arrows(dialog, item_no, scroll, + print_arrows(dialog, item_no, nscroll, box_y, box_x + item_x + 1, menu_height); wnoutrefresh(menu); @@ -366,11 +366,11 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, case 'm': /* save scroll info */ if ((f = fopen("lxdialog.scrltmp", "w")) != NULL) { - fprintf(f, "%d\n", scroll); + fprintf(f, "%d\n", nscroll); fclose(f); } delwin(dialog); - fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); + fprintf(stderr, "%s\n", items[(nscroll + choice) * 2]); switch (key) { case 's': return 3; @@ -391,11 +391,11 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, delwin(dialog); if (button == 2) fprintf(stderr, "%s \"%s\"\n", - items[(scroll + choice) * 2], - items[(scroll + choice) * 2 + 1] + - first_alpha(items[(scroll + choice) * 2 + 1], "")); + items[(nscroll + choice) * 2], + items[(nscroll + choice) * 2 + 1] + + first_alpha(items[(nscroll + choice) * 2 + 1], "")); else - fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); + fprintf(stderr, "%s\n", items[(nscroll + choice) * 2]); remove("lxdialog.scrltmp"); return button; diff --git a/elks/arch/i86/tools/build.c b/elks/arch/i86/tools/build.c index c03d0a33a..c79abf52a 100644 --- a/elks/arch/i86/tools/build.c +++ b/elks/arch/i86/tools/build.c @@ -23,8 +23,8 @@ #include /* fprintf */ -#if !defined(__APPLE__) -#include /* We NEED these macros */ +#ifdef __linux__ +#include /* for major/minor macros */ #endif #include #include /* unistd.h needs this */ diff --git a/elks/tools/mfs/genfs.c b/elks/tools/mfs/genfs.c index cd9887a75..e27a4b5a9 100644 --- a/elks/tools/mfs/genfs.c +++ b/elks/tools/mfs/genfs.c @@ -19,6 +19,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#if __linux__ +#include +#endif #include #include #include @@ -31,12 +34,6 @@ #include "minix_fs.h" #include "protos.h" -#if __APPLE__ -#define MAJOR_SHIFT 24 /* OSX: right shift dev_t to get major device # */ -#else -#define MAJOR_SHIFT 8 -#endif - typedef unsigned short u16_t; typedef unsigned long u32_t; @@ -407,22 +404,22 @@ compile_fs(struct minix_fs_dat *fs) cmd_cp(fs, 3, av); } else if (flags == S_IFCHR) { if (opt_verbose) printf("mknod %s c %d %d\n", prefix+inode_build->path, - inode_build->dev >> MAJOR_SHIFT, inode_build->dev & 0xff); + major(inode_build->dev), minor(inode_build->dev)); av[0] = "mknod"; av[1] = prefix+inode_build->path; av[2] = "c"; - av[3] = major; sprintf(major, "%d", inode_build->dev >> MAJOR_SHIFT); - av[4] = minor; sprintf(minor, "%d", inode_build->dev & 0xff); + av[3] = major; sprintf(major, "%d", major(inode_build->dev)); + av[4] = minor; sprintf(minor, "%d", minor(inode_build->dev)); av[5] = 0; cmd_mknode(fs, 5, av); } else if (flags == S_IFBLK) { if (opt_verbose) printf("mknod %s b %d %d\n", prefix+inode_build->path, - inode_build->dev >> MAJOR_SHIFT, inode_build->dev & 0xff); + major(inode_build->dev), minor(inode_build->dev)); av[0] = "mknod"; av[1] = prefix+inode_build->path; av[2] = "b"; - av[3] = major; sprintf(major, "%d", inode_build->dev >> MAJOR_SHIFT); - av[4] = minor; sprintf(minor, "%d", inode_build->dev & 0xff); + av[3] = major; sprintf(major, "%d", major(inode_build->dev)); + av[4] = minor; sprintf(minor, "%d", minor(inode_build->dev)); av[5] = 0; cmd_mknode(fs, 5, av); } else if (flags == S_IFLNK) { diff --git a/elkscmd/build_hd_image.sh b/elkscmd/build_hd_image.sh index 3e7498c2c..441e5f850 100755 --- a/elkscmd/build_hd_image.sh +++ b/elkscmd/build_hd_image.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # BROKEN SCRIPT # DEV86 is no more linked to this project diff --git a/emu86.sh b/emu86.sh index 5226a420e..ef06ce12e 100755 --- a/emu86.sh +++ b/emu86.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Run ELKS in EMU86 (basic IA16 emulator) # EMU86 is part of the cross tools diff --git a/env.sh b/env.sh index db9ba1c7b..aed953453 100755 --- a/env.sh +++ b/env.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Set up the build environment diff --git a/image/ver.pl b/image/ver.pl index 2fe0b899e..c4ae41291 100755 --- a/image/ver.pl +++ b/image/ver.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl #Get the version from the kernel makefile while (<>) { diff --git a/tools/build.sh b/tools/build.sh index 184a91c9c..1b97c9343 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Build the cross tools for the IA16 target diff --git a/tools/prune.sh b/tools/prune.sh index 8e832216c..f7f99a8ee 100755 --- a/tools/prune.sh +++ b/tools/prune.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Prune the cross tools to save disk space