summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--catgirl.117
-rw-r--r--chat.c10
2 files changed, 16 insertions, 11 deletions
diff --git a/catgirl.1 b/catgirl.1
index 51f1c4f..27b103b 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -8,7 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
-.Op Fl NRv
+.Op Fl NPRv
 .Op Fl W Ar pass
 .Op Fl a Ar auth
 .Op Fl h Ar host
@@ -33,6 +33,9 @@ The arguments are as follows:
 Send notifications with
 .Xr notify-send 1 .
 .
+.It Fl P
+Prompt for nickname.
+.
 .It Fl R
 Restrict the use of the
 .Ic /join ,
@@ -83,6 +86,8 @@ in files named by date.
 .It Fl n Ar nick
 Set nickname to
 .Ar nick .
+The default nickname
+is the user's name.
 .
 .It Fl p Ar port
 Connect to
@@ -114,14 +119,6 @@ Log in with
 .Ar pass .
 .El
 .
-.Pp
-If
-.Fl h Ar host
-or
-.Fl n Ar nick
-are not provided,
-they will be prompted for.
-.
 .Sh COMMANDS
 Any unique prefix
 may be used to abbreviate a command.
@@ -367,6 +364,8 @@ to set the hostname
 to the first word of
 .Ev SSH_CLIENT ,
 usually the client IP address.
+.It Ev USER
+The default nickname.
 .El
 .
 .Sh EXAMPLES
diff --git a/chat.c b/chat.c
index 021ac77..7e1a9aa 100644
--- a/chat.c
+++ b/chat.c
@@ -53,9 +53,10 @@ int main(int argc, char *argv[]) {
 	setlocale(LC_CTYPE, "");
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "NRW:a:h:j:k:l:n:p:r:u:vw:"))) {
+	while (0 < (opt = getopt(argc, argv, "NPRW:a:h:j:k:l:n:p:r:u:vw:"))) {
 		switch (opt) {
 			break; case 'N': self.notify = true;
+			break; case 'P': self.nick = prompt("Name: ");
 			break; case 'R': self.limit = true;
 			break; case 'W': self.webp = dupe(optarg);
 			break; case 'a': self.auth = dupe(optarg);
@@ -73,9 +74,14 @@ int main(int argc, char *argv[]) {
 		}
 	}
 
+	if (!self.nick) {
+		const char *user = getenv("USER");
+		if (!user) errx(EX_USAGE, "USER unset");
+		self.nick = dupe(user);
+	}
+
 	if (!self.host) self.host = prompt("Host: ");
 	if (!self.port) self.port = dupe("6697");
-	if (!self.nick) self.nick = prompt("Name: ");
 	if (!self.user) self.user = dupe(self.nick);
 	if (!self.real) self.real = dupe(self.nick);
 
kes, but it seems like the right thing to do to be generic? 2021-02-07Add simple battery status and clock to xsessionJune McEnroe I love how simple this is. 2021-02-07Set cursor theme and sizeJune McEnroe 2021-02-07Use scrot for up -s if no screencaptureJune McEnroe Still missing putting the URL in an X selection. 2021-02-07Enable mouse acceleration in XJune McEnroe 2021-02-07Set colours for Xt and cwmJune McEnroe And increase XTerm internalBorder. 2021-02-07Set urgency on bell in xtermJune McEnroe 2021-02-07Add bindings for brightness controlJune McEnroe Weirdly the Fn key doesn't change how the F row registers... I wonder if I can do something about that. 2021-02-07Set X key repeat rateJune McEnroe 2021-02-07Bump font size to 12June McEnroe 11 is what I use on macOS, but I feel like my eyes are working harder here. 2021-02-07Fully configure and rebind cwmJune McEnroe This is sort of a mix of trying to emulate macOS somewhat for my muscle memory and just rebinding some of the cwm defaults to use 4- rather than M-. 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe cwm still needs a lot more rebinding, and I need to actually look at its other options. xterm definitely still needs some configuration, but I at least managed to get it to use a decent looking font. Very happy that OpenBSD includes Luxi Mono, which is what my usual font, Go Mono, is based on anyway. Still missing is xmodmap and such. 2021-02-06Add xterm output to schemeJune McEnroe