From 58a54e3b6b26827b979a1fe8d5bfe27eefdb46a9 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Mon, 16 Sep 2019 17:09:49 -0400 Subject: Set default nick to USER unless -P --- chat.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'chat.c') 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); -- cgit 1.4.0 38d0fb121e3f4e74'>refs log tree commit diff
path: root/chat.h (unfollow)
Commit message (Expand)Author
2020-02-10Synthesize a QUIT message to handle on exitJune McEnroe
2020-02-10Factor out XDG base directory codeJune McEnroe
2020-02-10Leave a blank line after loaded bufferJune McEnroe
2020-02-10Add -s to save and load buffersJune McEnroe
2020-02-10Show heat and other unread in titleJune McEnroe
2020-02-10Eliminate array in hashJune McEnroe
2020-02-10Add -HJune McEnroe
2020-02-10Hash to colors in the range 2-75June McEnroe
2020-02-10Improve color fudgingJune McEnroe
2020-02-10Support all 99 IRC colorsJune McEnroe
2020-02-10Avoid coloring mentions if there are control codesJune McEnroe
2020-02-10Recalculate unreadLines on reflowJune McEnroe
2020-02-10Only make windows hotterJune McEnroe
2020-02-10Always increase unreadLinesJune McEnroe
2020-02-10Move scroll marker on resizeJune McEnroe
2020-02-10Update line count for words longer than linesJune McEnroe
2020-02-10Simplify mark, heat, unread trackingJune McEnroe
2020-02-10Update prompt when own nick changesJune McEnroe
2020-02-10Match URLs surrounded by parenthesesJune McEnroe
2020-02-10Fix M-a so it properly cycles back to where it startedJune McEnroe
2020-02-09Add M-lJune McEnroe
2020-02-09Add /whoisJune McEnroe
2020-02-09Add /msgJune McEnroe