1 /***********************************************************
2 Copyright (c) 2000, BeOpen.com.
3 Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4 Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
7 See the file "Misc/COPYRIGHT" for information on usage and
8 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9 ******************************************************************/
11 /* Python interpreter main program for frozen scripts */
16 extern void PyWinFreeze_ExeInit(void);
17 extern void PyWinFreeze_ExeTerm(void);
18 extern int PyInitFrozenExtensions(void);
22 #include <unistd.h> /* For isatty() */
25 /* For isatty()'s proto. - [cjh] */
33 Py_FrozenMain(int argc
, char **argv
)
40 Py_FrozenFlag
= 1; /* Suppress errors from getpath.c */
42 if ((p
= getenv("PYTHONINSPECT")) && *p
!= '\0')
44 if ((p
= getenv("PYTHONUNBUFFERED")) && *p
!= '\0')
48 setbuf(stdin
, (char *)NULL
);
49 setbuf(stdout
, (char *)NULL
);
50 setbuf(stderr
, (char *)NULL
);
54 PyInitFrozenExtensions();
56 Py_SetProgramName(argv
[0]);
59 PyWinFreeze_ExeInit();
63 fprintf(stderr
, "Python %s\n%s\n",
64 Py_GetVersion(), Py_GetCopyright());
66 PySys_SetArgv(argc
, argv
);
68 n
= PyImport_ImportFrozenModule("__main__");
70 Py_FatalError("__main__ not frozen");
78 if (inspect
&& isatty((int)fileno(stdin
)))
79 sts
= PyRun_AnyFile(stdin
, "<stdin>") != 0;
82 PyWinFreeze_ExeTerm();