git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Michael J Gruber <git@drmicha.warpmail.net>, git@vger.kernel.org
Subject: Re: [PATCH] Add a notice that only certain functions can print color escape codes
Date: Fri, 27 Nov 2009 08:42:25 +0100	[thread overview]
Message-ID: <4B0F82E1.80402@viscovery.net> (raw)
In-Reply-To: <7vzl68v2zb.fsf@alter.siamese.dyndns.org>

Junio C Hamano schrieb:
> Johannes Sixt <j.sixt@viscovery.net> writes:
> 
>> Like this?
> 
> Yeah, and in addition to "puts", "write(2)" is also not supported, right?

Correct, good catch!

--- 8< ---
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] Add a notice that only certain functions can print color escape codes

We emulate color escape codes on Windows by overriding printf, fprintf,
and fputs. Warn users that these are the only functions that can be used
to print them.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 color.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/color.h b/color.h
index 7d8da6f..3cb4b7f 100644
--- a/color.h
+++ b/color.h
@@ -4,6 +4,11 @@
 /* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
 #define COLOR_MAXLEN 24

+/*
+ * IMPORTANT: Due to the way these color codes are emulated on Windows,
+ * write them only using printf(), fprintf(), and fputs(). In particular,
+ * do not use puts() or write().
+ */
 #define GIT_COLOR_NORMAL	""
 #define GIT_COLOR_RESET		"\033[m"
 #define GIT_COLOR_BOLD		"\033[1m"
-- 
1.6.6.rc0.43.g50037

  reply	other threads:[~2009-11-27  7:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26 15:24 [RFC/PATCH 0/2] status -s: Use the same config as status Michael J Gruber
2009-11-26 15:24 ` [RFC/PATCH 1/2] status -s: respect the status.relativePaths option Michael J Gruber
2009-11-27  3:15   ` Junio C Hamano
2009-11-27  7:05   ` Jeff King
2009-11-26 15:24 ` [RFC/PATCH 2/2] status -s: obey color.status Michael J Gruber
2009-11-26 15:36   ` Johannes Sixt
2009-11-26 16:03     ` Michael J Gruber
2009-11-26 19:00     ` Junio C Hamano
2009-11-27  7:00       ` [PATCH] Add a notice that only certain functions can print color escape codes Johannes Sixt
2009-11-27  7:30         ` Junio C Hamano
2009-11-27  7:42           ` Johannes Sixt [this message]
2009-11-27  9:22             ` Michael J Gruber
2009-11-27  5:15   ` [RFC/PATCH 2/2] status -s: obey color.status Junio C Hamano
2009-11-27  9:17     ` Michael J Gruber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B0F82E1.80402@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).