[PATCH] embedding a directive within macro arguments is not portable

Urs Janßen <[email protected]> Thu, 02 Dec 2010 23:54:06 +0100
Newsgroups gmane.network.tin.devel
Organization tin.org
Message-ID <[email protected]>
just to be one the safe side

=== modified file 'src/help.c'
--- src/help.c	2010-10-17 19:03:17 +0000
+++ src/help.c	2010-12-02 22:43:05 +0000
@@ -768,16 +768,23 @@
 				printascii(key[2], func_to_key(GLOBAL_HELP, attachment_keys)),
 				printascii(key[3], func_to_key(GLOBAL_QUIT, attachment_keys)));
 			center_line(line, FALSE, buf);
+#ifndef DONT_HAVE_PIPING
 			snprintf(buf, bufs, _(txt_mini_attachment_2),
 				printascii(key[0], func_to_key(ATTACHMENT_SELECT, attachment_keys)),
-#ifndef DONT_HAVE_PIPING
 				printascii(key[5], func_to_key(ATTACHMENT_PIPE, attachment_keys)),
 				printascii(key[6], func_to_key(GLOBAL_PIPE, attachment_keys)),
+				printascii(key[1], func_to_key(ATTACHMENT_SAVE, attachment_keys)),
+				printascii(key[2], func_to_key(ATTACHMENT_TAG, attachment_keys)),
+				printascii(key[3], func_to_key(ATTACHMENT_TAG_PATTERN, attachment_keys)),
+				printascii(key[4], func_to_key(ATTACHMENT_UNTAG, attachment_keys)));
+#else
+			snprintf(buf, bufs, _(txt_mini_attachment_2),
+				printascii(key[0], func_to_key(ATTACHMENT_SELECT, attachment_keys)),
+				printascii(key[1], func_to_key(ATTACHMENT_SAVE, attachment_keys)),
+				printascii(key[2], func_to_key(ATTACHMENT_TAG, attachment_keys)),
+				printascii(key[3], func_to_key(ATTACHMENT_TAG_PATTERN, attachment_keys)),
+				printascii(key[4], func_to_key(ATTACHMENT_UNTAG, attachment_keys)));
 #endif /* !DONT_HAVE_PIPING */
-				printascii(key[1], func_to_key(ATTACHMENT_SAVE, attachment_keys)),
-				printascii(key[2], func_to_key(ATTACHMENT_TAG, attachment_keys)),
-				printascii(key[3], func_to_key(ATTACHMENT_TAG_PATTERN, attachment_keys)),
-				printascii(key[4], func_to_key(ATTACHMENT_UNTAG, attachment_keys)));
 			center_line(line + 1, FALSE, buf);
 			snprintf(buf, bufs, _(txt_mini_attachment_3),
 				printascii(key[1], func_to_key(ATTACHMENT_TOGGLE_TAGGED, attachment_keys)),
@@ -840,19 +847,48 @@
 				printascii(key[4], func_to_key(GROUP_MARK_THREAD_READ, group_keys)),
 				printascii(key[5], func_to_key(GROUP_LIST_THREAD, group_keys)));
 			center_line(line + 1, FALSE, buf);
