Update FSF address
[lttv.git] / lttv / lttv / option.c
index 148b4c88ad1c4c69d21d4fc7ceea07e4517273d1..45eedd972478bc2f273bfe5b1532ea147ec02632 100644 (file)
@@ -12,8 +12,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
- * MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -61,6 +61,20 @@ static void free_option(LttvOption *option)
        g_free(option);
 }
 
+static gboolean compare_short_option(gpointer key,
+                                    gpointer value,
+                                    gpointer user_data)
+{
+       LttvOption *option = value;
+       const char short_option = *(const char *)user_data;
+
+
+       if(option->char_name == short_option) {
+               return TRUE;
+       } else {
+               return FALSE;
+       }
+}
 
 void lttv_option_add(const char *long_name, const char char_name,
                const char *description, const char *arg_description,
@@ -71,9 +85,16 @@ void lttv_option_add(const char *long_name, const char char_name,
 
        g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Add option %s", long_name);
        if(g_hash_table_lookup(options, long_name) != NULL) {
-               g_warning("duplicate option");
+               g_warning("duplicate long-option: %s", long_name);
                return;
        }
+       if(char_name && g_hash_table_find(options, compare_short_option, (gpointer)&char_name) != NULL) {
+               g_warning("duplicate short-option: %c for option %s", 
+                         char_name,
+                         long_name);
+               return;         
+       }
+
 
        option = g_new(LttvOption, 1);
        option->long_name = g_strdup(long_name);
This page took 0.030387 seconds and 4 git commands to generate.