Module Name:    othersrc
Committed By:   agc
Date:           Tue Feb 25 20:19:35 UTC 2014

Modified Files:
        othersrc/external/bsd/transit/dist: main.c

Log Message:
add comments


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/transit/dist/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/transit/dist/main.c
diff -u othersrc/external/bsd/transit/dist/main.c:1.3 othersrc/external/bsd/transit/dist/main.c:1.4
--- othersrc/external/bsd/transit/dist/main.c:1.3	Tue Feb 25 08:54:43 2014
+++ othersrc/external/bsd/transit/dist/main.c	Tue Feb 25 20:19:35 2014
@@ -37,7 +37,7 @@
 #define PROGRAM_AUTHOR	"[email protected]"
 #define PROGRAM_VERSION	"20140223"
 
-
+/* process all data in a stream */
 static char *
 dostream(FILE *fp, size_t *size)
 {
@@ -51,6 +51,7 @@ dostream(FILE *fp, size_t *size)
 	return s;
 }
 
+/* open a file and process the stream */
 static char *
 dofile(const char *f, size_t *size)
 {
@@ -66,6 +67,7 @@ dofile(const char *f, size_t *size)
 	return s;
 }
 
+/* recursive walk function */
 static int
 recwalk1(transit_t *t, unsigned *from, FILE *fp, unsigned indent, const char *term)
 {
@@ -103,6 +105,7 @@ recwalk1(transit_t *t, unsigned *from, F
 	}
 }
 
+/* print indent */
 static inline void
 doindent(FILE *fp, unsigned in)
 {
@@ -113,6 +116,7 @@ doindent(FILE *fp, unsigned in)
 	}
 }
 
+/* array-based walk function */
 static int
 arrwalk1(transit_t *t, uint64_t a, FILE *fp, unsigned indent, const char *term)
 {
@@ -157,6 +161,7 @@ arrwalk1(transit_t *t, uint64_t a, FILE 
 	}
 }
 
+/* walk function */
 static int
 walk(transit_t *t, FILE *fp, int recursive)
 {
@@ -172,6 +177,7 @@ walk(transit_t *t, FILE *fp, int recursi
 	return 1;
 }
 
+/* output JSON */
 static int
 output_json(transit_t *t, uint64_t a, FILE *fp)
 {
@@ -219,6 +225,7 @@ output_json(transit_t *t, uint64_t a, FI
 		fprintf(stderr, "unrecognised atom: %d\n", transit_atom_type(atom));
 		return t->c;
 	}
+	fprintf(fp, "\n");
 }
 
 
@@ -241,7 +248,8 @@ main(int argc, char **argv)
 	while ((i = getopt(argc, argv, "Vdjr")) != -1) {
 		switch(i) {
 		case 'V':
-			printf("%s by %s, version %s\n", PROGRAM_NAME, PROGRAM_AUTHOR, PROGRAM_VERSION);
+			printf("%s by %s, version %s\n",
+				PROGRAM_NAME, PROGRAM_AUTHOR, PROGRAM_VERSION);
 			exit(EXIT_SUCCESS);
 		case 'd':
 			decoding = 1;

Reply via email to