1)SOURCE CODE:
#include”header.h”
int f_open(char *);
char *master_arr(int,char*,char *);
int main(int argc,char *argv[])
{
int f,i=0,k=1,j;
char *buff,*ma,c,*mad;
buff=malloc(2);
ma=malloc(1);
f=f_open(argv[1]);
if(f<0)
{
perror(“open”);
exit(EXIT_FAILURE);
}
mad=master_arr(f,buff,ma);
printf(“\nMASTERARRAY:\n%s”,mad);
return 0;
}
int f_open(char *arg)
{
int fd;
fd=open(arg,O_RDONLY);
return fd;
}
char *master_arr(int ff,char *buff,char *ma)
{int i=0,k=1,j;
read(ff,buff,1);
ma[0]=buff[0];
printf(“ma[0] is %c”,ma[0]);
while(read(ff,buff+1+i,1))
{
for(j=0;j<=i;j++)
{ if(ma[j]==buff[i+1])
{
goto x;
}
}
{
ma=realloc(ma,k+1);
ma[k]=buff[i+1];
k++;
}
x:
buff=realloc(buff,i+3);
i++;
}
buff[i]=”;
return ma;
}
2)RCS scripts
#! /bin/bash
ci prog.c
ci header.h
co prog.c,v
co header.h,v
gcc prog.c
./a.out $1