[BACK]Return to genusage.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / hgm / mh / src

File: [local] / OpenXM / src / hgm / mh / src / genusage.c (download)

Revision 1.3, Sun Oct 30 01:10:18 2016 UTC (7 years, 7 months ago) by takayama
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -1 lines

Removed warnings by -Wpedantic.

#include <stdio.h>
#include <string.h>
#define SIZE 4098
int main() {
  char s[SIZE];
  int i;
  printf("/* This is automatically generated. Do not edit it.*/\n");
  while (fgets(s,SIZE-1,stdin)!=NULL) {
	if (s[0] == '!') {
	  printf("%s",&(s[1]));
	  continue;
	}
	if (s[0] == '$') {
	  if (strncmp(&(s[1]),"Open",4)==0) {
	    continue;
	  }
	}
	printf("oxprintfe(\"");
	for (i=0; i<strlen(s); i++) {
	  if (s[i] == '\\') printf("\\\\");
	  else if (s[i] == 0xa) printf("\\n");
	  else if (s[i] == '%') printf("%%%%");
	  else if (s[i] == '"') printf("\\\"");
	  else putchar(s[i]);
	}
	printf("\");\n");
  }
  return(0);
}