Skip to content

Instantly share code, notes, and snippets.

@iratqq
Created January 17, 2009 14:32
Show Gist options
  • Save iratqq/48352 to your computer and use it in GitHub Desktop.
Save iratqq/48352 to your computer and use it in GitHub Desktop.
static inline int parse_opt_q(const char *arg)
{
char *max_buff = safe_strdup(arg);
char *fill_buff = strchr(max_buff, '/');
char *p;
if (opt_aq_max_buff) {
free(opt_aq_max_buff);
opt_aq_max_buff = NULL;
}
if (opt_aq_fill_buff) {
free(opt_aq_fill_buff);
opt_aq_fill_buff = NULL;
}
if (fill_buff != max_buff) {
/* max/fill format */
*fill_buff ='\0';
opt_aq_max_buff = safe_strdup(max_buff);
opt_aq_fill_buff = safe_strdup(fill_buff + 1);
} else {
/* max format */
opt_aq_fill_buff = safe_strdup(max_buff);
}
free(max_buff);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment