This patch fixes PR gdb/15995.
The bug here is that gdb's printf command does not flush the output
stream.  This makes a printf that is not newline-terminated interleave
incorrectly with other forms of output, such as that generated via a
call to an external program using "shell".
I note that the "output" command already does this flushing.
The fix is to call gdb_flush in printf_command.
Built and regtested on x86-64 Fedora 18.
New test case included.
	PR gdb/15995:
	* printcmd.c (printcmd): Call gdb_flush.
	* gdb.base/printcmds.exp (test_printf): Test printf flushing.
+2013-10-17  Tom Tromey  <tromey@redhat.com>
+
+       PR gdb/15995:
+       * printcmd.c (printcmd): Call gdb_flush.
+
 2013-10-17  Tom Tromey  <tromey@redhat.com>
 
        * elfread.c (struct elfinfo) <stabindexsect>: Remove.
 
 printf_command (char *arg, int from_tty)
 {
   ui_printf (arg, gdb_stdout);
+  gdb_flush (gdb_stdout);
 }
 
 /* Implement the "eval" command.  */
 
+2013-10-17  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.base/printcmds.exp (test_printf): Test printf flushing.
+
 2013-10-14  Tom Tromey  <tromey@redhat.com>
 
        * gdb.dwarf2/dwzbuildid.exp (write_dwarf_file): Pass explicit test
 
     gdb_test "printf \"% p\", 0" "Inappropriate modifiers to format specifier 'p' in printf"
     gdb_test "printf \"%0p\", 0" "Inappropriate modifiers to format specifier 'p' in printf"
     gdb_test "printf \"%+p\", 0" "Inappropriate modifiers to format specifier 'p' in printf"
+
+
+    gdb_test "define hibob\nprintf \"hi bob \"\nshell echo zzz\nprintf \"y\\n\"\nend" \
+       "" \
+       "create hibob command"
+    gdb_test "hibob" "hi bob zzz.*y" "run hibob command"
 }
 
 #Test printing DFP values with printf