On 01/05/14 11:36, Evan Gates wrote:
> On Thu, May 1, 2014 at 8:29 AM, Jean-Philippe Gagné Guay
> <jeanphilippe...@gmail.com> wrote:
> > I am not sure I understand why this would be wrong. Shouldn't calling ii 
> > (via
> > ii or not) without arguments use the default values descibed in the man 
> > page?
> 
> My point is that argc will never be less than 1 (AFAIK). If you want
> to use default values when no arguments are given remove that check
> altogether.
> 
> -emg
> 

Ok, I initially just removed that check, but since the original code checked for
argc < 1, I kept it thinking there was perhaps something I didn't understand.

Here is the patch removing that check:

diff --git a/ii.c b/ii.c
index d93266c..c66edf4 100644
--- a/ii.c
+++ b/ii.c
@@ -466,7 +466,7 @@ int main(int argc, char *argv[]) {
        }
        snprintf(nick, sizeof(nick), "%s", spw->pw_name);
        snprintf(prefix, sizeof(prefix),"%s/irc", spw->pw_dir);
-       if (argc <= 1 || (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'h')) 
usage();
+       if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'h') usage();
 
        for(i = 1; (i + 1 < argc) && (argv[i][0] == '-'); i++) {
                switch (argv[i][1]) {

Reply via email to