dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH 1/2] daemon: do not chdir unless daemonizing
@ 2016-08-02  1:47 Eric Wong
  2016-08-02  1:47 ` [PATCH 2/2] wwwstream: prioritize search in top title bar Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2016-08-02  1:47 UTC (permalink / raw)
  To: spew

As far as most process managers are concerned (e.g. systemd),
they should already start in '/'.  So avoid making our daemon
more complex to run by requiring absolute paths during
development.
---
 lib/PublicInbox/Daemon.pm | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 9125584..795ab82 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -102,16 +102,18 @@ sub check_absolute ($$) {
 }
 
 sub daemonize () {
-	foreach my $i (0..$#ARGV) {
-		my $arg = $ARGV[$i];
-		next unless -e $arg;
-		$ARGV[$i] = abs_path($arg);
-	}
-	check_absolute('stdout', $stdout);
-	check_absolute('stderr', $stderr);
-	check_absolute('pid-file', $pid_file);
+	if ($daemonize) {
+		foreach my $i (0..$#ARGV) {
+			my $arg = $ARGV[$i];
+			next unless -e $arg;
+			$ARGV[$i] = abs_path($arg);
+		}
+		check_absolute('stdout', $stdout);
+		check_absolute('stderr', $stderr);
+		check_absolute('pid-file', $pid_file);
 
-	chdir '/' or die "chdir failed: $!";
+		chdir '/' or die "chdir failed: $!";
+	}
 
 	return unless (defined $pid_file || defined $group || defined $user
 			|| $daemonize);
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] wwwstream: prioritize search in top title bar
  2016-08-02  1:47 [PATCH 1/2] daemon: do not chdir unless daemonizing Eric Wong
@ 2016-08-02  1:47 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2016-08-02  1:47 UTC (permalink / raw)
  To: spew

search is probably more useful so users should be able to select
it sooner.  Put it on its own line so it won't get scrolled off
the edge for non-CSS users.

Fix a minor spacing bug in the input tag while we're at it, too
---
 lib/PublicInbox/WwwStream.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index ec9ae0c..29395f4 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -33,11 +33,12 @@ sub _html_top ($) {
 	my $upfx = $ctx->{-upfx} || '';
 	my $atom = $ctx->{-atom} || $upfx.'new.atom';
 	my $tip = $ctx->{-html_tip} || '';
-	my $top = "<b>$desc</b> (<a\nhref=\"$atom\">Atom feed</a>)";
+	my $top = "<b>$desc</b>";
+	my $links = "<a\nhref=\"$atom\">Atom feed</a>";
 	if ($obj->search) {
 		my $q_val = $ctx->{-q_value_html};
 		if (defined $q_val && $q_val ne '') {
-			$q_val = qq(\nvalue="$q_val" );
+			$q_val = qq(\nvalue="$q_val");
 		} else {
 			$q_val = '';
 		}
@@ -45,12 +46,13 @@ sub _html_top ($) {
 		my $extra = $ctx->{-extra_form_html} || '';
 		my $action = $upfx eq '' ? './' : $upfx;
 		$top = qq{<form\naction="$action"><pre>$top} .
-			  qq{ <input\nname=q\ntype=text$q_val/>} .
+			  qq{\n<input\nname=q\ntype=text$q_val />} .
 			  $extra .
 			  qq{<input\ntype=submit\nvalue=search />} .
+			  ' ' . $links .
 			  q{</pre></form>}
 	} else {
-		$top = '<pre>' . $top . '</pre>';
+		$top = '<pre>' . $top . "\n" . $links . '</pre>';
 	}
 	"<html><head><title>$title</title>" .
 		"<link\nrel=alternate\ntitle=\"Atom feed\"\n".
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-02  1:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02  1:47 [PATCH 1/2] daemon: do not chdir unless daemonizing Eric Wong
2016-08-02  1:47 ` [PATCH 2/2] wwwstream: prioritize search in top title bar Eric Wong

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 read-only IMAP folder(s) and NNTP newsgroup(s).