Christian Hesse <[email protected]> on Wed, 2012/07/04 09:38:
> Michael Brown <[email protected]> on Tue, 2012/07/03 17:07:
> > On Tuesday 03 Jul 2012 16:58:14 Christian Hesse wrote:
> > > > > The attached one should be correct. We should not count the null
> > > > > byte.
> > > >
> > > > strlen() returns the length of a string excluding the terminating NUL.
> > >
> > > You are right... But sizeof() returns 81 (MENU_COLS + 1) in this case.
> > > So how about this?
> >
> > snprintf() requires the size of the buffer (including space for the
> > terminating NUL), so sizeof(buf) is correct.
>
> Hmm, everything seems to work fine now. I was hunting a ghost.
> Probably I reverted my local patch but did not pull from upstream... Sorry
> for the noise.
This brings a new idea to my mind - could be useful to have the git version
printed when booting.
I broke the line in main.c as it was longer than 80 characters and did not
fit the terminal width.
Feed free to apply and/or modify to your needs.
--
main(a,b){char*/* Schoene Gruesse */c="B?IJj;M"
"EHCX:;";for(a/* Chris get my mail address: */=0;b=c[a++];)
putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
diff --git a/src/Makefile b/src/Makefile
index 6537ecb..3bcdb03 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -164,7 +164,12 @@ VERSION_MINOR = 0
VERSION_PATCH = 0
EXTRAVERSION = +
MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
+GITVERSION = $(shell git describe --tags 2>/dev/null)
+ifeq ($(GITVERSION),)
VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
+else
+VERSION = $(GITVERSION)
+endif
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DVERSION_PATCH=$(VERSION_PATCH) \
diff --git a/src/core/main.c b/src/core/main.c
index 9fd4a76..239a45a 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -80,9 +80,10 @@ __asmcall int main ( void ) {
* do so.
*
*/
- printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE " VERSION
+ printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE"
NORMAL " -- Open Source Network Boot Firmware -- "
CYAN "http://ipxe.org" NORMAL "\n"
+ "Version " VERSION " compiled on " __DATE__ ", " __TIME__ "\n"
"Features:" );
for_each_table_entry ( feature, FEATURES )
printf ( " %s", feature->name );
_______________________________________________
ipxe-devel mailing list
[email protected]
https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel