Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

new stream_filter which copies pubsub_filtered code but just uses stdin stdout #64

Merged
merged 1 commit into from Jun 28, 2012

Conversation

ploxiln
Copy link
Contributor

@ploxiln ploxiln commented Jun 27, 2012

a new much simpler batch-oriented tool that I find useful

perhaps should be refactored and consolidated ... the whole Makefile and everything could be cleaned up in another pull request

…in stdout

perhaps should be refactored and consolidated
/*
* Parse a comma-delimited list of strings and put them
* in an char array. Array better have enough slots
* because I didn't have time to work out the memory allocation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a whack-a-string alternative; copied so some field names do not make sense.

char **parse_fields(char *key, int *nkeys)
{
    char **argv, *p=key;
    int dots=0, argsz=8;

    *nkeys = 0;
    if (!key) return NULL;
    p = strdup(key);
    argv = calloc(argsz, sizeof(char *));
    argv[0] = p;
    while (*p) {
        if (*p == ',') {
            *p = '\0';
            argv[++dots] = p+1;
            if (dots == argsz) {
                argsz *= 2;
                argv = realloc(argv, argsz);
            }
        }
        p++;
    }
    *nkeys = dots+1;
    return argv;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that comment that you're responding to is actually just copied from pubsub_filtered which Jehiah suggested you originally wrote...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny

mreiferson added a commit that referenced this pull request Jun 28, 2012
new stream_filter which copies pubsub_filtered code but just uses stdin stdout
@mreiferson mreiferson merged commit f78a28e into bitly:master Jun 28, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants