Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 362340 Details for
Bug 444610
sys-apps/openrc output is unfriendly on high resolution/wide monitors
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
New patch, now detecting terminals properly
openrc-leftsided-output-new.patch (text/plain), 4.78 KB, created by
Patrick Lauer
on 2013-10-31 05:35:36 UTC
(
hide
)
Description:
New patch, now detecting terminals properly
Filename:
MIME Type:
Creator:
Patrick Lauer
Created:
2013-10-31 05:35:36 UTC
Size:
4.78 KB
patch
obsolete
>diff --git a/src/libeinfo/einfo.h b/src/libeinfo/einfo.h >index 31a891f..246f44a 100644 >--- a/src/libeinfo/einfo.h >+++ b/src/libeinfo/einfo.h >@@ -140,5 +140,8 @@ void eoutdentv(void); > /*! @brief Prefix each einfo line with something */ > void eprefix(const char * EINFO_RESTRICT); > >+/*! @brief toggles between left-side and right-sided eend output */ >+void eleft(bool); >+ > __END_DECLS > #endif >diff --git a/src/libeinfo/einfo.map b/src/libeinfo/einfo.map >index 428a895..2f50739 100644 >--- a/src/libeinfo/einfo.map >+++ b/src/libeinfo/einfo.map >@@ -29,7 +29,7 @@ global: > eindentv; > eoutdentv; > eprefix; >- >+ eleft; > local: > *; > }; >diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c >index 9791051..cdb666b 100644 >--- a/src/libeinfo/libeinfo.c >+++ b/src/libeinfo/libeinfo.c >@@ -73,6 +73,7 @@ hidden_proto(elog) > hidden_proto(eoutdent) > hidden_proto(eoutdentv) > hidden_proto(eprefix) >+hidden_proto(eleft) > hidden_proto(ewarn) > hidden_proto(ewarnn) > hidden_proto(ewarnv) >@@ -118,6 +119,9 @@ hidden_proto(ewendv) > /* A pointer to a string to prefix to einfo/ewarn/eerror messages */ > static const char *_eprefix = NULL; > >+/* A bool for toggling left (true) and right-sided (false) eend */ >+static bool _eleft = true; >+ > /* Buffers and structures to hold the final colours */ > static char ebuffer[100]; > struct ecolor { >@@ -525,6 +529,13 @@ eprefix(const char *EINFO_RESTRICT prefix) > } > hidden_def(eprefix) > >+void >+eleft(bool eleft) >+{ >+ _eleft=eleft; >+} >+hidden_def(eleft) >+ > static void EINFO_PRINTF(2, 0) > elogv(int level, const char *EINFO_RESTRICT fmt, va_list ap) > { >@@ -629,6 +640,8 @@ static int EINFO_PRINTF(3, 0) > if (_eprefix) > fprintf(f, "%s%s%s|", _ecolor(f, color), _eprefix, _ecolor(f, ECOLOR_NORMAL)); > fprintf(f, " %s*%s ", _ecolor(f, color), _ecolor(f, ECOLOR_NORMAL)); >+ if (_eleft && isatty(fileno(f))) >+ retval+=fprintf(f, "%s", " "); > retval += _eindent(f); > va_copy(ap, va); > retval += vfprintf(f, fmt, ap) + 3; >@@ -819,9 +832,15 @@ _eend(FILE * EINFO_RESTRICT fp, int col, ECOLOR color, const char *msg) > cols--; > > if (cols > 0 && colour_terminal(fp)) { >- fprintf(fp, "%s%s %s[%s %s %s]%s\n", up, tgoto(goto_column, 0, cols), >+ if (_eleft) { >+ fprintf(fp, "%s%s %s[%s %s %s]%s\n\n", up, tgoto(goto_column, 0, 0), > ecolor(ECOLOR_BRACKET), ecolor(color), msg, > ecolor(ECOLOR_BRACKET), ecolor(ECOLOR_NORMAL)); >+ } else { >+ fprintf(fp, "%s%s %s[%s %s %s]%s\n", up, tgoto(goto_column, 0, cols), >+ ecolor(ECOLOR_BRACKET), ecolor(color), msg, >+ ecolor(ECOLOR_BRACKET), ecolor(ECOLOR_NORMAL)); >+ } > } else { > if (col > 0) > for (i = 0; i < cols - col; i++) >diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c >index e38ce11..774bcb5 100644 >--- a/src/rc/rc-status.c >+++ b/src/rc/rc-status.c >@@ -47,6 +47,8 @@ static RC_STRINGLIST *types; > static RC_STRINGLIST *levels, *services, *tmp, *alist; > static RC_STRINGLIST *sservices, *nservices, *needsme; > >+bool left = false; >+ > bool > _rc_can_find_pids(void) > { >@@ -95,7 +97,14 @@ static void > print_service(const char *service) > { > char status[10]; >- int cols = printf(" %s", service); >+ int cols; >+ if (left && isatty(fileno(stdout))) >+ { >+ /* hardcoded width, should be fixed */ >+ cols = printf(" %s", service); >+ } else { >+ cols = printf("%s", service); >+ } > const char *c = ecolor(ECOLOR_GOOD); > RC_SERVICE state = rc_service_state(service); > ECOLOR color = ECOLOR_BAD; >@@ -195,7 +204,7 @@ print_stacked_services(const char *runlevel) > #define usagestring "" \ > "Usage: rc-status [options] <runlevel>...\n" \ > " or: rc-status [options] [-a | -c | -l | -r | -s | -u]" >-#define getoptstring "aclrsu" getoptstring_COMMON >+#define getoptstring "xaclrsu" getoptstring_COMMON > static const struct option longopts[] = { > {"all", 0, NULL, 'a'}, > {"crashed", 0, NULL, 'c'}, >@@ -203,6 +212,7 @@ static const struct option longopts[] = { > {"runlevel", 0, NULL, 'r'}, > {"servicelist", 0, NULL, 's'}, > {"unused", 0, NULL, 'u'}, >+ {"leftaligned", 0, NULL, 'x'}, > longopts_COMMON > }; > static const char * const longopts_help[] = { >@@ -212,6 +222,7 @@ static const char * const longopts_help[] = { > "Show the name of the current runlevel", > "Show service list", > "Show services not assigned to any runlevel", >+ "Show output left-aligned", > longopts_help_COMMON > }; > #include "_usage.c" >@@ -229,6 +240,9 @@ rc_status(int argc, char **argv) > while ((opt = getopt_long(argc, argv, getoptstring, longopts, > (int *) 0)) != -1) > switch (opt) { >+ case 'x': >+ left = true; >+ break; > case 'a': > aflag++; > levels = rc_runlevel_list(); >@@ -277,6 +291,10 @@ rc_status(int argc, char **argv) > case_RC_COMMON_GETOPT > } > >+ // alignment stuff >+ if (left) >+ eleft(true); >+ > if (!levels) > levels = rc_stringlist_new(); > opt = (optind < argc) ? 0 : 1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 444610
:
362194
|
362282
| 362340