Printing Utility

Vasilis Vasaitis nvasaiti at athena.auth.gr
Tue Aug 5 03:17:11 EEST 1997


#include <stdio.h>
#include <stdlib.h>

void errormsg()
{
    fprintf(stderr, "SYNTAX: pagesep o|e [height]\n  o=odd, e=even\n");
    exit(1);
}

int main(int argc, char *argv[])
{
    int lcount = 0, height = 50, even;
    char str[1024];
    if (argc < 2) errormsg();
    if (argv[1][0] == 'o') even = 0; else if (argv[1][0] == 'e') even = 1;
      else errormsg();
    if (argc >= 3) height = atoi(argv[2]);
    if (!height) height = 50;
    while (!feof(stdin)) {
        gets(str);
        if (feof(stdin)) break;
        if ((lcount++ / height) % 2 == even) puts(str);
    }
    exit(0);
}


Ti kanei o anthropos an exei oreksi vradiatika...den ksero an auto sou 
kanei...einai ena filter pou pairnei apo tin eisodo to text arxeio kai 
stin eksodo stelnei eite tis mones eite tis ziges selides. Proairetika 
tou orizeis kai to megethos tis selidas (default=50 grammes). P.x.:

pagesep o < printfile.txt | lpr
pagesep e < printfile.txt | lpr

Diladi nomizo oti kapos etsi tiponeis arxeio text. Ante einai kairos na 
diavaso to info tou gawk giati na kaneis tetoia pragmata se C de leei 
katholou. Elpizo pantos na voithisa.

Vasilis
--
====================================================================
Gia na mathete pos na xrisimopoiite ton majordomo, stilte e-mail
sto "majordomo at argos.hol.gr" me 1 grammi sto keimeno: help
Ta archives tis listas einai sto http://www.argos.hol.gr/lists
Gia opoiodipote problima stilte  e-mail ston owner-linux-greek-users
====================================================================



More information about the Linux-greek-users mailing list