diff -r d163c8917af7 ii.1 --- a/ii.1 Mon Oct 31 21:35:12 2011 +0100 +++ b/ii.1 Thu Apr 19 13:22:18 2012 -0500 @@ -27,6 +27,8 @@ .IR port ] .RB [ \-k .IR password ] +.RB [ \-j +.IR password_file ] .RB [ \-i .IR prefix ] .RB [ \-n @@ -47,6 +49,9 @@ (be aware of the problem that this is visible in the process list, if you don't want this use a query to submit your password) .TP +.BI \-j " password_file" +lets one use password from file, lest it be read by another user in task list +.TP .BI \-i " prefix" lets you override the default irc path (~/irc) .TP diff -r d163c8917af7 ii.c --- a/ii.c Mon Oct 31 21:35:12 2011 +0100 +++ b/ii.c Thu Apr 19 13:22:18 2012 -0500 @@ -478,6 +478,26 @@ case 'p': port = strtol(argv[++i], NULL, 10); break; case 'n': snprintf(nick,sizeof(nick),"%s", argv[++i]); break; case 'k': key = argv[++i]; break; + case 'j': { + struct stat s; + FILE *keyfile; + i += 1; + keyfile = 0 == strcmp (argv[i], "-") ? stdin : fopen (argv[i], "r"); + if (keyfile == 0 || stat (argv[i], &s) != 0) { + perror (argv[i]); + exit (EXIT_FAILURE); + } + key = malloc (s.st_size); + if (key == 0) { + fprintf (stderr, "Failed to allocate memory\n"); + exit (EXIT_FAILURE); + } + if (fread (key, 1, s.st_size, keyfile) != s.st_size) { + perror (argv[i]); + exit (EXIT_FAILURE); + } + fclose (keyfile); + }; break; case 'f': fullname = argv[++i]; break; default: usage(); break; }