[BACK]Return to file2c.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / file2c

Annotation of src/usr.bin/file2c/file2c.c, Revision 1.1

1.1     ! downsj      1: /*     $OpenBSD$       */
        !             2: /*
        !             3:  * ----------------------------------------------------------------------------
        !             4:  * "THE BEER-WARE LICENSE" (Revision 42):
        !             5:  * <phk@login.dknet.dk> wrote this file.  As long as you retain this notice you
        !             6:  * can do whatever you want with this stuff. If we meet some day, and you think
        !             7:  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
        !             8:  * ----------------------------------------------------------------------------
        !             9:  *
        !            10:  * $FreeBSD: file2c.c,v 1.1 1995/01/29 00:49:57 phk Exp $
        !            11:  *
        !            12:  */
        !            13:
        !            14: #include <stdio.h>
        !            15:
        !            16: int
        !            17: main(argc, argv)
        !            18:     int argc;
        !            19:     char **argv;
        !            20: {
        !            21:     int i,j,k;
        !            22:     char s[10];
        !            23:
        !            24:     if (argc > 1)
        !            25:         printf("%s\n",argv[1]);
        !            26:     k = 0;
        !            27:     j = 0;
        !            28:     while((i = getchar()) != EOF) {
        !            29:        if(k++) {
        !            30:            putchar(',');
        !            31:            j++;
        !            32:        }
        !            33:        if (j > 70) {
        !            34:            putchar('\n');
        !            35:            j = 0;
        !            36:        }
        !            37:        printf("%d",i);
        !            38:        if (i > 99)
        !            39:            j += 3;
        !            40:        else if (i > 9)
        !            41:            j += 2;
        !            42:        else
        !            43:            j++;
        !            44:     }
        !            45:     putchar('\n');
        !            46:     if (argc > 2)
        !            47:         printf("%s\n",argv[2]);
        !            48:     return 0;
        !            49: }