Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package growlight for openSUSE:Factory checked in at 2022-12-19 14:08:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/growlight (Old) and /work/SRC/openSUSE:Factory/.growlight.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "growlight" Mon Dec 19 14:08:01 2022 rev:16 rq:1043666 version:1.2.38 Changes: -------- --- /work/SRC/openSUSE:Factory/growlight/growlight.changes 2021-11-18 10:34:48.331961670 +0100 +++ /work/SRC/openSUSE:Factory/.growlight.new.1835/growlight.changes 2022-12-19 14:08:03.622600986 +0100 @@ -1,0 +2,8 @@ +Sun Dec 18 19:10:50 UTC 2022 - Dirk Müller <dmuel...@suse.com> + +- update to 1.2.38: + * don't print misleading diagnostic when exiting with failure + * growlight: ignore NCTYPE_RELEASE + * adapting notcurses + +------------------------------------------------------------------- Old: ---- growlight-1.2.37.tar.gz New: ---- growlight-1.2.38.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ growlight.spec ++++++ --- /var/tmp/diff_new_pack.bRBEDl/_old 2022-12-19 14:08:04.130603618 +0100 +++ /var/tmp/diff_new_pack.bRBEDl/_new 2022-12-19 14:08:04.134603638 +0100 @@ -1,7 +1,7 @@ # # spec file for package growlight # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2020-2021, Martin Hauke <mar...@gmx.de> # # All modifications and additions to the file contributed by third parties @@ -23,7 +23,7 @@ %bcond_without pandoc %endif Name: growlight -Version: 1.2.37 +Version: 1.2.38 Release: 0 Summary: Disk manipulation and system setup tool License: GPL-3.0-or-later ++++++ growlight-1.2.37.tar.gz -> growlight-1.2.38.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/.drone.yml new/growlight-1.2.38/.drone.yml --- old/growlight-1.2.37/.drone.yml 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/.drone.yml 2021-12-04 21:03:38.000000000 +0100 @@ -5,7 +5,7 @@ steps: - name: debian-build - image: dankamongmen/unstable_builder:2021-10-08a + image: dankamongmen/unstable_builder:2021-11-14a commands: - export LANG=en_US.UTF-8 - mkdir build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/CMakeLists.txt new/growlight-1.2.38/CMakeLists.txt --- old/growlight-1.2.37/CMakeLists.txt 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/CMakeLists.txt 2021-12-04 21:03:38.000000000 +0100 @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(growlight VERSION 1.2.37 +project(growlight VERSION 1.2.38 DESCRIPTION "Block device and filesystem manager" HOMEPAGE_URL "https://nick-black.com/dankwiki/index.php/Growlight" LANGUAGES C CXX) @@ -34,7 +34,7 @@ find_package(PkgConfig REQUIRED) find_package(Threads) set_package_properties(Threads PROPERTIES TYPE REQUIRED) -find_package(Notcurses 2.4.4 CONFIG) +find_package(Notcurses 3.0.0 CONFIG) set_package_properties(Notcurses PROPERTIES TYPE REQUIRED) pkg_check_modules(LIBATASMART REQUIRED libatasmart>=0.19) pkg_check_modules(LIBBLKID REQUIRED blkid>=2.20.1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/README.md new/growlight-1.2.38/README.md --- old/growlight-1.2.37/README.md 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/README.md 2021-12-04 21:03:38.000000000 +0100 @@ -22,7 +22,7 @@ - libcryptsetup 2.1.5+ - libdevmapper 1.02.74+ - libnettle 3.5.1+ - - libnotcurses 2.4.4+ + - libnotcurses 3.0.0+ - libpci 3.1.9+ - libpciaccess 0.13.1+ - libudev 175+ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/doc/man/man8/growlight-readline.8.md new/growlight-1.2.38/doc/man/man8/growlight-readline.8.md --- old/growlight-1.2.37/doc/man/man8/growlight-readline.8.md 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/doc/man/man8/growlight-readline.8.md 2021-12-04 21:03:38.000000000 +0100 @@ -1,6 +1,6 @@ % growlight-readline(8) % nick black <nickbl...@linux.com> -% v1.2.37 +% v1.2.38 # NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/doc/man/man8/growlight.8.md new/growlight-1.2.38/doc/man/man8/growlight.8.md --- old/growlight-1.2.37/doc/man/man8/growlight.8.md 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/doc/man/man8/growlight.8.md 2021-12-04 21:03:38.000000000 +0100 @@ -1,6 +1,6 @@ % growlight(8) % nick black <nickbl...@linux.com> -% v1.2.37 +% v1.2.38 # NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/src/growlight.c new/growlight-1.2.38/src/growlight.c --- old/growlight-1.2.37/src/growlight.c 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/src/growlight.c 2021-12-04 21:03:38.000000000 +0100 @@ -2104,11 +2104,13 @@ return 0; err: - growlight_stop(); + growlight_stop(-1); return -1; } -int growlight_stop(void){ +// if calling this on some error path, pass in your non-zero retcode, so that +// the closing diagnostic doesn't suggest success when we've already failed. +int growlight_stop(int retcode){ int r = 0; diag("Killing the event thread...\n"); @@ -2132,11 +2134,11 @@ return -1; } } - diag("Returning %d...\n", r); - if(r){ - return -1; + if(retcode){ + r = retcode; } - return 0; + diag("Returning %d...\n", r); + return r; } int rescan_controller(controller *c){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/src/growlight.h new/growlight-1.2.38/src/growlight.h --- old/growlight-1.2.37/src/growlight.h 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/src/growlight.h 2021-12-04 21:03:38.000000000 +0100 @@ -65,7 +65,7 @@ const glightui *get_glightui(void); int growlight_init(int,char * const *,const glightui *,int *); -int growlight_stop(void); +int growlight_stop(int retcode); struct device; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/src/notcurses/notcurses.c new/growlight-1.2.38/src/notcurses/notcurses.c --- old/growlight-1.2.37/src/notcurses/notcurses.c 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/src/notcurses/notcurses.c 2021-12-04 21:03:38.000000000 +0100 @@ -178,12 +178,12 @@ // idx == scrollidx -> display at top // idx == scrollidx + ysize - 4 -> display at bottom // - int idx; // selection index - int scrolloff; // scroll offset + unsigned idx; // selection index + unsigned scrolloff; // scroll offset struct form_option *ops;// form_option array for *this instance* - int opcount; // total number of ops - int selectno; // number of selections, total - int selections; // number of active selections + unsigned opcount; // total number of ops + unsigned selectno; // number of selections, total + unsigned selections; // number of active selections char** selarray; // array of selections by name }; struct form_input inp; // form_input state for this instance @@ -616,7 +616,7 @@ static int bevel_all(struct ncplane* nc){ - int rows, cols; + unsigned rows, cols; ncplane_dim_yx(nc, &rows, &cols); return bevel(nc, rows, cols, true, true); } @@ -626,7 +626,7 @@ if(ncplane_cursor_move_yx(nc, y, x)){ return -1; } - nccell c = CELL_TRIVIAL_INITIALIZER; + nccell c = NCCELL_TRIVIAL_INITIALIZER; if(nccell_load(nc, &c, ch) < 0){ return -1; } @@ -667,7 +667,7 @@ static void draw_main_window(struct ncplane* n){ - int rows, cols, x, y; + unsigned rows, cols, x, y; char buf[BUFSIZ]; ncplane_set_bg_rgb8(n, 0xa0, 0xa0, 0xa0); @@ -677,7 +677,6 @@ compat_set_fg(n, HEADER_COLOR); ncplane_putstr_yx(n, rows - 1, 0, buf); ncplane_cursor_yx(n, &y, &x); - assert(x >= 0); cols -= x + 1; ncplane_on_styles(n, NCSTYLE_BOLD); compat_set_fg(n, STATUS_COLOR); @@ -767,7 +766,7 @@ if(ps->hstr){ ncplane_putstr_yx(n, 0, START_COL * 2, ps->hstr); } - int rows, cols; + unsigned rows, cols; ncplane_dim_yx(ps->n, &rows, &cols); if(ps->bstr){ const int crightlen = ps->bstr ? strlen(ps->bstr) : 0; @@ -783,8 +782,8 @@ new_display_panel(struct ncplane* nc, struct panel_state* ps, int rows, int cols, const char* hstr, const char* bstr, int borderpair){ - int ybelow, yabove; - int x, y; + unsigned ybelow, yabove; + unsigned x, y; // Desired space above and below, which will be impugned upon as needed ybelow = 3; @@ -832,7 +831,7 @@ // Print the contents of the block device in a horizontal bar of arbitrary size static void print_blockbar(struct ncplane* n, const blockobj* bo, int y, int sx, int ex, int selected){ - char pre[BPREFIXSTRLEN + 1]; + char pre[NCBPREFIXSTRLEN + 1]; const char *selstr = NULL; wchar_t wbuf[ex - sx + 2]; const int wchars = sizeof(wbuf) / sizeof(*wbuf); @@ -856,7 +855,7 @@ ncplane_set_styles(n, NCSTYLE_BOLD); compat_set_fg(n, co); - qprefix(zs, 1, pre, 1); + ncqprefix(zs, 1, pre, 1); if(!d->mnt.count || swprintf(wbuf, wchars, L" %s%s%ls%s%ls%s%s%sat %s ", d->label ? "" : "nameless ", d->mnttype, @@ -898,7 +897,7 @@ compat_set_fg(n, EMPTY_COLOR); selstr = d->layout == LAYOUT_NONE ? "unpartitioned space" : "unpartitionable space"; - snprintf(buf, sizeof(buf), " %s %s ", qprefix(d->size, 1, pre, 1), selstr) < (int)sizeof(buf); + snprintf(buf, sizeof(buf), " %s %s ", ncqprefix(d->size, 1, pre, 1), selstr) < (int)sizeof(buf); cmvwhline(n, y, sx, "â¾", ex - sx + 1); ncplane_putwstr_yx(n, y, sx, L" "); ncplane_putstr_yx(n, y, sx + (ex - sx + 1 - strlen(buf)) / 2, buf); @@ -920,7 +919,7 @@ ncplane_set_styles(n, NCSTYLE_NONE); wbuf[0] = L'\0'; zs = (z->lsector - z->fsector + 1) * bo->d->logsec; - qprefix(zs, 1, pre, 1); + ncqprefix(zs, 1, pre, 1); if(z->p == NULL){ // unused space among partitions, or metadata int co = (z->rep == REP_METADATA ? METADATA_COLOR : EMPTY_COLOR); const char *repstr = z->rep == REP_METADATA ? @@ -1048,7 +1047,7 @@ static int print_dev(struct ncplane* n, const adapterstate* as, const blockobj* bo, int line, int rows, unsigned cols, bool drawfromtop){ - char buf[BPREFIXSTRLEN + 1]; + char buf[NCBPREFIXSTRLEN + 1]; char rolestr[12]; // taken from %-11.11s below int co, rx; @@ -1109,12 +1108,12 @@ ncplane_on_styles(n, NCSTYLE_BOLD); ncplane_set_channels(n, ncchannels_reverse(origchannels)); } - qprefix(bo->d->size, 1, buf, 0); + ncqprefix(bo->d->size, 1, buf, 0); cmvwprintw(n, line, 1, "%11.11s %-16.16s %4.4s %*s %4uB %-6.6s%-16.16s %4.4s %-*.*s", bo->d->name, bo->d->model ? bo->d->model : "n/a", bo->d->revision ? bo->d->revision : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), bo->d->physsec, bo->d->blkdev.pttable ? bo->d->blkdev.pttable : "none", bo->d->blkdev.wwn ? bo->d->blkdev.wwn : "n/a", @@ -1146,12 +1145,12 @@ ncplane_on_styles(n, NCSTYLE_BOLD); ncplane_set_channels(n, ncchannels_reverse(origchannels)); } - qprefix(bo->d->size, 1, buf, 0); + ncqprefix(bo->d->size, 1, buf, 0); cmvwprintw(n, line, 1, "%11.11s %-16.16s %4.4s %*s %4uB %-6.6s%-16.16s %4.4s %-*.*s", bo->d->name, bo->d->model ? bo->d->model : "n/a", bo->d->revision ? bo->d->revision : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), bo->d->physsec, bo->d->mddev.pttable ? bo->d->mddev.pttable : "none", bo->d->mddev.mdname ? bo->d->mddev.mdname : "n/a", @@ -1177,12 +1176,12 @@ ncplane_on_styles(n, NCSTYLE_BOLD); ncplane_set_channels(n, ncchannels_reverse(origchannels)); } - qprefix(bo->d->size, 1, buf, 0); + ncqprefix(bo->d->size, 1, buf, 0); cmvwprintw(n, line, 1, "%11.11s %-16.16s %4.4s %*s %4uB %-6.6s%-16.16s %4.4s %-*.*s", bo->d->name, bo->d->model ? bo->d->model : "n/a", bo->d->revision ? bo->d->revision : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), bo->d->physsec, bo->d->dmdev.pttable ? bo->d->dmdev.pttable : "none", bo->d->dmdev.dmname ? bo->d->dmdev.dmname : "n/a", @@ -1209,12 +1208,12 @@ ncplane_on_styles(n, NCSTYLE_BOLD); ncplane_set_channels(n, ncchannels_reverse(origchannels)); } - qprefix(bo->d->size, 1, buf, 0); + ncqprefix(bo->d->size, 1, buf, 0); cmvwprintw(n, line, 1, "%11.11s %-16.16s %4ju %*s %4uB %-6.6s%-16.16s %4.4s %-*.*s", bo->d->name, bo->d->model ? bo->d->model : "n/a", (uintmax_t)bo->d->zpool.zpoolver, - PREFIXFMT(buf), + NCPREFIXFMT(buf), bo->d->physsec, "spa", "n/a", // FIXME @@ -1320,8 +1319,8 @@ // FIXME 'i' shows up only when there are fewer than 3 sigfigs // to the left of the decimal point...very annoying if(io){ - char qbuf[BPREFIXSTRLEN + 1]; - bprefix(io, 1, qbuf, 1); + char qbuf[NCBPREFIXSTRLEN + 1]; + ncbprefix(io, 1, qbuf, 1); cmvwprintw(n, sumline, -1, "%7.7s", qbuf); // might chop off 'i' }else{ cmvwprintw(n, sumline, -1, " no i/o"); @@ -1380,7 +1379,8 @@ adapter_box(const adapterstate* as, struct ncplane* nc, bool drawtop, bool drawbot, int rows){ int current = as == get_current_adapter(); - int bcolor, hcolor, cols; + int bcolor, hcolor; + unsigned cols; int attrs; ncplane_dim_yx(nc, NULL, &cols); @@ -1414,21 +1414,21 @@ cwprintw(nc, " [%d]", as->c->numa_node); } if(as->c->bandwidth){ - char buf[PREFIXSTRLEN + 1], dbuf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1], dbuf[NCPREFIXSTRLEN + 1]; if(as->c->demand){ cwprintw(nc, " (%sbps to chip, %sbps (%ju%%) demanded)", - qprefix(as->c->bandwidth, 1, buf, 1), - qprefix(as->c->demand, 1, dbuf, 1), + ncqprefix(as->c->bandwidth, 1, buf, 1), + ncqprefix(as->c->demand, 1, dbuf, 1), as->c->demand * 100 / as->c->bandwidth); }else{ cwprintw(nc, " (%sbps to chip)", - qprefix(as->c->bandwidth, 1, buf, 1)); + ncqprefix(as->c->bandwidth, 1, buf, 1)); } }else if(as->c->bus != BUS_VIRTUAL && as->c->demand){ - char dbuf[PREFIXSTRLEN + 1]; + char dbuf[NCPREFIXSTRLEN + 1]; - cwprintw(nc, " (%sbps demanded)", qprefix(as->c->demand, 1, dbuf, 1)); + cwprintw(nc, " (%sbps demanded)", ncqprefix(as->c->demand, 1, dbuf, 1)); } compat_set_fg(nc, bcolor); cwprintw(nc, "]"); @@ -1475,8 +1475,9 @@ int p; // First, print the selected device (if there is one), and those above - int rows, cols; - ncplane_dim_yx(n, &rows, &cols); + unsigned urows, cols; + ncplane_dim_yx(n, &urows, &cols); + int rows = urows; --rows; cur = as->selected; line = as->selline; @@ -1574,7 +1575,7 @@ free(ps); return NULL; } - int cols; + unsigned cols; ncplane_dim_yx(ps->n, NULL, &cols); ncplane_set_styles(ps->n, NCSTYLE_BOLD); compat_set_fg(ps->n, SPLASHTEXT_COLOR); @@ -1624,8 +1625,6 @@ static void destroy_form_locked(struct form_state* fs){ if(fs){ - int z; - assert(fs == actform); ncplane_destroy(fs->p); fs->p = NULL; @@ -1636,7 +1635,7 @@ case FORM_SELECT: case FORM_MULTISELECT: case FORM_CHECKBOXEN: - for(z = 0 ; z < fs->opcount ; ++z){ + for(unsigned z = 0 ; z < fs->opcount ; ++z){ free(fs->ops[z].option); free(fs->ops[z].desc); } @@ -1673,7 +1672,8 @@ multiform_options(struct form_state *fs){ const struct form_option *opstrs = fs->ops; struct ncplane* fsw = fs->p; - int z, cols, selidx, maxz; + unsigned cols, selidx; + unsigned maxz; assert(fs->formtype == FORM_MULTISELECT); ncplane_dim_yx(fsw, &maxz, &cols); @@ -1682,8 +1682,8 @@ ncplane_putwstr_yx(fsw, 1, 1, L"â"); ncplane_putwstr_yx(fsw, 1, fs->longop + 4, L"â®"); maxz -= 3; - for(z = 1 ; z < maxz ; ++z){ - int op = ((z - 1) + fs->scrolloff) % fs->opcount; + for(unsigned z = 1 ; z < maxz ; ++z){ + unsigned op = ((z - 1) + fs->scrolloff) % fs->opcount; assert(op >= 0); assert(op < fs->opcount); @@ -1717,7 +1717,7 @@ } compat_set_fg(fsw, FORMBORDER_COLOR); ncplane_on_styles(fsw, NCSTYLE_BOLD); - for(z = 0 ; z < fs->selections ; ++z){ + for(unsigned z = 0 ; z < fs->selections ; ++z){ ncplane_putstr_yx(fsw, z >= fs->selectno ? 3 + z : 2 + z, 4, fs->selarray[z]); } ncplane_putwstr_yx(fsw, fs->selectno + 2, 1, L"â°"); @@ -1727,15 +1727,16 @@ static void check_options(struct form_state *fs){ const struct form_option *opstrs = fs->ops; - int z, cols, selidx, maxz; + unsigned cols, selidx; + unsigned maxz; assert(fs->formtype == FORM_CHECKBOXEN); ncplane_dim_yx(fs->p, &maxz, &cols); maxz -= 3; compat_set_fg(fs->p, FORMBORDER_COLOR); ncplane_on_styles(fs->p, NCSTYLE_BOLD); - for(z = 1 ; z < maxz ; ++z){ - int op = ((z - 1) + fs->scrolloff) % fs->opcount; + for(unsigned z = 1 ; z < maxz ; ++z){ + unsigned op = ((z - 1) + fs->scrolloff) % fs->opcount; assert(op >= 0); assert(op < fs->opcount); @@ -1771,15 +1772,15 @@ static void form_options(struct form_state *fs){ const struct form_option *opstrs = fs->ops; - int z, cols, rows; + unsigned cols, rows; if(fs->formtype != FORM_SELECT){ return; } ncplane_dim_yx(fs->p, &rows, &cols); ncplane_on_styles(fs->p, NCSTYLE_BOLD); - for(z = 1 ; z < rows - 3 ; ++z){ - int op = ((z - 1) + fs->scrolloff) % fs->opcount; + for(unsigned z = 1 ; z < rows - 3 ; ++z){ + unsigned op = ((z - 1) + fs->scrolloff) % fs->opcount; assert(op >= 0); assert(op < fs->opcount); @@ -1801,7 +1802,7 @@ static struct panel_state * raise_form_explication(struct ncplane* n, const char* text, int linesz){ - int cols, x, y, brk, tot; + unsigned cols, x, y, brk, tot; int linepre[linesz - 1]; int linelen[linesz - 1]; struct panel_state *ps; @@ -1846,7 +1847,7 @@ assert(!text[tot]); ps = malloc(sizeof(*ps)); assert(ps); - int ncols; + unsigned ncols; ncplane_dim_yx(n, NULL, &ncols); struct ncplane_options nopts = { .y = linesz - (y + 2), @@ -1868,13 +1869,13 @@ } void raise_multiform(const char *str, void (*fxn)(const char *, char **, int, int), - struct form_option *opstrs, int ops, int defidx, - int selectno, char **selarray, int selections, const char *text, + struct form_option *opstrs, unsigned ops, int defidx, + unsigned selectno, char **selarray, int selections, const char *text, int scrollidx){ size_t longop, longdesc; struct form_state *fs; - int cols, rows; - int x, y; + unsigned cols, rows; + unsigned x, y; assert(ops); assert(opstrs); @@ -1893,7 +1894,7 @@ } cols = longdesc + longop * 2 + 9; #define ESCSTR L"'C' confirms setup, âesc returns" - if(cols < (int)wcslen(ESCSTR) + 2){ + if(cols < wcslen(ESCSTR) + 2){ cols = wcslen(ESCSTR) + 2; } rows = (ops > selectno ? ops : selectno) + 4; @@ -1926,9 +1927,10 @@ } cwbkgd(fs->p); // FIXME adapt for scrolling (default might be off-window at beginning) - if((fs->idx = defidx) < 0){ - fs->idx = defidx = 0; + if(defidx < 0){ + defidx = 0; } + fs->idx = defidx; fs->opcount = ops; fs->selarray = selarray; fs->selections = selections; @@ -1953,13 +1955,13 @@ // A collection of checkboxes static void raise_checkform(const char* str, void (*fxn)(const char*, char**, int, int), - struct form_option* opstrs, int ops, int defidx, + struct form_option* opstrs, unsigned ops, int defidx, char** selarray, int selections, const char* text, int scrollidx){ size_t longop, longdesc; struct form_state* fs; - int cols, rows; - int x, y; + unsigned cols, rows; + unsigned x, y; assert(ops); assert(opstrs); @@ -1978,7 +1980,7 @@ } cols = longdesc + longop + 7; #define ESCSTR L"'C' commits, âesc returns" - if(cols < (int)wcslen(ESCSTR) + 2){ + if(cols < wcslen(ESCSTR) + 2){ cols = wcslen(ESCSTR) + 2; } rows = ops + 4; @@ -2013,9 +2015,10 @@ struct ncplane* fsw = fs->p; cwbkgd(fsw); // FIXME adapt for scrolling (default might be off-window at beginning) - if((fs->idx = defidx) < 0){ - fs->idx = defidx = 0; + if(defidx < 0){ + defidx = 0; } + fs->idx = defidx; fs->opcount = ops; fs->selarray = selarray; fs->selections = selections; @@ -2024,7 +2027,7 @@ bevel_all(fsw); ncplane_on_styles(fsw, NCSTYLE_BOLD); cmvwprintw(fsw, 0, cols - strlen(fs->boxstr) - 2, "%s", fs->boxstr); - int nrows; + unsigned nrows; ncplane_dim_yx(fsw, &nrows, NULL); ncplane_putwstr_yx(fsw, nrows - 1, cols - wcslen(ESCSTR) - 1, ESCSTR); #undef ESCSTR @@ -2041,12 +2044,12 @@ // - select type form, for single choice from among a set // ------------------------------------------------------------------------- void raise_form(const char* str, void (*fxn)(const char*), - struct form_option* opstrs, int ops, int defidx, + struct form_option* opstrs, unsigned ops, int defidx, const char* text){ size_t longop, longdesc; struct form_state *fs; - int cols, rows; - int x, y; + unsigned cols, rows; + unsigned x, y; if(opstrs == NULL || !ops){ locked_diag("Passed empty %u-option string table", ops); @@ -2096,9 +2099,10 @@ } cwbkgd(fs->p); // FIXME adapt for scrolling (default might be off-window at beginning) - if((fs->idx = defidx) < 0){ - fs->idx = defidx = 0; + if(defidx < 0){ + defidx = 0; } + fs->idx = defidx; fs->opcount = ops; ncplane_off_styles(fs->p, NCSTYLE_BOLD); compat_set_fg(fs->p, FORMBORDER_COLOR); @@ -2121,7 +2125,7 @@ static void form_string_options(struct form_state* fs){ struct ncplane* n = fs->p; - int cols; + unsigned cols; if(fs->formtype != FORM_STRING_INPUT){ return; @@ -2140,7 +2144,7 @@ const char* def, const char* text){ struct form_state* fs; int cols; - int x, y; + unsigned x, y; assert(str && fxn); if(actform){ @@ -3047,12 +3051,12 @@ static void detail_fs(struct ncplane* hw, const device* d, int row){ if(d->mnttype){ - char buf[BPREFIXSTRLEN + 1]; + char buf[NCBPREFIXSTRLEN + 1]; ncplane_off_styles(hw, NCSTYLE_BOLD); - const char *size = d->mntsize ? bprefix(d->mntsize, 1, buf, 1) : ""; + const char *size = d->mntsize ? ncbprefix(d->mntsize, 1, buf, 1) : ""; cmvwprintw(hw, row, START_COL, "%*s%c ", - BPREFIXFMT(size), d->mntsize ? 'B' : ' '); + NCBPREFIXFMT(size), d->mntsize ? 'B' : ' '); ncplane_on_styles(hw, NCSTYLE_BOLD); cwprintw(hw, "%s%s", d->label ? "" : "unlabeled ", d->mnttype); if(d->label){ @@ -3072,8 +3076,8 @@ static int update_details(struct ncplane* hw){ const controller* c = get_current_controller(); - char buf[BPREFIXSTRLEN + 1]; - int cols, rows, curcol, n; + char buf[NCBPREFIXSTRLEN + 1]; + unsigned cols, rows, curcol; const char* pttype; const blockobj* b; const device* d; @@ -3089,7 +3093,7 @@ if(rows == 0){ return 0; } - for(n = 1 ; n < rows - 1 ; ++n){ + for(unsigned n = 1 ; n < rows - 1 ; ++n){ cmvwhline(hw, n, START_COL, " ", cols - 2); } ncplane_set_styles(hw, NCSTYLE_BOLD); @@ -3110,7 +3114,7 @@ ncplane_putstr(hw, c->biosver ? c->biosver : "Unknown"); ncplane_on_styles(hw, NCSTYLE_BOLD); ncplane_putstr(hw, " Load: "); - qprefix(c->demand, 1, buf, 1); + ncqprefix(c->demand, 1, buf, 1); ncplane_off_styles(hw, NCSTYLE_BOLD); ncplane_putstr(hw, buf); ncplane_putstr(hw, "bps"); @@ -3129,7 +3133,7 @@ ncplane_putstr(hw, d->model ? d->model : "n/a"); ncplane_putstr(hw, d->revision ? d->revision : ""); ncplane_on_styles(hw, NCSTYLE_BOLD); - cwprintw(hw, " (%sB) S/N: ", bprefix(d->size, 1, buf, 1)); + cwprintw(hw, " (%sB) S/N: ", ncbprefix(d->size, 1, buf, 1)); ncplane_off_styles(hw, NCSTYLE_BOLD); ncplane_putstr(hw, sn ? sn : "n/a"); ncplane_on_styles(hw, NCSTYLE_BOLD); @@ -3158,7 +3162,7 @@ cwprintw(hw, " ("); ncplane_off_styles(hw, NCSTYLE_BOLD); // FIXME throws -Wformat-truncation on gcc9 - cwprintw(hw, "%sbps", qprefix(transbw, 1, buf, 1)); + cwprintw(hw, "%sbps", ncqprefix(transbw, 1, buf, 1)); ncplane_on_styles(hw, NCSTYLE_BOLD); cwprintw(hw, ")"); } @@ -3166,7 +3170,7 @@ cmvwprintw(hw, 3, START_COL, "%s: %s %s (%s) RO%c", d->name, d->model ? d->model : "n/a", d->revision ? d->revision : "n/a", - bprefix(d->size, 1, buf, 1), + ncbprefix(d->size, 1, buf, 1), d->roflag ? '+' : '-'); if(d->layout == LAYOUT_MDADM){ cwprintw(hw, " Stride: "); @@ -3174,7 +3178,7 @@ if(d->mddev.stride == 0){ ncplane_putstr(hw, "n/a"); }else{ - cwprintw(hw, "%sB", bprefix(d->mddev.stride, 1, buf, 1)); + cwprintw(hw, "%sB", ncbprefix(d->mddev.stride, 1, buf, 1)); } ncplane_on_styles(hw, NCSTYLE_BOLD); cwprintw(hw, " SWidth: "); @@ -3218,27 +3222,27 @@ return 0; } if(blockobj_unpartitionedp(b)){ - char ubuf[BPREFIXSTRLEN + 1]; + char ubuf[NCBPREFIXSTRLEN + 1]; - bprefix(d->size, 1, ubuf, 1); + ncbprefix(d->size, 1, ubuf, 1); ncplane_off_styles(hw, NCSTYLE_BOLD); - cmvwprintw(hw, 6, START_COL, "%*sB ", BPREFIXFMT(ubuf)); + cmvwprintw(hw, 6, START_COL, "%*sB ", NCBPREFIXFMT(ubuf)); ncplane_on_styles(hw, NCSTYLE_BOLD); cwprintw(hw, "%s", "unpartitioned media"); detail_fs(hw, b->d, 7); return 0; } if(b->zone){ - char align[BPREFIXSTRLEN + 1]; - char zbuf[BPREFIXSTRLEN + 1]; + char align[NCBPREFIXSTRLEN + 1]; + char zbuf[NCBPREFIXSTRLEN + 1]; if(b->zone->p){ assert(b->zone->p->layout == LAYOUT_PARTITION); - bprefix(b->zone->p->partdev.alignment, 1, align, 1); + ncbprefix(b->zone->p->partdev.alignment, 1, align, 1); // FIXME limit length! - bprefix(d->logsec * (b->zone->lsector - b->zone->fsector + 1),1, zbuf, 1); + ncbprefix(d->logsec * (b->zone->lsector - b->zone->fsector + 1),1, zbuf, 1); ncplane_off_styles(hw, NCSTYLE_BOLD); - cmvwprintw(hw, 6, START_COL, "%*sB ", BPREFIXFMT(zbuf)); + cmvwprintw(hw, 6, START_COL, "%*sB ", NCBPREFIXFMT(zbuf)); ncplane_on_styles(hw, NCSTYLE_BOLD); cwprintw(hw, "P%lc%lc ", subscript((b->zone->p->partdev.pnumber % 100 / 10)), subscript((b->zone->p->partdev.pnumber % 10))); @@ -3265,8 +3269,8 @@ // but not until we implement zones in core (bug 252) // or we'll need recreate alignment() etc here ncplane_off_styles(hw, NCSTYLE_BOLD); - bprefix(d->logsec * (b->zone->lsector - b->zone->fsector + 1), 1, zbuf, 1); - cmvwprintw(hw, 6, START_COL, "%*sB ", BPREFIXFMT(zbuf)); + ncbprefix(d->logsec * (b->zone->lsector - b->zone->fsector + 1), 1, zbuf, 1); + cmvwprintw(hw, 6, START_COL, "%*sB ", NCBPREFIXFMT(zbuf)); ncplane_on_styles(hw, NCSTYLE_BOLD); ncplane_off_styles(hw, NCSTYLE_BOLD); cwprintw(hw, "%ju", b->zone->fsector); @@ -3338,7 +3342,7 @@ static int helpstrs(struct ncplane* n){ const wchar_t *hs; - int z, rows, cols; + unsigned z, rows, cols; int row = 1; ncplane_dim_yx(n, &rows, &cols); @@ -3479,9 +3483,10 @@ static int update_diags(struct panel_state *ps){ logent l[DIAGROWS]; - int y, x, r; + unsigned uy, x; - ncplane_dim_yx(ps->n, &y, &x); + ncplane_dim_yx(ps->n, &uy, &x); + int y = uy; y -= 2; assert(x > 26 + START_COL * 2); // see ctime_r(3) if((y = get_logs(y, l)) < 0){ @@ -3489,7 +3494,7 @@ } ncplane_set_styles(ps->n, NCSTYLE_BOLD); compat_set_fg(ps->n, SUBDISPLAY_COLOR); - for(r = 0 ; r < y ; ++r){ + for(int r = 0 ; r < y ; ++r){ char *c, tbuf[x]; struct tm tm; size_t tb; @@ -3605,14 +3610,13 @@ } static void -detail_mounts(struct ncplane* w, int* row, int maxy, const device* d){ - char buf[PREFIXSTRLEN + 1], b[256]; - int cols, r; - unsigned z; +detail_mounts(struct ncplane* w, unsigned* row, unsigned maxy, const device* d){ + char buf[NCPREFIXSTRLEN + 1], b[256]; + unsigned cols, r; ncplane_dim_yx(w, NULL, &cols); assert(d->mnt.count == d->mntops.count); - for(z = 0 ; z < d->mnt.count ; ++z){ + for(unsigned z = 0 ; z < d->mnt.count ; ++z){ if(*row == maxy){ return; } @@ -3620,14 +3624,14 @@ continue; } cmvwhline(w, *row, START_COL, " ", cols - 2); - qprefix(d->mntsize, 1, buf, 0); + ncqprefix(d->mntsize, 1, buf, 0); cmvwprintw(w, *row, START_COL, "%-*.*s %-5.5s %-36.36s %*s %-*.*s", FSLABELSIZ, FSLABELSIZ, d->label ? d->label : "n/a", d->mnttype, d->uuid ? d->uuid : "n/a", - PREFIXFMT(buf), - cols - (FSLABELSIZ + 47 + PREFIXCOLUMNS), - cols - (FSLABELSIZ + 47 + PREFIXCOLUMNS), + NCPREFIXFMT(buf), + cols - (FSLABELSIZ + 47 + NCPREFIXCOLUMNS), + cols - (FSLABELSIZ + 47 + NCPREFIXCOLUMNS), d->name); if(++*row == maxy){ return; @@ -3644,9 +3648,9 @@ } static void -detail_targets(struct ncplane* w, int* row, int both, const device* d){ - char buf[PREFIXSTRLEN + 1], b[256]; // FIXME uhhhh - int cols, r; +detail_targets(struct ncplane* w, unsigned* row, int both, const device* d){ + char buf[NCPREFIXSTRLEN + 1], b[256]; // FIXME uhhhh + unsigned cols, r; unsigned z; ncplane_dim_yx(w, NULL, &cols); @@ -3658,14 +3662,14 @@ continue; } cmvwhline(w, *row, START_COL, " ", cols - 2); - qprefix(d->mntsize, 1, buf, 0); + ncqprefix(d->mntsize, 1, buf, 0); cmvwprintw(w, *row, START_COL, "%-*.*s %-5.5s %-36.36s %*s %-*.*s", FSLABELSIZ, FSLABELSIZ, d->label ? d->label : "n/a", d->mnttype, d->uuid ? d->uuid : "n/a", - PREFIXFMT(buf), - cols - (FSLABELSIZ + 47 + PREFIXCOLUMNS), - cols - (FSLABELSIZ + 47 + PREFIXCOLUMNS), + NCPREFIXFMT(buf), + cols - (FSLABELSIZ + 47 + NCPREFIXCOLUMNS), + cols - (FSLABELSIZ + 47 + NCPREFIXCOLUMNS), d->name); ++*row; if(!both){ @@ -3685,7 +3689,7 @@ static int map_details(struct ncplane *hw){ - int y, rows, cols, curcol; + unsigned y, rows, cols, curcol; const controller *c; char *fstab; @@ -3741,7 +3745,7 @@ cmvwhline(hw, y, 1, " ", cols - 2); cmvwprintw(hw, y, 1, "%-*.*s %-5.5s %-36.36s %*s %s", FSLABELSIZ, FSLABELSIZ, "Label", - "Type", "UUID", PREFIXFMT("Bytes"), "Device"); + "Type", "UUID", NCPREFIXFMT("Bytes"), "Device"); if(++y >= rows){ return 0; } @@ -3796,7 +3800,7 @@ static int display_maps(struct ncplane* mainw, struct panel_state* ps){ // FIXME compute based off number of maps + targets - int rows; + unsigned rows; ncplane_dim_yx(mainw, &rows, NULL); rows -= 15; @@ -5042,13 +5046,9 @@ }case NCKEY_UP: case 'k':{ lock_notcurses(); if(fs->idx == fs->scrolloff){ - if(--fs->scrolloff < 0){ - fs->scrolloff = fs->opcount - 1; - } - } - if(--fs->idx < 0){ - fs->idx = fs->opcount - 1; + fs->scrolloff = fs->scrolloff ? fs->scrolloff - 1 : fs->opcount - 1; } + fs->idx = fs->idx ? fs->idx - 1 : fs->opcount - 1; if(fs->formtype == FORM_MULTISELECT){ multiform_options(fs); }else if(fs->formtype == FORM_CHECKBOXEN){ @@ -5060,7 +5060,7 @@ break; }case NCKEY_DOWN: case 'j':{ lock_notcurses(); - int maxz; + unsigned maxz; ncplane_dim_yx(fs->p, &maxz, NULL); maxz = maxz - 5 >= fs->opcount - 1 ? fs->opcount - 1 : maxz - 5; if(fs->idx == (fs->scrolloff + maxz) % fs->opcount){ @@ -5281,7 +5281,10 @@ int r; // FIXME can we not just throw lock_ and unlock_ around the entire stanza? - while((ch = notcurses_getc_blocking(NC, &ni)) != (uint32_t)-1){ + while((ch = notcurses_get_blocking(NC, &ni)) != (uint32_t)-1){ + if(ni.evtype == NCTYPE_RELEASE){ + continue; + } if(ch == 'L' && ni.ctrl){ lock_notcurses(); notcurses_refresh(NC, NULL, NULL); @@ -5292,7 +5295,7 @@ if(ch == NCKEY_RESIZE){ lock_notcurses(); struct ncplane *ncp = ncreel_plane(PR); - int dimy, dimx; + unsigned dimy, dimx; notcurses_refresh(NC, &dimy, &dimx); ncplane_resize_simple(ncp, dimy - 2, dimx); locked_diag("resized to %dx%d", dimx, dimy); @@ -5312,7 +5315,7 @@ ch = ni.id; } // otherwise, continue through with selected item } - if(ch == NCKEY_BUTTON1 && (ni.evtype == NCTYPE_RELEASE || ni.evtype == NCTYPE_UNKNOWN)){ + if(ch == NCKEY_BUTTON1 && (ni.evtype == NCTYPE_PRESS || ni.evtype == NCTYPE_UNKNOWN)){ if(ncmenu_mouse_selected(mainmenu, &ni, &ni) == NULL){ continue; } // otherwise, continue through with selected item @@ -5667,7 +5670,7 @@ if((as = state) == NULL){ if(a->blockdevs){ if( (state = as = create_adapter_state(a)) ){ - int rows, cols; + unsigned rows, cols; //fprintf(stderr, "NEW ADAPTER STATE ASSIGNED %s %p\n", as->c->name, as); notcurses_term_dim_yx(NC, &rows, &cols); @@ -5932,7 +5935,7 @@ diag("User-initiated shutdown\n"); ps = show_splash(L"Shutting down..."); - if(growlight_stop()){ + if(growlight_stop(0)){ kill_splash(ps); notcurses_stop(NC); dump_diags(); @@ -5948,9 +5951,9 @@ static void raise_info_form(const char *str, const char *text){ struct form_state *fs; + unsigned x, y; int lineguess; int cols; - int x, y; assert(str && text); if(actform){ @@ -6105,8 +6108,8 @@ if((NC = notcurses_core_init(&opts, stdout)) == NULL){ return EXIT_FAILURE; } - notcurses_mouse_enable(NC); - int ydim, xdim; + notcurses_mice_enable(NC, NCMICE_BUTTON_EVENT); + unsigned ydim, xdim; notcurses_stddim_yx(NC, &ydim, &xdim); struct ncplane_options nopts = { .y = 1, .x = 0, .rows = ydim - 2, .cols = xdim, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/src/notcurses/notui-aggregate.c new/growlight-1.2.38/src/notcurses/notui-aggregate.c --- old/growlight-1.2.37/src/notcurses/notui-aggregate.c 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/src/notcurses/notui-aggregate.c 2021-12-04 21:03:38.000000000 +0100 @@ -115,16 +115,16 @@ // On success, we must free input desc (hence it not being const) static char * prefix_desc_with_size(const device *d,char *desc){ - char s[BPREFIXSTRLEN],*uni; + char s[NCBPREFIXSTRLEN],*uni; size_t sz; - bprefix(d->size, 1, s, 1); - // Might be a bit overspacious due to full BPREFIXSTRLEN, but who cares + ncbprefix(d->size, 1, s, 1); + // Might be a bit overspacious due to full NCBPREFIXSTRLEN, but who cares sz = (sizeof(s) / sizeof(*s)) + strlen(desc) + 5; // '(' 'B' ')' ' ' '\0' if((uni = malloc(sz)) == NULL){ return NULL; } - if((unsigned)snprintf(uni,sz,"(%*sB) %s", BPREFIXFMT(s), desc) >= sz){ + if((unsigned)snprintf(uni,sz,"(%*sB) %s", NCBPREFIXFMT(s), desc) >= sz){ free(uni); return NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/growlight-1.2.37/src/readline/readline.c new/growlight-1.2.38/src/readline/readline.c --- old/growlight-1.2.37/src/readline/readline.c 2021-10-12 10:08:05.000000000 +0200 +++ new/growlight-1.2.38/src/readline/readline.c 2021-12-04 21:03:38.000000000 +0100 @@ -240,16 +240,16 @@ static int print_mounts(const device *d){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; int r = 0, rr; unsigned z; for(z = 0 ; z < d->mnt.count ; ++z){ - const char *size = d->mntsize ? qprefix(d->mntsize, 1, buf, 0) : ""; + const char *size = d->mntsize ? ncqprefix(d->mntsize, 1, buf, 0) : ""; r += rr = printf("%-*.*s %-5.5s %-36.36s %-6.6s %*s\n %s %s\n", FSLABELSIZ, FSLABELSIZ, d->label ? d->label : "n/a", d->mnttype, d->uuid ? d->uuid : "n/a", d->name, - PREFIXFMT(size), d->mnt.list[z], d->mntops.list[z]); + NCPREFIXFMT(size), d->mnt.list[z], d->mntops.list[z]); if(rr < 0){ return -1; } @@ -259,15 +259,15 @@ static int print_swap(const device *p){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; int r = 0, rr; assert(p->mnttype); - qprefix(p->mntsize, 1, buf, 0), + ncqprefix(p->mntsize, 1, buf, 0), r += rr = printf("%-*.*s %-5.5s %-36.36s %-6.6s %*s", FSLABELSIZ, FSLABELSIZ, p->label ? p->label : "n/a", p->mnttype, p->uuid ? p->uuid : "n/a", - p->name, PREFIXFMT(buf)); + p->name, NCPREFIXFMT(buf)); if(rr < 0){ return -1; } @@ -308,7 +308,7 @@ static int print_empty(uint64_t fsect, uint64_t lsect, size_t sectsize){ - char buf[BPREFIXSTRLEN + 1]; + char buf[NCBPREFIXSTRLEN + 1]; int r = 0, rr; //assert(fsect <= lsect); @@ -318,7 +318,7 @@ use_terminfo_color(COLOR_GREEN, 0); r += rr = printf("Unused sectors %ju:%ju (%s)\n", (uintmax_t)fsect, (uintmax_t)lsect, - bprefix((lsect - fsect + 1) * sectsize, 1, buf, 1)); + ncbprefix((lsect - fsect + 1) * sectsize, 1, buf, 1)); if(rr < 0){ return -1; } @@ -327,14 +327,14 @@ static int print_partition(const device *p, int descend){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; int r = 0, rr; use_terminfo_color(COLOR_BLUE, 1); - qprefix(p->size, 1, buf, 0); + ncqprefix(p->size, 1, buf, 0); r += rr = printf("%-10.10s %-36.36s %*s %-3.3s %ls\n", p->name, p->partdev.uuid ? p->partdev.uuid : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), partrole_str(p->partdev.ptype, p->partdev.flags), p->partdev.pname ? p->partdev.pname : L"n/a"); if(rr < 0){ @@ -380,7 +380,7 @@ static int print_drive(const device *d, int descend){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; uint64_t sector; const device *p; int r = 0, rr; @@ -398,12 +398,12 @@ }else{ use_terminfo_color(COLOR_MAGENTA, 1); // virtual } - qprefix(d->size, 1, buf, 0); + ncqprefix(d->size, 1, buf, 0); r += rr = printf("%-10.10s %-16.16s %4.4s %*s %4uB %ls%ls%ls%ls%ls %-6.6s%-16.16s %-4.4s\n", d->name, d->model ? d->model : "n/a", d->revision ? d->revision : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), d->physsec, d->blkdev.unloaded ? L"U" : d->blkdev.removable ? L"R" : @@ -425,12 +425,12 @@ break; }case LAYOUT_MDADM:{ use_terminfo_color(COLOR_YELLOW, 1); - qprefix(d->size, 1, buf, 0); + ncqprefix(d->size, 1, buf, 0); r += rr = printf("%-10.10s %-16.16s %4.4s %*s %4uB %ls%ls%ls%ls%ls %-6.6s%-16.16s %-4.4s\n", d->name, d->model ? d->model : "n/a", d->revision ? d->revision : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), d->physsec, L"V", L"M", L".", d->roflag ? L"r" : L".", L".", d->mddev.pttable ? d->mddev.pttable : "none", @@ -440,12 +440,12 @@ break; }case LAYOUT_DM:{ use_terminfo_color(COLOR_YELLOW, 1); - qprefix(d->size, 1, buf, 0); + ncqprefix(d->size, 1, buf, 0); r += rr = printf("%-10.10s %-16.16s %4.4s %*s %4uB %ls%ls%ls%ls%ls %-6.6s%-16.16s %-4.4s\n", d->name, d->model ? d->model : "n/a", d->revision ? d->revision : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), d->physsec, L"V", L"D", L".", d->roflag ? L"r" : L".", L".", "n/a", @@ -455,12 +455,12 @@ break; }case LAYOUT_ZPOOL:{ use_terminfo_color(COLOR_RED, 1); - qprefix(d->size, 1, buf, 0); + ncqprefix(d->size, 1, buf, 0); r += rr = printf("%-10.10s %-16.16s %4ju %*s %4uB %ls%ls%ls%ls%ls %-6.6s%-16.16s %-4.4s\n", d->name, d->model ? d->model : "n/a", (uintmax_t)d->zpool.zpoolver, - PREFIXFMT(buf), + NCPREFIXFMT(buf), d->physsec, L"V", L"Z", L".", d->roflag ? L"r" : L".", L".", "spa", @@ -513,17 +513,17 @@ static int print_zpool(const device *d, int descend){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; int r = 0, rr; if(d->layout != LAYOUT_ZPOOL){ return 0; } - qprefix(d->size, 1, buf, 0); + ncqprefix(d->size, 1, buf, 0); r += rr = printf("%-10.10s %-36.36s %*s %4uB ZFS%2ju %5lu %-6.6s\n", d->name, d->uuid ? d->uuid : "n/a", - PREFIXFMT(buf), d->physsec, d->zpool.zpoolver, + NCPREFIXFMT(buf), d->physsec, d->zpool.zpoolver, d->zpool.disks, d->zpool.level ? d->zpool.level : "n/a" ); if(rr < 0){ @@ -537,7 +537,7 @@ static int print_dm(const device *d, int prefix, int descend){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; const mdslave *md; int r = 0, rr; @@ -545,12 +545,12 @@ return 0; } use_terminfo_color(COLOR_YELLOW, 1); - qprefix(d->size, 1, buf, 0); + ncqprefix(d->size, 1, buf, 0); r += rr = printf("%-*.*s%-10.10s %-36.36s %*s %4uB %-6.6s%5lu %-6.6s\n", prefix, prefix, "", d->name, d->uuid ? d->uuid : "n/a", - PREFIXFMT(buf), d->physsec, "n/a", + NCPREFIXFMT(buf), d->physsec, "n/a", d->dmdev.disks, d->dmdev.level ? d->dmdev.level : "n/a" ); if(rr < 0){ @@ -588,7 +588,7 @@ static int print_mdadm(const device *d, int prefix, int descend){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; const mdslave *md; int r = 0, rr; @@ -596,12 +596,12 @@ return 0; } use_terminfo_color(COLOR_YELLOW, 1); - qprefix(d->size, 1, buf, 0); + ncqprefix(d->size, 1, buf, 0); r += rr = printf("%-*.*s%-10.10s %-36.36s %*s %4uB %-6.6s%5lu %-6.6s\n", prefix, prefix, "", d->name, d->uuid ? d->uuid : "n/a", - PREFIXFMT(buf), + NCPREFIXFMT(buf), d->physsec, "n/a", d->mddev.disks, d->mddev.level ? d->mddev.level : "n/a"); if(rr < 0){ @@ -668,13 +668,13 @@ c->ident, c->pcie.domain, c->pcie.bus, c->pcie.dev, c->pcie.func); }else{ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; r += rr = printf("[%s] PCI Express %04x:%02x.%02x.%x (gen %s x%u, %sbps)\n ", c->ident, c->pcie.domain, c->pcie.bus, c->pcie.dev, c->pcie.func, pcie_gen(c->pcie.gen), c->pcie.lanes_neg, - qprefix(c->bandwidth, 1, buf, 1)); + ncqprefix(c->bandwidth, 1, buf, 1)); } break; case BUS_VIRTUAL: @@ -809,7 +809,7 @@ return 0; } printf("%-10.10s %-36.36s %*s %5.5s %-6.6s%-6.6s%-6.6s\n", - "Device", "UUID", PREFIXFMT("Bytes"), "AShft", "Fmt", "Disks", "Level"); + "Device", "UUID", NCPREFIXFMT("Bytes"), "AShft", "Fmt", "Disks", "Level"); if(walk_devices(print_zpool, descend)){ return -1; } @@ -872,7 +872,7 @@ return -1; } printf("%-10.10s %-36.36s %*s %5.5s %-6.6s%-6.6s%-6.6s\n", - "Device", "UUID", PREFIXFMT("Bytes"), "PSect", "Table", "Disks", "Level"); + "Device", "UUID", NCPREFIXFMT("Bytes"), "PSect", "Table", "Disks", "Level"); for(c = get_controllers() ; c ; c = c->next){ device *d; @@ -935,7 +935,7 @@ const controller *c; printf("%-10.10s %-16.16s %4.4s %*s %5.5s Flags %-6.6s%-16.16s %-4.4s\n", - "Device", "Model", "Rev", PREFIXFMT("Bytes"), "PSect", "Table", "WWN", "PHY"); + "Device", "Model", "Rev", NCPREFIXFMT("Bytes"), "PSect", "Table", "WWN", "PHY"); for(c = get_controllers() ; c ; c = c->next){ const device *d; @@ -1323,7 +1323,7 @@ return -1; } printf("%-10.10s %-36.36s %*s %-4.4s %s\n", - "Partition", "UUID", PREFIXFMT("Bytes"), "Role", "Name"); + "Partition", "UUID", NCPREFIXFMT("Bytes"), "Role", "Name"); for(c = get_controllers() ; c ; c = c->next){ const device *d; @@ -1347,7 +1347,7 @@ ZERO_ARG_CHECK(args, arghelp); printf("%-*.*s %-5.5s %-36.36s %s %*s\n", FSLABELSIZ, FSLABELSIZ, "Label", - "Type", "UUID", "Device", PREFIXFMT("Bytes")); + "Type", "UUID", "Device", NCPREFIXFMT("Bytes")); for(c = get_controllers() ; c ; c = c->next){ const device *d; @@ -1421,7 +1421,7 @@ static int print_swaps(const device *d, int descend){ - char buf[PREFIXSTRLEN + 1]; + char buf[NCPREFIXSTRLEN + 1]; int rr, r = 0; if(descend){ @@ -1430,11 +1430,11 @@ if(d->swapprio == SWAP_INVALID){ return 0; } - qprefix(d->mntsize, 1, buf, 0); + ncqprefix(d->mntsize, 1, buf, 0); r += rr = printf("%-*.*s %-5d %-36.36s %s %*s\n", FSLABELSIZ, FSLABELSIZ, d->label ? d->label : "n/a", d->swapprio, d->uuid ? d->uuid : "n/a", - d->name, PREFIXFMT(buf)); + d->name, NCPREFIXFMT(buf)); if(rr < 0){ return -1; } @@ -1445,7 +1445,7 @@ fs_dump(int descend){ printf("%-*.*s %-5.5s %-36.36s %s %*s\n", FSLABELSIZ, FSLABELSIZ, "Label", - "Type", "UUID", "Device", PREFIXFMT("Bytes")); + "Type", "UUID", "Device", NCPREFIXFMT("Bytes")); if(walk_devices(print_fs, descend)){ return -1; } @@ -1547,7 +1547,7 @@ device *d; if(!args[1]){ if(printf("%-*.*s %-5.5s %-36.36s %s %*s\n", FSLABELSIZ, FSLABELSIZ, - "Label", "Prio", "UUID", "Device", PREFIXFMT("Bytes")) < 0){ + "Label", "Prio", "UUID", "Device", NCPREFIXFMT("Bytes")) < 0){ return -1; } if(walk_devices(print_swaps, 0)){ @@ -2173,15 +2173,15 @@ const uint64_t flags = NCDIRECT_OPTION_INHIBIT_SETLOCALE; if((ncd = ncdirect_init(NULL, NULL, flags)) == NULL){ fprintf(stderr, "Couldn't set up notcurses\n"); - growlight_stop(); + growlight_stop(EXIT_FAILURE); return EXIT_FAILURE; } if(tty_ui()){ - growlight_stop(); + growlight_stop(EXIT_FAILURE); ncdirect_stop(ncd); return EXIT_FAILURE; } - if(growlight_stop()){ + if(growlight_stop(EXIT_SUCCESS)){ ncdirect_stop(ncd); return EXIT_FAILURE; }