File: pyrun.c

package info (click to toggle)
python-setproctitle 1.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 272 kB
  • sloc: ansic: 946; python: 659; makefile: 21
file content (30 lines) | stat: -rw-r--r-- 580 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*-------------------------------------------------------------------------
 *
 * pyrun.c
 *    Stand-alone program to test with embedded Python.
 *
 *    Run a Python program read from stdin. In case of error return 1.
 *
 * Copyright (c) 2011 Daniele Varrazzo <daniele.varrazzo@gmail.com>
 *
 *-------------------------------------------------------------------------
 */

#include <Python.h>

int
main(int argc, char *argv[])
{
    int rv = 0;

    Py_Initialize();

    if (0 != PyRun_SimpleFile(stdin, "stdin")) {
        rv = 1;
    }

    Py_Finalize();

    return rv;
}