-			snprintf(buf, bufs, _(txt_mini_group_3),
-#ifndef DONT_HAVE_PIPING
-				printascii(key[0], func_to_key(GLOBAL_PIPE, group_keys)),
-#endif /* !DONT_HAVE_PIPING */
-				printascii(key[1], func_to_key(GROUP_MAIL, group_keys)),
-#ifndef DISABLE_PRINTING
-				printascii(key[2], func_to_key(GLOBAL_PRINT, group_keys)),
-#endif /* !DISABLE_PRINTING */
-				printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
-				printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
-				printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
-				printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
-				printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
+
+#if defined(DONT_HAVE_PIPING) && defined(DISABLE_PRINTING)
+			snprintf(buf, bufs, _(txt_mini_group_3),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
+				printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
+				printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
+				printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
+#else
+#	ifdef DONT_HAVE_PIPING
+			snprintf(buf, bufs, _(txt_mini_group_3),
+				printascii(key[1], func_to_key(GROUP_MAIL, group_keys)),
+				printascii(key[2], func_to_key(GLOBAL_PRINT, group_keys)),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
+				printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
+				printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
+				printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
+#	else
+#		ifdef DISABLE_PRINTING
+			snprintf(buf, bufs, _(txt_mini_group_3),
+				printascii(key[0], func_to_key(GLOBAL_PIPE, group_keys)),
+				printascii(key[1], func_to_key(GROUP_MAIL, group_keys)),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
+				printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
+				printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
+				printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
+#		else
+			snprintf(buf, bufs, _(txt_mini_group_3),
+				printascii(key[0], func_to_key(GLOBAL_PIPE, group_keys)),
+				printascii(key[1], func_to_key(GROUP_MAIL, group_keys)),
+				printascii(key[2], func_to_key(GLOBAL_PRINT, group_keys)),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
+				printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
+				printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
+				printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
+#		endif /* DISABLE_PRINTING */
+#	endif /* DONT_HAVE_PIPING */
+#endif /* DONT_HAVE_PIPING && DISABLE_PRINTING */
+
 			center_line(line + 2, FALSE, buf);
 			break;
 
@@ -885,19 +921,49 @@
 				printascii(key[3], func_to_key(PAGE_FOLLOWUP_QUOTE, page_keys)),
 				printascii(key[4], func_to_key(PAGE_MARK_THREAD_READ, page_keys)));
 			center_line(line + 1, FALSE, buf);
-			snprintf(buf, bufs, _(txt_mini_page_3),
-#ifndef DONT_HAVE_PIPING
-				printascii(key[0], func_to_key(GLOBAL_PIPE, page_keys)),
-#endif /* !DONT_HAVE_PIPING */
-				printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
-#ifndef DISABLE_PRINTING
-				printascii(key[2], func_to_key(GLOBAL_PRINT, page_keys)),
-#endif /* !DISABLE_PRINTING */
-				printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
-				printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
-				printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
-				printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
-				printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
+
+#if defined(DONT_HAVE_PIPING) && defined(DISABLE_PRINTING)
+			snprintf(buf, bufs, _(txt_mini_page_3),
+				printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
+				printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
+				printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
+				printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
+#else
+#	ifdef DONT_HAVE_PIPING
+			snprintf(buf, bufs, _(txt_mini_page_3),
+				printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
+				printascii(key[2], func_to_key(GLOBAL_PRINT, page_keys)),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
+				printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
+				printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
+				printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
+#	else
+#		ifdef DISABLE_PRINTING
+			snprintf(buf, bufs, _(txt_mini_page_3),
+				printascii(key[0], func_to_key(GLOBAL_PIPE, page_keys)),
+				printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
+				printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
+				printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
+				printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
+#		else
+			snprintf(buf, bufs, _(txt_mini_page_3),
+				printascii(key[0], func_to_key(GLOBAL_PIPE, page_keys)),
+				printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
+				printascii(key[2], func_to_key(GLOBAL_PRINT, page_keys)),
+				printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
+				printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
+				printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
+				printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
+				printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
+#		endif /* DISABLE_PRINTING */
+#	endif /* DONT_HAVE_PIPING */
+#endif /* DONT_HAVE_PIPING && DISABLE_PRINTING */
+
 			center_line(line + 2, FALSE, buf);
 			break;
 

=== modified file 'src/post.c'
--- src/post.c	2010-11-26 15:09:11 +0000
+++ src/post.c	2010-12-02 22:33:06 +0000
@@ -200,16 +200,35 @@
 #endif /* HAVE_PGP_GPG */
 	t_function func;
 
-	snprintf(buf, sizeof(buf), _(txt_quit_edit_send),
-					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_send_keys)),
-					printascii(keyedit, func_to_key(POST_EDIT, post_send_keys)),
-#ifdef HAVE_ISPELL
-					printascii(keyispell, func_to_key(POST_ISPELL, post_send_keys)),
-#endif /* HAVE_ISPELL */
-#ifdef HAVE_PGP_GPG
-					printascii(keypgp, func_to_key(POST_PGP, post_send_keys)),
-#endif /* HAVE_PGP_GPG */
-					printascii(keysend, func_to_key(POST_SEND, post_send_keys)));
+#if defined(HAVE_ISPELL) && defined(HAVE_PGP_GPG)
+	snprintf(buf, sizeof(buf), _(txt_quit_edit_send),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_send_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_send_keys)),
+					printascii(keyispell, func_to_key(POST_ISPELL, post_send_keys)),
+					printascii(keypgp, func_to_key(POST_PGP, post_send_keys)),
+					printascii(keysend, func_to_key(POST_SEND, post_send_keys)));
+#else
+#	ifdef HAVE_ISPELL
+	snprintf(buf, sizeof(buf), _(txt_quit_edit_send),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_send_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_send_keys)),
+					printascii(keyispell, func_to_key(POST_ISPELL, post_send_keys)),
+					printascii(keysend, func_to_key(POST_SEND, post_send_keys)));
+#	else
+#		ifdef HAVE_PGP_GPG
+	snprintf(buf, sizeof(buf), _(txt_quit_edit_send),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_send_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_send_keys)),
+					printascii(keypgp, func_to_key(POST_PGP, post_send_keys)),
+					printascii(keysend, func_to_key(POST_SEND, post_send_keys)));
+#		else
+	snprintf(buf, sizeof(buf), _(txt_quit_edit_send),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_send_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_send_keys)),
+					printascii(keysend, func_to_key(POST_SEND, post_send_keys)));
+#		endif /* HAVE_PGP_GPG */
+#	endif /* HAVE_ISPELL */
+#endif /* HAVE_ISPELL && HAVE_PGP_GPG */
 
 	func = prompt_slk_response(POST_SEND, post_send_keys, "%s",
 				sized_message(&smsg, buf, subject));
