Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 13668)
+++ wp-includes/link-template.php	(working copy)
@@ -2081,7 +2081,7 @@
 	$shortlink = '';
 
 	// Return p= link for posts.
-	if ( !empty($post_id) ) {
+	if ( !empty($post_id) && '' != get_option('permalink_structure') ) {
 		$post = get_post($post_id);
 		if ( isset($post->post_type) && 'post' == $post->post_type )
 			$shortlink = home_url('?p=' . $post->ID);
@@ -2105,7 +2105,7 @@
 	if ( empty($shortlink) )
 		return;
 
-	echo '<link rel="shortlink" href="' . $shortlink . '" />';
+	echo "<link rel='shortlink' href='" . $shortlink . "' />\n";
 }
 
 /**
@@ -2129,4 +2129,33 @@
 	header('Link: <' . $shortlink . '>; rel=shortlink', false);
 }
 
+/**
+ * Display the Short Link for a Post
+ *
+ * Must be called from inside "The Loop"
+ *
+ * Call like the_shortlink(__('Shortlinkage FTW'))
+ *
+ * @since 3.0.0
+ *
+ * @param string $text Optional The link text or HTML to be displayed.  Defaults to 'This is the short link.'
+ * @param string $title Optional The tooltip for the link.  Must be sanitized.  Defaults to the sanitized post title.
+ * @param string $before Optional HTML to display before the link.
+ * @param string $before Optional HTML to display after the link.
+ */
+function the_shortlink($text = '', $title = '', $before = '', $after = '') {
+	global $post;
+
+	if ( empty($text) )
+		$text = __('This is the short link.');
+
+	if ( empty($title) )
+		$title = the_title_attribute( array('echo' => FALSE) );
+
+	$shortlink = wp_get_shortlink($post->ID);
+
+	if ( !empty($shortlink) )
+		echo "$before<a rel='shortlink' href='$shortlink' title='$title'>$text</a>$after";
+}
+
 ?>
