More cleanups: (#53)

- sprinkle const
- add a macro (setptr) that cheats const to temporarily NUL terminate strings
  remove casts from allocations
- use strdup instead of strlen+strcpy
- use x = malloc(sizeof(*x)) instead of x = malloc(sizeof(type of *x)))
- add -Wcast-qual (and casts through unitptr_t in the two macros we
  cheat (xfree, setptr)).
diff --git a/awk.h b/awk.h
index 0395e3f..c7bfacc 100644
--- a/awk.h
+++ b/awk.h
@@ -30,7 +30,12 @@
 
 typedef	unsigned char uschar;
 
-#define	xfree(a)	{ if ((a) != NULL) { free((void *) (a)); (a) = NULL; } }
+#define	xfree(a)	{ if ((a) != NULL) { free((void *)(intptr_t)(a)); (a) = NULL; } }
+/*
+ * We sometimes cheat writing read-only pointers to NUL-terminate them
+ * and then put back the original value
+ */
+#define setptr(ptr, a)	(*(char *)(intptr_t)(ptr)) = (a)
 
 #define	NN(p)	((p) ? (p) : "(null)")	/* guaranteed non-null for dprintf
 */
@@ -70,7 +75,7 @@
 
 extern int	dbg;
 
-extern	char	*patbeg;	/* beginning of pattern matched */
+extern const char *patbeg;	/* beginning of pattern matched */
 extern	int	patlen;		/* length of pattern matched.  set in b.c */
 
 /* Cell:  all information about a variable or constant */