int filename_to_win32 (char *targ, const char *src) { GError *gerr = NULL; gsize bytes; int err = 0; *targ = '\0'; if (string_is_utf8((const unsigned char *) src)) { gchar *tr = g_locale_from_utf8(src, -1, NULL, &bytes, &gerr); if (gerr != NULL) { fprintf(stderr, "Couldn't handle '%s': %s\n", src, gerr->message); g_error_free(gerr); err = 1; } else { strncat(targ, tr, MAXLEN - 1); g_free(tr); } } else { strncat(targ, src, MAXLEN - 1); } if (!err) { slash_convert(targ, TO_BACKSLASH); } return err; }
int buffer_to_output(char *pBuffer, FILE *pOutput) { int iRetval = 0; macro_list *pMacros = NULL; /* Tokenize the macros and their corresponding values. */ pMacros = extract_macros(pBuffer); if(pMacros != NULL) { /* Perform forward to backslash conversion on those macros known to be * path information only. */ slash_convert(pMacros, "JBOOTDIRS"); slash_convert(pMacros, "JDIRS"); slash_convert(pMacros, "DEPTH"); slash_convert(pMacros, "NS_DEPTH"); slash_convert(pMacros, "PACKAGE"); slash_convert(pMacros, "JMC_GEN_DIR"); slash_convert(pMacros, "DIST_PUBLIC"); /* Process some of the macros, and convert them * into different macros with different data. */ morph_macro(&pMacros, "JMC_GEN", "JMC_HEADERS", "$(JMC_GEN_DIR)\\%s.h"); morph_macro(&pMacros, "JMC_GEN", "JMC_STUBS", "$(JMC_GEN_DIR)\\%s.c"); morph_macro(&pMacros, "JMC_GEN", "JMC_OBJS", ".\\$(OBJDIR)\\%s.obj"); morph_macro(&pMacros, "CSRCS", "C_OBJS", ".\\$(OBJDIR)\\%s.obj"); morph_macro(&pMacros, "CPPSRCS", "CPP_OBJS", ".\\$(OBJDIR)\\%s.obj"); morph_macro(&pMacros, "REQUIRES", "LINCS", "-I$(XPDIST)\\public\\%s"); create_classroot( &pMacros ); /* Output the Macros and the corresponding values. */ iRetval = write_macros(pMacros, pOutput); /* Output rule file inclusion */ if(iRetval == 0) { iRetval = output_rules(pOutput); } /* Output explicit build rules/dependencies for JMC_GEN. */ if(iRetval == 0) { iRetval = explicit_rules(pMacros, "JMC_GEN", pOutput); } if(iRetval == 0) { iRetval = output_end(pOutput); } /* Free off the macro list. */ free_macro_list(pMacros); pMacros = NULL; } return(iRetval); }