~ubuntu-branches/ubuntu/oneiric/irssi/oneiric

« back to all changes in this revision

Viewing changes to src/fe-common/core/autorun.c

  • Committer: Bazaar Package Importer
  • Author(s): Andres Rodriguez
  • Date: 2009-05-05 15:50:50 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090505155050-aoqlnpes7che9rtd
Tags: 0.8.13-1ubuntu1
* Merge from debian unstable (LP: #372411), remaining changes:
  - debian/patches: 03firsttimer_text
    + Adapt it so it tells you about connecting to irc.ubuntu.com and
      joining #ubuntu instead of irc.debian.org and #debian.
  - debian/patches: 90irc-ubuntu-com
* Fixed debian/patches/90irc-ubuntu-com for new irssi.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 autorun.c : irssi
3
 
 
4
 
    Copyright (C) 1999-2001 Timo Sirainen
5
 
 
6
 
    This program is free software; you can redistribute it and/or modify
7
 
    it under the terms of the GNU General Public License as published by
8
 
    the Free Software Foundation; either version 2 of the License, or
9
 
    (at your option) any later version.
10
 
 
11
 
    This program is distributed in the hope that it will be useful,
12
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
    GNU General Public License for more details.
15
 
 
16
 
    You should have received a copy of the GNU General Public License along
17
 
    with this program; if not, write to the Free Software Foundation, Inc.,
18
 
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
 
*/
20
 
 
21
 
#include "module.h"
22
 
#include "signals.h"
23
 
#include "line-split.h"
24
 
#include "special-vars.h"
25
 
 
26
 
#include "fe-windows.h"
27
 
 
28
 
void autorun_startup(void)
29
 
{
30
 
        char tmpbuf[1024], *str, *path;
31
 
        LINEBUF_REC *buffer = NULL;
32
 
        int f, ret, recvlen;
33
 
 
34
 
        /* open ~/.irssi/startup and run all commands in it */
35
 
        path = g_strdup_printf("%s/startup", get_irssi_dir());
36
 
        f = open(path, O_RDONLY);
37
 
        g_free(path);
38
 
        if (f == -1) {
39
 
                /* file not found */
40
 
                return;
41
 
        }
42
 
 
43
 
        do {
44
 
                recvlen = read(f, tmpbuf, sizeof(tmpbuf));
45
 
 
46
 
                ret = line_split(tmpbuf, recvlen, &str, &buffer);
47
 
                if (ret > 0 && *str != '#') {
48
 
                        eval_special_string(str, "",
49
 
                                            active_win->active_server,
50
 
                                            active_win->active);
51
 
                }
52
 
        } while (ret > 0);
53
 
        line_split_free(buffer);
54
 
 
55
 
        close(f);
56
 
}