diff options
author | Timo Sirainen <cras@irssi.org> | 2000-06-02 01:15:19 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-06-02 01:15:19 +0000 |
commit | d2df583801ad5c6cd73673155151586293ad2189 (patch) | |
tree | 6cd2361d58a95372beb56bd2350ca6667a2cf90b | |
parent | 0e65ba80ca2b4f3a2a24feb6234f26c18feea71f (diff) | |
download | irssi-d2df583801ad5c6cd73673155151586293ad2189.zip |
/CAT <file name> [seek position]
If we don't want to print the file from beginning.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@274 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-common/core/fe-core-commands.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/fe-common/core/fe-core-commands.c b/src/fe-common/core/fe-core-commands.c index c4af0f7c..96ae568c 100644 --- a/src/fe-common/core/fe-core-commands.c +++ b/src/fe-common/core/fe-core-commands.c @@ -224,19 +224,26 @@ static void cmd_version(char *data) static void cmd_cat(const char *data) { - char tmpbuf[1024], *str, *fname; + char *params, *fname, *fposstr; + char tmpbuf[1024], *str; LINEBUF_REC *buffer = NULL; - int f, ret, recvlen; + int f, ret, recvlen, fpos; + + params = cmd_get_params(data, 2, &fname, &fposstr); + fname = convert_home(fname); + fpos = atoi(fposstr); + g_free(params); - fname = convert_home(data); f = open(fname, O_RDONLY); g_free(fname); + if (f == -1) { /* file not found */ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "%s", g_strerror(errno)); return; } + lseek(f, fpos, SEEK_SET); do { recvlen = read(f, tmpbuf, sizeof(tmpbuf)); |