Nico Golde <nion@wmii.de>

some modifications to prepare -rc2 release
This commit is contained in:
nion@noname 2005-12-21 22:00:31 +01:00
parent 2fec6ab70d
commit bcda412c5d
3 changed files with 14 additions and 13 deletions

5
README
View File

@ -32,7 +32,10 @@ program and for example with vim. Run vim in the server directory and use
key mapping like: key mapping like:
map w1 :.w >> \#ii/in<cr> map w1 :.w >> \#ii/in<cr>
map w2 :.w >> \#wmii/in<cr> map w2 :.w >> \#wmii/in<cr>
to post to channels. Thanks to Matthias Kopfermann for this hint. to post to channels.
If you use the next editor line for a new posting you can use ctrl-p for nick
completion if you wrote the nick in the past.
Thanks to Matthias Kopfermann for this hint.
Configuration Configuration
------------- -------------

View File

@ -6,7 +6,7 @@ MANPREFIX = ${PREFIX}/share/man
INCDIR = ${PREFIX}/include INCDIR = ${PREFIX}/include
LIBDIR = ${PREFIX}/lib LIBDIR = ${PREFIX}/lib
VERSION = 1-rc1 VERSION = 1-rc2
# includes and libs # includes and libs
INCLUDES = -I. -I${INCDIR} -I/usr/include INCLUDES = -I. -I${INCDIR} -I/usr/include

14
ii.c
View File

@ -27,7 +27,7 @@
enum { TOK_NICKSRV = 0, TOK_USER, TOK_CMD, TOK_CHAN, TOK_ARG, TOK_TEXT, TOK_LAST }; enum { TOK_NICKSRV = 0, TOK_USER, TOK_CMD, TOK_CHAN, TOK_ARG, TOK_TEXT, TOK_LAST };
static int irc; static int irc;
static char *fifo[256]; static char *fifo[_POSIX_PATH_MAX];
static char *server = "irc.freenode.net"; static char *server = "irc.freenode.net";
static char nick[32]; /* might change while running */ static char nick[32]; /* might change while running */
static char path[_POSIX_PATH_MAX]; static char path[_POSIX_PATH_MAX];
@ -107,7 +107,7 @@ static size_t tokenize(char **result, size_t reslen, char *str, char delim)
} }
/* creates directories top-down, if necessary */ /* creates directories top-down, if necessary */
static void _mkdir(const char *dir) static void create_lastdir(const char *dir)
{ {
char tmp[256]; char tmp[256];
char *p; char *p;
@ -120,21 +120,19 @@ static void _mkdir(const char *dir)
for(p = tmp + 1; *p; p++) for(p = tmp + 1; *p; p++)
if(*p == '/') { if(*p == '/') {
*p = 0; *p = 0;
if(access(tmp, F_OK))
mkdir(tmp, S_IRWXU); mkdir(tmp, S_IRWXU);
*p = '/'; *p = '/';
} }
if(access(tmp, F_OK))
mkdir(tmp, S_IRWXU); mkdir(tmp, S_IRWXU);
} }
static int _create_filepath(char *filepath, size_t len, char *channel, static int get_filepath(char *filepath, size_t len, char *channel,
char *file) char *file)
{ {
if(channel) { if(channel) {
if(!snprintf(filepath, len, "%s/%s", path, channel)) if(!snprintf(filepath, len, "%s/%s", path, channel))
return 0; return 0;
_mkdir(filepath); create_lastdir(filepath);
return snprintf(filepath, len, "%s/%s/%s", path, channel, file); return snprintf(filepath, len, "%s/%s/%s", path, channel, file);
} }
return snprintf(filepath, len, "%s/%s", path, file); return snprintf(filepath, len, "%s/%s", path, file);
@ -143,7 +141,7 @@ static int _create_filepath(char *filepath, size_t len, char *channel,
static void create_filepath(char *filepath, size_t len, char *channel, static void create_filepath(char *filepath, size_t len, char *channel,
char *suffix) char *suffix)
{ {
if(!_create_filepath(filepath, len, channel, suffix)) { if(!get_filepath(filepath, len, channel, suffix)) {
fprintf(stderr, "%s", "ii: path to irc directory too long\n"); fprintf(stderr, "%s", "ii: path to irc directory too long\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -470,7 +468,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s", "ii: path to irc directory too long\n"); fprintf(stderr, "%s", "ii: path to irc directory too long\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
_mkdir(path); create_lastdir(path);
for(i = 0; i < 256; i++) for(i = 0; i < 256; i++)
fifo[i] = 0; fifo[i] = 0;