-fknown-extern-type support


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@40 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/libasn1fix/asn1fix_retrieve.c b/libasn1fix/asn1fix_retrieve.c
index 0dfcce4..f2f91d5 100644
--- a/libasn1fix/asn1fix_retrieve.c
+++ b/libasn1fix/asn1fix_retrieve.c
@@ -228,12 +228,17 @@
 	}
 	if(ref_tc == NULL) {
 		DEBUG("Module \"%s\" does not contain \"%s\" "
-			"mentioned at line %d",
+			"mentioned at line %d: %s",
 			src_mod->Identifier,
 			identifier,
-			ref->_lineno
+			ref->_lineno,
+			strerror(errno)
 		);
-		errno = ESRCH;
+		if(asn1f_check_known_external_type(identifier) == 0) {
+			errno = EEXIST; /* Exists somewhere */
+		} else {
+			errno = ESRCH;
+		}
 		return NULL;
 	}
 
@@ -312,8 +317,9 @@
 	 */
 	tc = asn1f_lookup_symbol(arg, ref, &mod);
 	if(tc == NULL) {
-		DEBUG("\tSymbol \"%s\" not found",
-			asn1f_printable_reference(ref));
+		DEBUG("\tSymbol \"%s\" not found: %s",
+			asn1f_printable_reference(ref),
+			strerror(errno));
 		return NULL;
 	}