#include #include #include #include #ifdef THINK_C #include #endif #ifdef MYGETOPT char getopt( int argc, char *argv[], char *format ); #endif int verb=0; void strap(char *,char *); void usage(char *name) { fprintf(stderr,"Uso: %s [-hv][-o output] file [file...]\n",name); exit(1); } main( int argc, char *argv[] ) { int i,opcion; char scname[256]; int theError=0; int OutputOpt=0; extern char *optarg; extern int optind,opterr; #ifdef THINK_C argc = ccommand(&argv); #endif while ( (opcion=getopt(argc,argv,"o:hv")) != EOF ) { switch(opcion) { case 'v': printf("%s: vers. 14 agosto 1993\n",argv[0]); verb = 1; break; case 'o': theError += ( *optarg==0x00 ); OutputOpt=optind-1; break; defatult: usage(argv[0]); } } if ((optind==argc)||(theError!=0)) usage(argv[0]); for (i=optind; i\t%s\n",argv[0],argv[i],scname); fflush(stdout); } strap(argv[i],scname); } } void strap(char *orgname,char *dstname) { U_char *buff, *buff_out; int i; Pict org,dst; org = pict_open(orgname,P_READ,0,0, 0 ,NULL); if( org->n_comp < 4 ) { fprintf(stderr,"%s: not alpha (ignored)\n", orgname); } else { dst = pict_open(dstname,P_WRITE, org->image_H,org->image_W,M_RGB24 ,NULL); buff = (U_char *)malloc((size_t)4*(size_t)org->image_W); if ( buff == NULL ) { fprintf(stderr,"No memory! Bye...\n"); exit(-1); } buff_out = buff + (size_t) org->image_W; for(i=0;iimage_H;i++) { pict_get_line(org,buff); pict_put_line(dst,buff_out); } pict_close(dst); free(buff); free(dst); } free(org); }