コード例 #1
0
ファイル: i18n.c プロジェクト: ARMWorks/FA_2451_Linux_Kernel
/*
 * Function: find_specifier_end
 * Return a pointer to the end of the format specifier.
*/
static char *find_specifier_end(char *input)
{
	input++;		/* Advance over %. */
	input = skip_flags(input);
	input = skip_width(input);
	input = skip_conversion(input);
	return input;
}
コード例 #2
0
ファイル: mkvmi.c プロジェクト: AaronZhangL/swipl-devel
static int
load_vmis(const char *file)
{ FILE *fd = fopen(file, "r");

  if ( fd )
  { char buf[1024];
    int line = 0;

    while(fgets(buf, sizeof(buf), fd))
    { line++;

      if ( strncmp(buf, "VMI(", 4) == 0 )
      { const char *s1 = skip_ws(buf+4);
	const char *e1 = skip_id(s1);
	const char *s2 = skip_ws(skip_over(e1, ','));
	const char *e2 = skip_flags(s2);
	const char *s3 = skip_ws(skip_over(e2, ','));
	const char *e3 = skip_flags(s3);
	const char *s4 = skip_over(skip_ws(skip_over(e3, ',')), '(');
	const char *e4 = skip_over(s4, ')');

	if ( !e4 )
	{ fprintf(stderr, "Syntax error at %s:%d\n", file, line);
	  exit(1);
	} else
	  e4--;				/* backspace over ) */

	vmi_list[vmi_count].name  = my_strndup(s1, e1-s1);
	vmi_list[vmi_count].flags = my_strndup(s2, e2-s2);
	vmi_list[vmi_count].argc  = my_strndup(s3, e3-s3);
	vmi_list[vmi_count].args  = my_strndup(s4, e4-s4);

	add_synopsis(s1, e1-s1);	/* flags (s2) isn't needed for VM signature */
	add_synopsis(s3, e3-s3);
	add_synopsis(s4, e4-s4);

	vmi_count++;
      }
    }

    fclose(fd);
    return 0;
  }

  return -1;
}