DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T c

⟦6e33158b8⟧ TextFile

    Length: 1924 (0x784)
    Types: TextFile
    Names: »create_f.c«

Derivation

└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦038380b96⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦038380b96⟧ 
            └─ ⟦this⟧ »create_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
            └─ ⟦this⟧ »../../dtia/release_apollo_2.1/create_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦25fab149a⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦25fab149a⟧ 
            └─ ⟦this⟧ »../../dtia/release_sun_2.1/create_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦be254d495⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦be254d495⟧ 
            └─ ⟦this⟧ »../../dtia/release_aix_2.1/create_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦c67979795⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦c67979795⟧ 
            └─ ⟦this⟧ »../../dtia/release_hp_2.1/create_f.c« 

TextFile

#ifndef	lint
#ifndef	DEBUG
static char SCCS_id[] = "@(#)create_f.c 2.1 90/08/02 19:04:17  Copyright(c) 1990 by Rational.";
#else
static char SCCS_id[] = "@(#)create_f.c DEBUG 2.1 90/08/02 19:04:17  Copyright(c) 1990 by Rational.";
#endif
#endif

#define	CREATE_F
#include	"talk.h"
#undef	CREATE_F

static	int	error_number = E_OK;
static	int	already_exists = FALSE;
static	int	fd;
static	short	is_directory;
static	short	create_directories;

static	int	create_sub_dir(name)
char	*name; 
{
	char	*p;
	int	nb_sub_dir=0;

	for (p=(*name=='/')?name+1:name;*p;p++)
		if (*p=='/') {
			*p='\0';
			nb_sub_dir++;
		}
	/* All the '/' are '\0'			*/
	/* except the first one if name is	*/
	/* an absolute path			*/
	/* so name points to the first sub_dir	*/
	/* if nb_sub_dir>0.			*/
	while (nb_sub_dir) {
		if (access(name,F_OK)== -1) {
			/* Sub directory doesn't exist	*/
			if (mkdir(name,0755)== -1) {
				/* Unable to create sub directory */
				error_number = errno;
				return (-1);
			}
		}
		/* Let's go to the following sub_directory */
		for (p=name;*p;p++);
		*p='/';
		nb_sub_dir--;
	}
	return (0);
}

int	create_f_is_directory_in(id)
int	id; 
{
	create_directories = TRUE;
	error_number = E_OK;
	already_exists = FALSE;
	is_directory = id;
	return E_OK;
}

int	create_f_create_directories_in(cd)
int	cd; 
{
	create_directories = cd;
	return	E_OK;
}

int	create_f_remote_file_in(name)
char	*name; 
{
	if (create_directories) {
		if ((create_sub_dir(name)) == -1) {
			return E_OK;
		}
	}
	if (access(name,F_OK) == -1) {
		if (is_directory) {
			if (mkdir(name,0755) == -1)	error_number = errno;
		} else {
			if ((fd=open(name,O_WRONLY|O_CREAT,0644))== -1)
				error_number = errno;
			else {
				close(fd);
			}
		}
	} else {
		already_exists = TRUE;
	}
	return E_OK;
}

int	create_f_options_in(options)
char	*options; 
{
	return	E_OK;
}

int	create_f_end() {
	return (already_exists ? EALREADYEXISTS : error_number);
}