home *** CD-ROM | disk | FTP | other *** search
- /*********
- * CURDIR.C
- *
- * by Leonard Zerman
- *
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: CURDIR( [<expC>] )
- * Return: Full drive and path of current directory
- * Note : Null if invalid drive.
- *********/
-
- #include <trlib.h>
-
- static char path[67];
- char *get_dir2();
-
- TRTYPE curdir()
- {
- char *drive;
- char *dir;
-
- if(PCOUNT <= 1)
- {
- if(PCOUNT == 0)
- path[0] = (char)(get_drive() + 'A');
- else if (PCOUNT == 1 && ISCHAR(1))
- {
- drive = _parc(1);
- path[0] = toupper(drive[0]);
- }
- else
- {
- _retc(NULLS); /* Wrong parameters */
- return;
- }
- path[1] = ':';
- dir = get_dir2(path[0] - 'A');
- if(dir)
- {
- _tr_strcpy(path+2,dir);
- _retc(path);
- return;
- }
- else
- _retc(NULLS); /* No drive */
- }
- else
- _retc(NULLS); /* Wrong parameters */
- }
-