#include #include #include #include #define READONLY 0 #define PICSIZE 1024 #define BLOCKSIZE 1024 /* Default disk sector size */ /* * NAME: normalize.c * DESCRIPTION: This program pads the comments of a CVL-formatted * picture file so that the picture data will begin * on a disk sector boundry * COMPILATION: cc -s -O -o normalize normalize.c -lcvl * (This program uses errprnt.) * MODIFICATION HISTORY: Written by Joseph Sanjour -- CVL * on May 20, 1985 */ char *argv0; /* for errprnt */ struct cvl_p header; int tmp_fd; /* file descriptor for tmp */ int to_pad, i; int blocksize = BLOCKSIZE; char *bufin, *bufout; /* buffers for copying pic. */ char *tmp = "/tmp/chcmnt.?????"; /* file name for tmp-file */ int *picbuf; /* buffer for picture */ main(argc, argv) int argc; char **argv; { char **p; /* pointer to call line arguments */ int n = argc; /* used for processing options */ register int len; /* length of input header */ int newlcom = 0; /* length of comments after cleaning */ int gotchar = 0; /* boolean flag for cleaning comments */ int verbose = 0; /* boolean flag for verbose option */ argv0 = argv[0]; /* set option flags */ for (p = argv; n-- > 0; p++) if(p[0][0] == '-') { if ((p[0][1] >= '0') && (p[0][1] <= '9')) blocksize = atoi(&p[0][1]); else if (p[0][1] == 'v') verbose = 1; else errprnt("usage: normalize [-blocksize] [-v] [