Karel Zak wrote: > Hi folks, > > I'd like to inform you about actual project state. > > I've applied and fix almost all minor and less critical things. There > was also many problems with package build system (autotools). > > Now in my patches queue are changes to login-utils, mount and > partitioning tools. > > I'd like to release a snapshot from the devel branch -- my > approximation is someday around 25-Feb-2007. I just got this message on Mar 7th? Anyway I've rediffed and retested my `cal` alignment/possible crash patch, which is attached. > If there is someone who wants to test and review these changes: > > $ git clone git://git.kernel.org/pub/scm/utils/util-linux-ng/util-linux-ng.git util-linux-ng > $ git checkout -f devel FYI on Fedora Core 4 the build fails in schedutils as follows: make[2]: Entering directory `/home/padraig/util-linux-ng/schedutils' if gcc -DLOCALEDIR=\"\" -DHAVE_CONFIG_H -I. -I. -I.. -include ../config.h -I../include -fsigned-char -fomit-frame-pointer -g -O2 -MT chrt.o -MD -MP -MF ".deps/chrt.Tpo" -c -o chrt.o chrt.c; \ then mv -f ".deps/chrt.Tpo" ".deps/chrt.Po"; else rm -f ".deps/chrt.Tpo"; exit 1; fi chrt.c: In function ‘show_rt_info’: chrt.c:88: error: ‘SCHED_BATCH’ undeclared (first use in this function) chrt.c:88: error: (Each undeclared identifier is reported only once chrt.c:88: error: for each function it appears in.) chrt.c: In function ‘show_min_max’: chrt.c:130: error: ‘SCHED_BATCH’ undeclared (first use in this function) chrt.c: In function ‘main’: chrt.c:163: error: ‘SCHED_BATCH’ undeclared (first use in this function) make[2]: *** [chrt.o] Error 1 On ubuntu breezy, after doing ./autogen.sh; ./configure.sh && make I immediately get a build error as follows: $ make cd . && autoheader cd . \ && CONFIG_FILES= CONFIG_HEADERS=config.h \ /bin/sh ./config.status config.status: creating config.h config.status: config.h is unchanged config.status: executing default-1 commands make all-recursive make[1]: Entering directory `/home/padraig/util-linux/util-linux-ng' Making all in lib make[2]: Entering directory `/home/padraig/util-linux/util-linux-ng/lib' rm -f libenv.a ar cru libenv.a env.o ranlib libenv.a gcc -DLOCALEDIR=\"\" @DEFS@ -include ../config.h -I../include -fsigned-char -fomit-frame-pointer -g -O2 -c setproctitle.c gcc: @DEFS@: No such file or directory make[2]: *** [setproctitle.o] Error 1 make[2]: Leaving directory `/home/padraig/util-linux/util-linux-ng/lib' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/padraig/util-linux/util-linux-ng' make: *** [all-recursive-am] Error 2 thanks, Pádraig.
diff --git a/misc-utils/cal.c b/misc-utils/cal.c index b0cca1d..7ef62fa 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -87,9 +87,13 @@ my_putstring(char *s) { putp(s); } -static char * +static const char * my_tgetstr(char *s, char *ss) { - return tigetstr(ss); + const char* ret = tigetstr(ss); + if (!ret || ret==(char*)-1) + return ""; + else + return ret; } #elif defined(HAVE_LIBTERMCAP) @@ -110,9 +114,13 @@ my_putstring(char *s) { tputs (s, 1, putchar); } -static char * +static const char * my_tgetstr(char *s, char *ss) { - return tgetstr(s, &strbuf); + const char* ret = tgetstr(s, &strbuf); + if (!ret) + return ""; + else + return ret; } #endif @@ -225,6 +233,7 @@ struct fmt_st char * ascii_day(char *, int); void center_str(const char* src, char* dest, size_t dest_size, int width); void center(const char *, int, int); +int strlen_terminal(const char* s); void day_array(int, int, int, int *); int day_in_week(int, int, int); int day_in_year(int, int, int); @@ -498,10 +507,17 @@ monthly3(int day, int month, int year) { for (i = 0; i < 2; i++) printf("%s %s %s\n", out_prev.s[i], out_curm.s[i], out_next.s[i]); for (i = 2; i < FMT_ST_LINES; i++) { + int width1=width,width2=width,width3=width; +#if defined(HAVE_NCURSES) || defined(HAVE_LIBTERMCAP) + /* adjust width to allow for non printable characters */ + width1+=strlen(out_prev.s[i])-strlen_terminal(out_prev.s[i]); + width2+=strlen(out_curm.s[i])-strlen_terminal(out_curm.s[i]); + width3+=strlen(out_next.s[i])-strlen_terminal(out_next.s[i]); +#endif snprintf(lineout, SIZE(lineout), "%-*s %-*s %-*s\n", - width, out_prev.s[i], - width, out_curm.s[i], - width, out_next.s[i]); + width1, out_prev.s[i], + width2, out_curm.s[i], + width3, out_next.s[i]); #if defined(HAVE_NCURSES) || defined(HAVE_LIBTERMCAP) my_putstring(lineout); #else @@ -773,6 +789,15 @@ center(str, len, separate) (void)printf("%*s", separate, ""); } +int +strlen_terminal(const char* s) +{ + if (Senter && Senter[0]) + if (strstr(s,Senter)) + return strlen(s) - strlen(Senter) - strlen(Sexit); + return strlen(s); +} + void usage() {