#line 2 "osdep/bld_path.dos"

/*----------------------------------------------------------------------
      Paste together two pieces of a file name path

  Args: pathbuf      -- Put the result here
        first_part   -- of path name
        second_part  -- of path name
 
 Result: New path is in pathbuf.  No check is made for overflow.

BUGS:  This is a first stab at dealing with fs naming dependencies, and others 
still exist.
  ----*/
void
build_path(pathbuf, first_part, second_part)
    char *pathbuf, *first_part, *second_part;
{
    register int i;

    if(!first_part || (isalpha(second_part[0]) && second_part[1] == ':')){
	strcpy(pathbuf, second_part);
	return;
    }

    for(i = 0; first_part[i]; i++)
      *pathbuf++ = first_part[i];

    if(i && first_part[i-1] == '\\'){		/* first part ended with \  */
        if(*second_part == '\\')		/* and second starts with \ */
	  second_part++;			/* else just append second  */
    }
    else if(*second_part != '\\')		/* no slash at all, so      */
      *pathbuf++ = '\\';			/* insert one...	    */

    while(*second_part)
      *pathbuf++ = *second_part++;

    *pathbuf = '\0';
}


/*----------------------------------------------------------------------
  Test to see if the given file path is absolute

  Args: file -- file path to test

 Result: TRUE if absolute, FALSE otw

  ----*/
int
is_absolute_path(path)
    char *path;
{
    return(path && (*path == '\\'
		    || (isalpha((unsigned char)path[0]) && path[1] == ':')));
}


