1: #ifndef lint
   2: static char sccsid[] = "@(#)getwd.c	5.4 (Berkeley) 6/19/85";
   3: #endif
   4: 
   5: #include "uucp.h"
   6: 
   7: /*
   8:  *	get working directory
   9:  *
  10:  *	return codes  0 = FAIL
  11:  *		      wkdir = SUCCES
  12:  */
  13: 
  14: char *
  15: getwd(wkdir)
  16: register char *wkdir;
  17: {
  18:     register FILE *fp;
  19:     extern FILE *rpopen();
  20:     extern int rpclose();
  21:     register char *c;
  22: 
  23:     *wkdir = '\0';
  24:     if ((fp = rpopen("PATH=/bin:/usr/bin:/usr/ucb;pwd 2>&-", "r")) == NULL)
  25:         return 0;
  26:     if (fgets(wkdir, 100, fp) == NULL) {
  27:         rpclose(fp);
  28:         return 0;
  29:     }
  30:     if (*(c = wkdir + strlen(wkdir) - 1) == '\n')
  31:         *c = '\0';
  32:     rpclose(fp);
  33:     return wkdir;
  34: }

Defined functions

Defined variables

sccsid defined in line 2; never used
Last modified: 1986-01-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 574
Valid CSS Valid XHTML 1.0 Strict