~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to lefty/cs2l/cs2l.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#pragma prototyped
 
2
 
 
3
#include <ast.h>
 
4
#include <cs.h>
 
5
#include <msg.h>
 
6
#include "common.h"
 
7
#include "code.h"
 
8
#include "mem.h"
 
9
#include "tbl.h"
 
10
#include "exec.h"
 
11
#include "cs2l.h"
 
12
 
 
13
int C2Lopen (char *name, char *mode, FILE **ifp, FILE **ofp) {
 
14
    int fd;
 
15
 
 
16
    if ((fd = csopen (name, CS_OPEN_READ)) == -1)
 
17
        return -1;
 
18
    fcntl (fd, F_SETFD, FD_CLOEXEC);
 
19
    *ifp = fdopen (fd, "r"), *ofp = fdopen (fd, "a+");
 
20
    return 0;
 
21
}
 
22
 
 
23
/* LEFTY builtin */
 
24
int C2Lreadcsmessage (int argc, lvar_t *argv) {
 
25
 
 
26
#if 0 /* not finished yet */
 
27
    io_t *p;
 
28
    int ioi, n;
 
29
    Msg_call_t msg;
 
30
    Tobj to;
 
31
    int tm;
 
32
 
 
33
    ioi = Tgetnumber (argv[0].o);
 
34
    if (ioi < 0 || ioi >= ion)
 
35
        return L_FAILURE;
 
36
 
 
37
    p = &iop[ioi];
 
38
    fseek (p->ofp, 0L, 1);
 
39
    if ((n = msgrecv (fileno (p->ifp), &msg)) <= 0)
 
40
        return L_FAILURE;
 
41
    to = Ttable (6);
 
42
    tm = Mpushmark (to);
 
43
    Tinss (to, "id", Tinteger (MSG_CHANNEL_USR (msg.channel)));
 
44
    Tinss (to, "pid", Tinteger (MSG_CHANNEL_SYS (msg.channel)));
 
45
    rtno = to;
 
46
    Mpopmark (tm);
 
47
#endif
 
48
 
 
49
    return L_SUCCESS;
 
50
}