@@ -1813,19 +1832,47 @@
 			char keypgp[MAXKEYLEN];
 #endif /* HAVE_PGP_GPG */
 
-			func = prompt_slk_response((i ? POST_EDIT : art_unchanged ? POST_POSTPONE : GLOBAL_POST),
-					post_post_keys, _(txt_quit_edit_post),
-					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
-					printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
-#ifdef HAVE_ISPELL
-					printascii(keyispell, func_to_key(POST_ISPELL, post_post_keys)),
-#endif /* HAVE_ISPELL */
-#ifdef HAVE_PGP_GPG
-					printascii(keypgp, func_to_key(POST_PGP, post_post_keys)),
-#endif /* HAVE_PGP_GPG */
-					printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
-					printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
-					printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#if defined(HAVE_ISPELL) && defined(HAVE_PGP_GPG)
+			func = prompt_slk_response((i ? POST_EDIT : art_unchanged ? POST_POSTPONE : GLOBAL_POST),
+					post_post_keys, _(txt_quit_edit_post),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+					printascii(keyispell, func_to_key(POST_ISPELL, post_post_keys)),
+					printascii(keypgp, func_to_key(POST_PGP, post_post_keys)),
+					printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+					printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+					printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#else
+#	ifdef HAVE_ISPELL
+			func = prompt_slk_response((i ? POST_EDIT : art_unchanged ? POST_POSTPONE : GLOBAL_POST),
+					post_post_keys, _(txt_quit_edit_post),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+					printascii(keyispell, func_to_key(POST_ISPELL, post_post_keys)),
+					printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+					printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+					printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#	else
+#		ifdef HAVE_PGP_GPG
+			func = prompt_slk_response((i ? POST_EDIT : art_unchanged ? POST_POSTPONE : GLOBAL_POST),
+					post_post_keys, _(txt_quit_edit_post),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+					printascii(keypgp, func_to_key(POST_PGP, post_post_keys)),
+					printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+					printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+					printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#		else
+			func = prompt_slk_response((i ? POST_EDIT : art_unchanged ? POST_POSTPONE : GLOBAL_POST),
+					post_post_keys, _(txt_quit_edit_post),
+					printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+					printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+					printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+					printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+					printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#		endif /* HAVE_PGP_GPG */
+#	endif /* HAVE_ISPELL */
+#endif /* HAVE_ISPELL && HAVE_PGP_GPG */
 		} else {
 			char *smsg;
 			char buf[LEN];
@@ -4074,18 +4121,43 @@
 		char keypgp[MAXKEYLEN];
 #endif /* HAVE_PGP_GPG */
 
-		snprintf(buff, sizeof(buff), _(txt_quit_edit_xpost),
-				printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
-				printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
-#ifdef HAVE_ISPELL
-				printascii(keyispell, func_to_key(POST_ISPELL, post_post_keys)),
-#endif /* HAVE_ISPELL */
-#ifdef HAVE_PGP_GPG
-				printascii(keypgp, func_to_key(POST_PGP, post_post_keys)),
-#endif /* HAVE_PGP_GPG */
-				printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
-				printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
-				printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#if defined(HAVE_ISPELL) && defined(HAVE_PGP_GPG)
+		snprintf(buff, sizeof(buff), _(txt_quit_edit_xpost),
+				printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+				printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+				printascii(keyispell, func_to_key(POST_ISPELL, post_post_keys)),
+				printascii(keypgp, func_to_key(POST_PGP, post_post_keys)),
+				printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+				printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+				printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#else
+#	ifdef HAVE_ISPELL
+		snprintf(buff, sizeof(buff), _(txt_quit_edit_xpost),
+				printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+				printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+				printascii(keyispell, func_to_key(POST_ISPELL, post_post_keys)),
+				printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+				printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+				printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#	else
+#		ifdef HAVE_PGP_GPG
+		snprintf(buff, sizeof(buff), _(txt_quit_edit_xpost),
+				printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+				printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+				printascii(keypgp, func_to_key(POST_PGP, post_post_keys)),
+				printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+				printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+				printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#		else
+		snprintf(buff, sizeof(buff), _(txt_quit_edit_xpost),
+				printascii(keyquit, func_to_key(GLOBAL_QUIT, post_post_keys)),
+				printascii(keyedit, func_to_key(POST_EDIT, post_post_keys)),
+				printascii(keymenu, func_to_key(GLOBAL_OPTION_MENU, post_post_keys)),
+				printascii(keypost, func_to_key(GLOBAL_POST, post_post_keys)),
+				printascii(keypostpone, func_to_key(POST_POSTPONE, post_post_keys)));
+#		endif /* HAVE_PGP_GPG */
+#	endif /* HAVE_ISPELL */
+#endif /* HAVE_ISPELL && HAVE_PGP_GPG */
 
 		func = prompt_slk_response(default_func, post_post_keys,
 			"%s", sized_message(&smsg, buff, note_h.subj));