--------------------------------------------------------------------------- get argv[0] from the environment (The real file name used not the given name) extern char **environ; /* save as in main(ac,av,ep) */ printf("i am %s\n", environ[-2]); --- Tom Christiansen environ[-2] may be argv[argc - 1], not necessary equal to argv[0]. If you throw in some more nonportable assumptions about argc, integers, and pointers, I'd suggest: char ** argv() { extern char ** environ; int ac = 1; while ((int)environ[ -2 - ac ] != ac) ac++; return environ - (1 + ac); } (I have also seen a compiler provide an `extern char ** __Argv', once.) --- Jutta Degner On (system V Rev 4) you can ask the operation system. #include #include #include char *cmd_name() { char fn[12]; static fd = -1; static prpsinfo_t pr; if (fd == -1) { sprintf(fn, "/proc/%05d", getpid()); if ((fd = open(fn, O_RDONLY)) == -1) { perror(fn); exit(1); } if (ioctl(fd, PIOCPSINFO, (void *)&pr) == -1) { perror("ioctl(PIOCPSINFO)"); exit(1); } } return pr.pr_fname; } --------------------------------------------------------------------------- Argc[0] modification for ps output write individual characters into argv[0][0..n] but if my new name is longer than the old name, your stuck --------------------------------------------------------------------------- convert "Sun Sep 16 01:03:52 1973" into a time_t You can use the 'getdate.y' file from many packages, like 'cnews'. Just 'yacc' it, get the resulting .c file and try it on your compiler.. --- Michel Pollet michel@trantor.uucp ---------------------------------------------------------------------------