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 i

⟦c272e53b9⟧ TextFile

    Length: 2586 (0xa1a)
    Types: TextFile
    Names: »input_sh_r.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⟧ »input_sh_r.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/input_sh_r.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/input_sh_r.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/input_sh_r.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/input_sh_r.c« 

TextFile

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

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

static	jmp_buf	env;
static	check(error)	int error; 
{
	if (error != E_OK) longjmp(env,error);
}

#define	SIZE_CMD	100
static	char	command[SIZE_CMD+2];	/* +2 for '\n' and '\0'	*/
static	void	store_cmd(str)
char	*str; 
{
	if (strlen(str)>SIZE_CMD) {
		bcopy(str,command,SIZE_CMD);
		command[SIZE_CMD]='\0';
	} else	strcpy(command,str);
	strcat(command,"\n");
}
static	int	init_done=FALSE;
int	input_to_shell_r_read(fd)	int	fd; 
{
	int	i,error;
	char	*str;
	if (error=setjmp(env))	return	error;
#ifdef	DEBUG
	trace_request("Input_to_Shell");
#endif
	check(rw_read_int(fd,&i));
	check((i==F_INPUT)?E_OK:E_INTERNAL_ERROR);
	check(rw_read_str(fd,&str));
#ifdef	DEBUG
	trace_string("in","Input",str);
#endif
	store_cmd(str);
	check(input_to_shell_f_input_in(str,&init_done));

	check(rw_read_int(fd,&i));
	check((i==F_TIMEOUT)?E_OK:E_INTERNAL_ERROR);
	check(rw_read_int(fd,&i));
	check(input_to_shell_f_timeout_in(i));
#ifdef	DEBUG
	trace_int("in","Timeout",i);
#endif
	check(rw_read_int(fd,&i));
	check((i==F_DELIMITOR)?E_OK:E_INTERNAL_ERROR);
	check(rw_read_int(fd,&i));
	check((i==R_INPUT_TO_SHELL)?E_OK:E_INTERNAL_ERROR);
	return	E_OK;
}
int	input_to_shell_r_write(fin,fout)	int	fin,fout; 
{
	int	status,error;
	b_flush(1);			/* Don't want to buffer for remote sh */
	if (error=setjmp(env)) {
		return report_rational_error(	fout,	
		    R_INPUT_TO_SHELL,
		    error,
		    "");
	}
	if (!b_is_empty())	longjmp(env,E_INTERNAL_ERROR);

	b_flush(1);
	check(input_to_shell_f_end(fin,fout));

	if ( (!is_bourneshell()) && (!is_cshell()) && (!is_kshell()) ) {
		return	report_rational_error(	fout,
		    R_INPUT_TO_SHELL,
		    E_UNSUPPORTED,
		    "Status report supported only for sh, csh or ksh");
	}
	if ((error=get_status(&status)) != E_OK) {
		return	report_unix_error(	fout,
		    R_INPUT_TO_SHELL,
		    error);
	}
	if (status) {
#define	REPORT	"Command returned status XXXXXX"
		static	char *p,report[] = REPORT;
		strcpy(report,REPORT);
		for (p=report;*p!='X';p++);
		sprintf(p,"%-6d",status);
		for (p=report+strlen(report)-1;*p==' ';p--)	*p='\0';
		return	report_rational_error(	fout,
		    R_INPUT_TO_SHELL,
		    E_COMMAND_ERROR,
		    report);
	}

#ifdef	DEBUG
	trace_end();
#endif
	rw_write_int(fout,F_DELIMITOR);
	rw_write_int(fout,R_INPUT_TO_SHELL);
	return	E_OK;
}