}
CODIGO FUENTE DE LAS PRINCIPALES FUNCIONES
DE COMUNICACION DE LA SHELL DE COMUNICACIONES
/*
*-----------------------------------------------------------------
*
* NOMBRE: xshine.c
* Moisés Fernández Andrés & Miguel Rueda Barranco
*
* DESCRIPCION: Xwindow Shell for Internet network
*
* FECHA: 06.09.94
*
*------------------------------------------------------------------
*/
/*
*----------------------------------------------------------------
* NOMBRE: shell.h
*
* DESCRIPCION: cabeceras para la shell de comunicaciones
* de xshine
*
* FECHA: 05.09.94
*
*---------------------------------------------------------------
*/
/*
*-------------------------------------------------
* includes necesarios
*-------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef RS6000 /* necesario para sistemas RS/6000 */
#include <malloc.h>
#endif
/*
*-------------------------------------------
* definicion de constantes
*-------------------------------------------
*/
#define MAX_STRING 50
#define MAX_TOKENS 100
#define LONG_MAX_TOKEN 30
#define MAX_SIMPLE 3
#define MAX_PIPES 3
#define NO_ENCONTRADO -1
#define REGULAR -1
#define PERMISO_DEFECTO 0660
#define PROTOCOLO_DEFECTO 0
#define LONG_COLA_DEFECTO 5
#define SOCKET_DORMIR 1
#define FALSE 0
#define TRUE 1
/*
*-----------------------------------------
* macros
*-----------------------------------------
*/
#define obtienePuntNodo(a) (a *) malloc(sizeof(a)) /* para la asignacion */
/* de memoria */
/*
*------------------------------------------
* tipos enumerados
*------------------------------------------
*/
enum descriptorEnum { STDIN, STDOUT, STDERR };
enum pipeEnum { READ, WRITE };
enum IOEnum { NO_REDIREC, REDIREC_FICHERO,
REDIREC_SERVIDOR, REDIREC_CLIENTE, REDIREC_PANT };
enum socketEnum { CLIENTE, SERVIDOR };