All pastes #940 Raw Edit

Anonymous

public c v1 · immutable
#940 ·published 2004-09-14 20:05 UTC
rendered paste body
        int span;        int chan;        char onhookpatternTx[4];        char onhookpatternRx[4];        char onhookpattern[8];        if ((argc < 3) || (argc > 4) || (sscanf(argv[1], "%d", &span) != 1) || (sscanf(argv[2], "%d", &chan) != 1)) {                fprintf(stderr, "Usage: ztbits <span> <channel> [onhook pattern]\n");                fprintf(stderr, "  eg.: ztbits 1 17 11000101\n");                exit(1);        }        printf("%d\n", chan);   // chan is correctly set        if ((argc == 4) && (sscanf(argv[3], "%s[ ]%s", onhookpatternTx, onhookpatternRx) == 1)) {                strncat(onhookpattern, onhookpatternTx, 4);                strncat(onhookpattern, " ", 1);                strncat(onhookpattern, onhookpatternRx, 4);        } else                strcpy(onhookpattern, "0000 0000");        printf("%d\n", chan);   // chan is now 0 ?