command line in preamble

diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c
index 194dabd..226c2a8 100644
--- a/libasn1compiler/asn1c_save.c
+++ b/libasn1compiler/asn1c_save.c
@@ -6,16 +6,17 @@
 #include "asn1c_save.h"
 #include "asn1c_out.h"
 
-static int asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *);
+static int asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *, int, int, char **);
 static int asn1c_print_streams(arg_t *arg);
-static int asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *);
+static int asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *, int, int, char **);
 static int asn1c_copy_over(arg_t *arg, char *path);
 static int identical_files(const char *fname1, const char *fname2);
 static int generate_pdu_collection_file(arg_t *arg);
+static int generate_preamble(arg_t *, FILE *, int argc, int optc, char **argv);
 
 int
 asn1c_save_compiled_output(arg_t *arg, const char *datadir,
-		int argc, char **argv) {
+		int argc, int optc, char **argv) {
 	asn1c_fdeps_t *deps = 0;
 	asn1c_fdeps_t *dlist;
 	asn1p_module_t *mod;
@@ -32,7 +33,8 @@
 		TQ_FOR(arg->expr, &(mod->members), next) {
 			if(asn1_lang_map[arg->expr->meta_type]
 				[arg->expr->expr_type].type_cb) {
-				if(asn1c_dump_streams(arg, deps))
+				if(asn1c_dump_streams(arg, deps,
+						argc, optc, argv))
 					return -1;
 			}
 		}
@@ -153,11 +155,11 @@
  * Dump the streams.
  */
 static int
-asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *deps)  {
+asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *deps, int argc, int optc, char **argv)  {
 	if(arg->flags & A1C_PRINT_COMPILED) {
 		return asn1c_print_streams(arg);
 	} else {
-		return asn1c_save_streams(arg, deps);
+		return asn1c_save_streams(arg, deps, argc, optc, argv);
 	}
 }
 
@@ -185,7 +187,7 @@
 }
 
 static int
-asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps) {
+asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int argc, int optc, char **argv) {
 	asn1p_expr_t *expr = arg->expr;
 	compiler_streams_t *cs = expr->data;
 	out_chunk_t *ot;
@@ -210,24 +212,8 @@
 		return -1;
 	}
 
-	fprintf(fp_c,
-	"/*\n"
-	" * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n"
-	" * From ASN.1 module \"%s\"\n"
-	" * \tfound in \"%s\"\n"
-	" */\n\n",
-		expr->module->ModuleName,
-		expr->module->source_file_name
-	);
-	fprintf(fp_h,
-	"/*\n"
-	" * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n"
-	" * From ASN.1 module \"%s\"\n"
-	" * \tfound in \"%s\"\n"
-	" */\n\n",
-		expr->module->ModuleName,
-		expr->module->source_file_name
-	);
+	generate_preamble(arg, fp_c, argc, optc, argv);
+	generate_preamble(arg, fp_h, argc, optc, argv);
 
 	header_id = asn1c_make_identifier(0, expr->Identifier, NULL);
 	fprintf(fp_h,
@@ -317,6 +303,26 @@
 }
 
 static int
+generate_preamble(arg_t *arg, FILE *fp, int argc, int optc, char **argv) {
+	fprintf(fp,
+	"/*\n"
+	" * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n"
+	" * From ASN.1 module \"%s\"\n"
+	" * \tfound in \"%s\"\n",
+		arg->expr->module->ModuleName,
+		arg->expr->module->source_file_name);
+	if(optc > 1) {
+		int i;
+		fprintf(fp, " * \t`asn1c ");
+		for(i = 1; i < optc; i++)
+			fprintf(fp, "%s%s", i>1?" ":"", argv[i]);
+		fprintf(fp, "`\n");
+	}
+	fprintf(fp, " */\n\n");
+	return 0;
+}
+
+static int
 identical_files(const char *fname1, const char *fname2) {
 	char buf[2][4096];
 	FILE *fp1, *fp2;
diff --git a/libasn1compiler/asn1c_save.h b/libasn1compiler/asn1c_save.h
index 26c36a3..d7382f4 100644
--- a/libasn1compiler/asn1c_save.h
+++ b/libasn1compiler/asn1c_save.h
@@ -2,6 +2,6 @@
 #define	_ASN1C_SAVE_H_
 
 int asn1c_save_compiled_output(arg_t *arg, const char *datadir,
-	int argc, char **argv);
+	int argc, int optc, char **argv);
 
 #endif	/* _ASN1C_SAVE_H_ */
diff --git a/libasn1compiler/asn1compiler.c b/libasn1compiler/asn1compiler.c
index e38ce8d..408db2f 100644
--- a/libasn1compiler/asn1compiler.c
+++ b/libasn1compiler/asn1compiler.c
@@ -9,7 +9,7 @@
 
 int
 asn1_compile(asn1p_t *asn, const char *datadir, enum asn1c_flags flags,
-		int argc, char **argv) {
+		int argc, int optc, char **argv) {
 	arg_t arg_s;
 	arg_t *arg = &arg_s;
 	asn1p_module_t *mod;
@@ -58,7 +58,7 @@
 	/*
 	 * Save or print out the compiled result.
 	 */
-	if(asn1c_save_compiled_output(arg, datadir, argc, argv))
+	if(asn1c_save_compiled_output(arg, datadir, argc, optc, argv))
 		return -1;
 
 	return 0;
diff --git a/libasn1compiler/asn1compiler.h b/libasn1compiler/asn1compiler.h
index e33628f..39352f9 100644
--- a/libasn1compiler/asn1compiler.h
+++ b/libasn1compiler/asn1compiler.h
@@ -72,6 +72,6 @@
  * Compile the ASN.1 specification.
  */
 int asn1_compile(asn1p_t *asn, const char *datadir, enum asn1c_flags,
-	int argc, char **argv);
+	int argc, int optc, char **argv);
 
 #endif	/* ASN1_COMPILER_H */