home *** CD-ROM | disk | FTP | other *** search
-
- #include <errno.h>
- #include <memory.h>
- #include <aztec/shell.h>
-
- #ifdef TEST
- #include <stdio.h>
- #define _DEBUG
- #include <max/debug.h>
- #endif
-
- #ifndef NULL
- #define NULL 0L
- #endif
-
- char * malloc();
-
- char * getcwd( path, size )
- char * path;
- int size;
- {
-
- register char * cp;
-
- cp = *Sp->curdir;
-
- if (path == NULL) {
- if (size == 0)
- size = strlen( cp ) + 2;
- path = malloc( size );
- }
- if (size <= strlen( cp )) {
- strcpy( path, "" );
- errno = E2BIG;
- return NULL;
- }
-
- strcpy( path, "/" );
- strcat( path, cp );
- return( path );
-
- }
-
- #ifdef TEST
- main()
- {
-
- fprintf( stderr, "%s\n", getcwd( NULL, 0 ));
- }
-
- #endif
-
-