5a0d8785caf27045eda07b21a7aa468bbf392f7f
11 int main (int argc
, char *argv
[])
16 /* This is a special feature handled in the simulator. The "42"
17 should be formed from getpid () if this was a real program. */
18 if (readlink ("/proc/42/exe", buf
, sizeof (buf
)) < 0)
21 /* Don't use an abort in the following; it might cause the printf to
22 not make it all the way to output and make debugging more
25 /* We assume the program is called with no path, so we might need to
27 if (getcwd (buf2
, sizeof (buf2
)) != buf2
)
33 if (argv
[0][0] == '/')
36 if (strchr (argv
[0] + 1, '/') != NULL
)
38 printf ("%s != %s\n", argv
[0], strrchr (argv
[0] + 1, '/'));
42 if (strcmp (argv
[0], buf
) != 0)
44 printf ("%s != %s\n", buf
, argv
[0]);
48 else if (argv
[0][0] != '.')
50 if (buf2
[strlen (buf2
) - 1] != '/')
52 strcat (buf2
, argv
[0]);
53 if (strcmp (buf2
, buf
) != 0)
55 printf ("%s != %s\n", buf
, buf2
);
61 strcat (buf2
, argv
[0] + 1);
62 if (strcmp (buf
, buf2
) != 0)
64 printf ("%s != %s\n", buf
, buf2
);
This page took 0.032054 seconds and 3 git commands to generate.