2004-10-10 Paul Jakma <paul@dishone.st>

	* version.h.in: (pid_output*) add const qualifier.
	* command.h: Change DEFUN func to take const char *[] rather
          than char **, to begin process of fixing compile warnings in lib/.
          Nearly all other changes in this commit follow from this change.
        * buffer.{c,h}: (buffer_write) pointer-arithmetic is gccism, take
          const void * and cast an automatic const char *p to it.
          (buffer_putstr) add const
        * command.c: (zencrypt) const qualifier
          (cmd_execute_command_real) ditto
          (cmd_execute_command_strict) ditto
          (config_log_file) ditto.
          Fix leak of getcwd() returned string.
        * memory.{c,h}: Add MTYPE_DISTRIBUTE_IFNAME for struct dist ifname.
        * distribute.{c,h}: Update with const qualifier.
          (distribute_free) use MTYPE_DISTRIBUTE_IFNAME
          (distribute_lookup) Cast to char *, note that it's ok.
          (distribute_hash_alloc) use MTYPE_DISTRIBUTE_IFNAME.
          (distribute_get)  Cast to char *, note that it's ok.
        * filter.c: Update with const qualifier.
        * if.{c,h}: ditto.
        * if_rmap.{c,h}: ditto.
          (if_rmap_lookup) Cast to char *, note that it's ok.
          (if_rmap_get) ditto.
        * log.{c,h}: Update with const qualifier.
        * plist.{c,h}: ditto.
        * routemap.{c,h}: ditto.
        * smux.{c,h}: ditto. Fix some signed/unsigned comparisons.
        * sockopt.c: (getsockopt_cmsg_data) add return for error case.
        * vty.c: Update with const qualifier.
diff --git a/lib/distribute.c b/lib/distribute.c
index 78de4bf..48eb040 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -51,7 +51,7 @@
 distribute_free (struct distribute *dist)
 {
   if (dist->ifname)
-    free (dist->ifname);
+    XFREE (MTYPE_DISTRIBUTE_IFNAME, dist->ifname);
 
   if (dist->list[DISTRIBUTE_IN])
     free (dist->list[DISTRIBUTE_IN]);
@@ -68,12 +68,13 @@
 
 /* Lookup interface's distribute list. */
 struct distribute *
-distribute_lookup (char *ifname)
+distribute_lookup (const char *ifname)
 {
   struct distribute key;
   struct distribute *dist;
 
-  key.ifname = ifname;
+  /* temporary reference */
+  key.ifname = (char *)ifname;
 
   dist = hash_lookup (disthash, &key);
   
@@ -99,7 +100,7 @@
 
   dist = distribute_new ();
   if (arg->ifname)
-    dist->ifname = strdup (arg->ifname);
+    dist->ifname = XSTRDUP (MTYPE_DISTRIBUTE_IFNAME, arg->ifname);
   else
     dist->ifname = NULL;
   return dist;
@@ -107,12 +108,13 @@
 
 /* Make new distribute list and push into hash. */
 struct distribute *
-distribute_get (char *ifname)
+distribute_get (const char *ifname)
 {
   struct distribute key;
 
-  key.ifname = ifname;
-
+  /* temporary reference */
+  key.ifname = (char *)ifname;
+  
   return hash_get (disthash, &key, distribute_hash_alloc);
 }
 
@@ -144,7 +146,8 @@
 
 /* Set access-list name to the distribute list. */
 struct distribute *
-distribute_list_set (char *ifname, enum distribute_type type, char *alist_name)
+distribute_list_set (const char *ifname, enum distribute_type type, 
+                     const char *alist_name)
 {
   struct distribute *dist;
 
@@ -172,8 +175,8 @@
 /* Unset distribute-list.  If matched distribute-list exist then
    return 1. */
 int
-distribute_list_unset (char *ifname, enum distribute_type type, 
-		       char *alist_name)
+distribute_list_unset (const char *ifname, enum distribute_type type, 
+		       const char *alist_name)
 {
   struct distribute *dist;
 
@@ -221,8 +224,8 @@
 
 /* Set access-list name to the distribute list. */
 struct distribute *
-distribute_list_prefix_set (char *ifname, enum distribute_type type,
-			    char *plist_name)
+distribute_list_prefix_set (const char *ifname, enum distribute_type type,
+			    const char *plist_name)
 {
   struct distribute *dist;
 
@@ -250,8 +253,8 @@
 /* Unset distribute-list.  If matched distribute-list exist then
    return 1. */
 int
-distribute_list_prefix_unset (char *ifname, enum distribute_type type,
-			      char *plist_name)
+distribute_list_prefix_unset (const char *ifname, enum distribute_type type,
+			      const char *plist_name)
 {
   struct distribute *dist;