int err = errno;
if (err != EISDIR)
fprintf (stderr, "error %d (%s) reading input\n", err,
- strerror (err));
+ xstrerror (err));
free ((void *) pz_data);
fclose (fp);
return (char *) NULL;
return pz_data;
}
-
+#ifdef IS_CXX_HEADER_NEEDED
t_bool
is_cxx_header (fname, text)
tCC *fname;
return BOOL_FALSE;
}
+#endif /* CXX_TYPE_NEEDED */
+
+#ifdef SKIP_QUOTE_NEEDED
+/*
+ * Skip over a quoted string. Single quote strings may
+ * contain multiple characters if the first character is
+ * a backslash. Especially a backslash followed by octal digits.
+ * We are not doing a correctness syntax check here.
+ */
+tCC*
+skip_quote( q, text )
+ char q;
+ char* text;
+{
+ for (;;)
+ {
+ char ch = *(text++);
+ switch (ch)
+ {
+ case '\\':
+ text++; /* skip over whatever character follows */
+ break;
+
+ case '"':
+ case '\'':
+ if (ch != q)
+ break;
+ /*FALLTHROUGH*/
+
+ case '\n':
+ case NUL:
+ goto skip_done;
+ }
+ } skip_done:;
+
+ return text;
+}
+#endif /* SKIP_QUOTE_NEEDED */
/* * * * * * * * * * * * *
Helper routine and data for the machine_name test and fix.
machname.h is created by black magic in the Makefile. */
-#include "machname.h"
+#ifdef MN_NAME_PAT
tSCC mn_label_pat[] = "^[ \t]*#[ \t]*(if|ifdef|ifndef)[ \t]+";
static regex_t mn_label_re;
static int mn_compiled = 0;
-int
+void
mn_get_regexps( label_re, name_re, who )
regex_t **label_re;
regex_t **name_re;
tCC *who;
{
- /* Maybe we don't need to do this fix at all? */
- if (mn_name_pat[0] == '\0')
- return 1;
-
if (! mn_compiled)
{
compile_re (mn_label_pat, &mn_label_re, 1, "label pattern", who);
}
*label_re = &mn_label_re;
*name_re = &mn_name_re;
- return 0;
}
+#endif
+
+
+#ifdef __MSDOS__
+
+char*
+make_raw_shell_str( pz_d, pz_s, smax )
+ char* pz_d;
+ tCC* pz_s;
+ size_t smax;
+{
+ tSCC zQ[] = "'\\''";
+ size_t dtaSize;
+ char* pz_d_start = pz_d;
+
+ smax--; /* adjust for trailing NUL */
+
+ dtaSize = strlen( pz_s ) + 3;
+
+ {
+ const char* pz = pz_s - 1;
+
+ for (;;) {
+ pz = strchr( pz+1, '\'' );
+ if (pz == (char*)NULL)
+ break;
+ dtaSize += sizeof( zQ )-1;
+ }
+ }
+ if (dtaSize > smax)
+ return (char*)NULL;
+
+ *(pz_d++) = '\'';
+
+ for (;;) {
+ if (pz_d - pz_d_start >= smax)
+ return (char*)NULL;
+ switch (*(pz_d++) = *(pz_s++)) {
+ case NUL:
+ goto loopDone;
+
+ case '\'':
+ if (pz_d - pz_d_start >= smax - sizeof( zQ )-1)
+ return (char*)NULL;
+ strcpy( pz_d-1, zQ );
+ pz_d += sizeof( zQ )-2;
+ }
+ } loopDone:;
+ pz_d[-1] = '\'';
+ *pz_d = NUL;
+
+ return pz_d;
+}
+
+#endif