/* @(#)util.c 1.2 95/09/16 */

/*
 * Copyright (c) 1994, 1995 by Wayne C. Gramlich.  All rights reserved.
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * for any purpose is hereby granted without fee provided that the above
 * copyright notice and this permission are retained.  The author makes
 * no representations about the suitability of this software for any purpose.
 * It is provided "as is" without express or implied warranty.
 */

#include <sys/types.h>
#include <sys/stat.h>

#include "str_extern.h"
#include "util_extern.h"

/*
 * make_path(file_name)
 *	This routine will ensure that the path for {file_name} exists.
 */
void
make_path(
    Str path)
{
    Str slash;

    for (slash = str_chr_search(path + 1, '/'); slash != (Str)0;
      slash = str_chr_search(slash + 1, '/')) {
	*slash = '\0';
	(void)mkdir((char *)path, 0777);
	*slash = '/';
    }
}

