From: <al...@us...> - 2003-02-23 22:58:53
|
Update of /cvsroot/msyslog/msyslog-event/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv6327/modules Modified Files: file.c Log Message: file: use new m_arg struct's union msyslog.h: argv is char *[] !! Index: file.c =================================================================== RCS file: /cvsroot/msyslog/msyslog-event/src/modules/file.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- file.c 23 Feb 2003 22:19:20 -0000 1.1.1.1 +++ file.c 23 Feb 2003 22:58:50 -0000 1.2 @@ -126,7 +126,7 @@ int ch, cnt; /* file -f path -m xxx */ - if (arg->argc < 3 || arg->argc > 5) + if (arg->u.args.argc < 3 || arg->u.args.argc > 5) return (-1); c = (struct file_ctx *) arg->ctx; @@ -149,20 +149,20 @@ /* parse command line */ cnt = 1; - while ((ch = getxopt(arg->argc, arg->argv, + while ((ch = getxopt(arg->u.args.argc, arg->u.args.argv, "f!file: p!pipe: m!mode: c!create", &cnt)) != -1) { switch (ch) { case 'm': - c->mode = (mode_t) strtol(arg->argv[cnt], NULL, 8); + c->mode = (mode_t) strtol(arg->u.args.argv[cnt], NULL, 8); break; case 'f': /* regular file */ c->flags |= F_FILE; - fname = arg->argv[cnt]; + fname = arg->u.args.argv[cnt]; break; case 'p': /* pipe */ c->flags |= F_PIPE; - fname = arg->argv[cnt]; + fname = arg->u.args.argv[cnt]; break; case 'c': c->options |= O_CREAT; @@ -200,8 +200,8 @@ c = (struct file_ctx *) arg->ctx; /* write the data */ - iov[0].iov_base = arg->msg->data; - iov[0].iov_len = arg->msg->dlen; + iov[0].iov_base = arg->u.msg.data; + iov[0].iov_len = arg->u.msg.dlen; iov[1].iov_base = "\n"; /* trailing newline */ iov[1].iov_len = 1; @@ -232,8 +232,8 @@ c = (struct file_ctx *) arg->ctx; /* read the data */ - if ((arg->msg->dlen = read(arg->fd, arg->msg->data, - (sizeof (arg->msg->data) - 1))) == -1) { + if ((arg->u.msg.dlen = read(arg->fd, arg->u.msg.data, + (sizeof (arg->u.msg.data) - 1))) == -1) { strlcpy(arg->err_buf, "file: error reading: ", sizeof (arg->err_buf)); |