File: pyrun.c

package info (click to toggle)
python-setproctitle 1.3.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: ansic: 946; python: 658; makefile: 21
file content (30 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (2)
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-2021 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;
}