581 * mkstemp(3C) doesn't actually help us, since the temporary file
582 * isn't used by us, only its name.
583 */
584 if (mktemp(tmpl) == NULL)
585 nomem();
586
587 (void) asprintf(&ret, "%s/%s%s", ctx->i_tmpdir, tmpl,
588 (ext != NULL) ? ext : "");
589
590 if (ret == NULL)
591 nomem();
592
593 return (ret);
594 }
595
596 static boolean_t
597 is_source_file(const char *path)
598 {
599 char *ext = strrchr(path, '.');
600
601 if ((ext == NULL) || ((ext + 1) == '\0'))
602 return (B_FALSE);
603
604 ext += 1;
605
606 if ((strcasecmp(ext, "c") == 0) ||
607 (strcmp(ext, "cc") == 0) ||
608 (strcmp(ext, "i") == 0) ||
609 (strcasecmp(ext, "s") == 0) ||
610 (strcmp(ext, "cpp") == 0)) {
611 return (B_TRUE);
612 }
613
614 return (B_FALSE);
615 }
616
617
618 static void
619 do_gcc(cw_ictx_t *ctx)
620 {
621 int c;
|
581 * mkstemp(3C) doesn't actually help us, since the temporary file
582 * isn't used by us, only its name.
583 */
584 if (mktemp(tmpl) == NULL)
585 nomem();
586
587 (void) asprintf(&ret, "%s/%s%s", ctx->i_tmpdir, tmpl,
588 (ext != NULL) ? ext : "");
589
590 if (ret == NULL)
591 nomem();
592
593 return (ret);
594 }
595
596 static boolean_t
597 is_source_file(const char *path)
598 {
599 char *ext = strrchr(path, '.');
600
601 if ((ext == NULL) || (*(ext + 1) == '\0'))
602 return (B_FALSE);
603
604 ext += 1;
605
606 if ((strcasecmp(ext, "c") == 0) ||
607 (strcmp(ext, "cc") == 0) ||
608 (strcmp(ext, "i") == 0) ||
609 (strcasecmp(ext, "s") == 0) ||
610 (strcmp(ext, "cpp") == 0)) {
611 return (B_TRUE);
612 }
613
614 return (B_FALSE);
615 }
616
617
618 static void
619 do_gcc(cw_ictx_t *ctx)
620 {
621 int c;
|