1
/* Lefteris Koutsofios - AT&T Bell Laboratories */
17
static char * NEAR shellpath;
19
static char *buildpath (char *);
20
static void panic (char *, int, char *, char *, ...);
22
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
23
LPSTR lpCmdLine, int nCmdShow) {
29
shellpath = getenv ("PATH");
30
if (!shellpath || !(path = buildpath ("lefty"))) {
31
if (!GetModuleFileName (hInstance, cmd, 256) ||
32
!(s = strrchr (cmd, '\\')))
36
if (!(path = buildpath ("lefty")))
39
if (lpCmdLine[0] == 0)
40
sprintf (cmd, "%s -e \"load('dotty.lefty');dotty.protogt.lserver='neato';dotty.simple(null);\"", path);
42
sprintf (cmd, "%s -e \"load('dotty.lefty');dotty.protogt.lserver='neato';dotty.simple('%Ns');\"", path, lpCmdLine);
44
handle = WinExec (cmd, SW_SHOW);
51
static char pathbuf[1024];
52
static char commandbuf[1024];
54
static char *buildpath (char *file) {
59
if (file && file[0] && (file[0] == '.' || file[0] == PATHDEL))
65
while (*s1 && *s1 != PATHSEP)
66
pathbuf[pathi++] = *s1++;
69
pathbuf[pathi++] = PATHDEL;
70
for (s2 = file; *s2; s2++)
71
pathbuf[pathi++] = *s2;
72
pathbuf[pathi++] = '.';
73
pathbuf[pathi++] = 'e';
74
pathbuf[pathi++] = 'x';
75
pathbuf[pathi++] = 'e';
76
pathbuf[pathi] = '\000';
77
if (stat (pathbuf, &statbuf) == 0 && (statbuf.st_mode & mode))
83
static void panic (char *file, int line, char *func, char *fmt, ...) {
89
vsprintf (buf, fmt, args);
90
MessageBox ((HWND) NULL, buf, "dotty PANIC", MB_APPLMODAL);