Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Commit

Permalink
reorganizacao dos files
Browse files Browse the repository at this point in the history
  • Loading branch information
OnikenX committed Nov 18, 2019
1 parent 69e70c7 commit ca0b111
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 308 deletions.
1 change: 1 addition & 0 deletions .gitingnore → .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ verificador
gestor
cliente
*.kdev4
.kdev4/
294 changes: 0 additions & 294 deletions .kdev4/MSGDIST.kdev4

This file was deleted.

4 changes: 0 additions & 4 deletions MSGDIST.kdev4

This file was deleted.

1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ all: debug
debug:clean gestor verificador cliente



verificador: verificador.c
$(CC) $(CFLAGS) verificador.c -o verificador -g

Expand Down
Binary file removed cliente
Binary file not shown.
Binary file removed cliente.o
Binary file not shown.
Binary file removed cmd.o
Binary file not shown.
Binary file removed gestor.o
Binary file not shown.
5 changes: 5 additions & 0 deletions proibidas
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test
test
a
to

Binary file removed utils.o
Binary file not shown.
Binary file removed verificador
Binary file not shown.
18 changes: 9 additions & 9 deletions verificar.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int initverifica ( char *comando, char *file_proibidas, int *rcv, int *env, int
pipe ( p );
pipe ( pr );
*pid = fork() ;
if ( ( *pid ) == 0 )
if ( *pid == 0 )
{
//child process
close ( 0 ); //fecha acesso ao teclado
Expand All @@ -35,7 +35,7 @@ int initverifica ( char *comando, char *file_proibidas, int *rcv, int *env, int
close ( pr[1] ); //fechar extremidade de leitura do pipe - p[1]

execl ( comando, comando, file_proibidas, NULL );

exit(3);//fechar
}
close ( p[0] );
close ( pr[1] );
Expand All @@ -51,22 +51,22 @@ int initverifica ( char *comando, char *file_proibidas, int *rcv, int *env, int

int verificamsg ( int pipein, int pipeout, char * msg )
{
char response[5];

int sizeofall = strlen ( msg ) + sizeof ( " ##MSGEND## \n" );
char response[10];
char msgend[] = " ##MSGEND## \n" ;
int sizeofall = strlen ( msg ) + strlen (msgend );

char envia[sizeofall] ;
strcpy ( envia, msg );
strcat ( envia, " ##MSGEND## \n" );
//ading content

strcat ( envia,msgend );
fprintf (stdout,"msg = %s\n", msg );
//escreve na pipe para enviar informação ao verificador
write ( pipein, envia, strlen ( envia ) );

//recebe informacao
int n = read ( pipeout, response, sizeof ( response ) );
response[n-1] ='\0';

fprintf(stdout,"response = %s\n", response);
return atoi ( response );

}
Expand Down
Binary file removed verificar.o
Binary file not shown.

0 comments on commit ca0b111

Please sign in to comment.