Greetings, This patch adds -u and -r options to sic, which allows the user to change the default ident and/or realname, is it good or garbage? should
this go mainstream or just optional?

Raiz


diff --git a/sic.1 b/sic.1
index aba8db8..b85390a 100644
--- a/sic.1
+++ b/sic.1
@@ -9,6 +9,10 @@ sic \- simple irc client
 .IR port ]
 .RB [ \-n
 .IR nick ]
+.RB [ \-u
+.IR ident ]
+.RB [ \-r
+.IR realname ]
 .RB [ \-k
 .IR pass ]
 .RB [ \-v ]
@@ -29,6 +33,12 @@ Overrides the default port (6667)
 .BI \-n " nick"
 Override the default nick ($USER)
 .TP
+.BI \-u " ident"
+Override the default ident ($USER)
+.TP
+.BI \-r " realname"
+Override the default realname ($USER)
+.TP
 .BI \-k " pass"
 Specifies the PASS connection password
 .TP
diff --git a/sic.c b/sic.c
index ce6d216..1241386 100644
--- a/sic.c
+++ b/sic.c
@@ -16,6 +16,8 @@ static char *host = DEFAULT_HOST;
 static char *port = DEFAULT_PORT;
 static char *password;
 static char nick[32];
+static char ident[10];
+static char realname[40];
 static char bufin[4096];
 static char bufout[4096];
 static char channel[256];
@@ -138,7 +140,7 @@ parsesrv(char *cmd) {

 static void
 usage(void) {
- eprint("usage: sic [-h host] [-p port] [-n nick] [-k keyword] [-v]\n", argv0); + eprint("usage: sic [-h host] [-p port] [-n nick] [-u ident] [-r realname] [-k keyword] [-v]\n", argv0);
 }

 int
@@ -149,6 +151,8 @@ main(int argc, char *argv[]) {
        fd_set rd;

        strlcpy(nick, user ? user : "unknown", sizeof nick);
+       strlcpy(ident, nick, sizeof ident);
+       strlcpy(realname, nick, sizeof realname);
        ARGBEGIN {
        case 'h':
                host = EARGF(usage());
@@ -159,6 +163,12 @@ main(int argc, char *argv[]) {
        case 'n':
                strlcpy(nick, EARGF(usage()), sizeof nick);
                break;
+       case 'u':
+               strlcpy(ident, EARGF(usage()), sizeof ident);
+               break;
+       case 'r':
+               strlcpy(realname, EARGF(usage()), sizeof realname);
+               break;
        case 'k':
                password = EARGF(usage());
                break;
@@ -177,7 +187,7 @@ main(int argc, char *argv[]) {
        if(password)
                sout("PASS %s", password);
        sout("NICK %s", nick);
-       sout("USER %s localhost %s :%s", nick, host, nick);
+       sout("USER %s localhost %s :%s", ident, host, realname);
        fflush(srv);
        setbuf(stdout, NULL);
        setbuf(srv, NULL);

Reply via email to