/* $id$ $Log: ardy.c,v $ Revision 1.3 1999/06/28 07:14:31 ajosey Change page number from 0 to -1 to denote quitting Revision 1.2 1999/06/28 07:12:16 ajosey Allow single letter, [oO|cC|eE] for comment type Revision 1.1 1999/06/28 07:05:53 ajosey Initial revision */ /* to compile use [cc|c89] -o ardy ardy.c */ /* * This program creates POSIX or X/Open style review comments. * * All you do is type what it asks for and press Return to * move to the next field. (You have to hit * Return twice to exit from the text entry fields.) * * Enter -1 to quit for the page number. */ #include #include main () { char numbuf1[128], numbuf2[128], combuf1[128], combuf2[128],combuf3[128]; char linebuf[1024]; char outputname[128]; FILE *fopen (), *fp; int i; printf ("\nWelcome to the Aardvark format comment generator\n"); printf ("When entering comments, type what it asks for\n"); printf ("and press Return to move to the next field\n"); printf ("**You have to hit Return twice to exit from the text entry fields**\n"); printf ("\nEnter the output file name: "); gets (outputname); if (*outputname == '\0') { printf("No filename specified, exiting\n"); exit(1); } fp = fopen (outputname, "w+"); fprintf (fp, "\n"); while (1) { fprintf (fp, "\n"); /* * Get line and page info */ printf ("\npage number (-1 to quit)? "); gets (numbuf1); i = strtol (numbuf1, (char **) NULL, 10); /* * If page is -1 quit */ if (i == -1) { printf ("page -1 entered, quitting\n"); fclose (fp); exit (0); } printf ("\nline number? "); gets (numbuf2); printf ("\nSection? (default omitted) "); gets (combuf1); if (!combuf1[0]) strcpy (combuf1, "omitted"); printf ("\nCategory? [Objection|Comment|Editorial] (default Comment) "); gets (combuf2); if (!combuf2[0]) strcpy (combuf2, "Comment"); else if (*combuf2 == 'o' || *combuf2 == 'O') strcpy (combuf2, "Objection"); else if (*combuf2 == 'e' || *combuf2 == 'E') strcpy (combuf2, "Editorial"); printf ("\nOptional reference number? e.g. Sun-1 (default none) "); gets (combuf3); if (!combuf3[0]) strcpy (combuf3, ""); fprintf (fp, "@ Page %s Line %s Section %s %s [%s]\n", numbuf1, numbuf2, combuf1, combuf2, combuf3); fprintf (fp, "\nProblem:\n"); printf ("\nProblem statement:\n\n"); gets (linebuf); if (strcmp (linebuf, "")) fprintf (fp, "%s\n", linebuf); while (strcmp (linebuf, "")) { gets (linebuf); fprintf (fp, "%s\n", linebuf); } fprintf (fp, "Action:\n"); printf ("\nAction statement:\n\n"); gets (linebuf); if (strcmp (linebuf, "")) fprintf (fp, "%s\n", linebuf); while (strcmp (linebuf, "")) { gets (linebuf); fprintf (fp, "%s\n", linebuf); } } }