< previous page page_91 next page >

Page 91
(continued)
Listing 5.5
   2. This routine does not validate the input date.


   3. This routine assumes that the output space assigned is large enough
      to contain the result. The maximum string length returnable by this
      routine is 12 characters (DD MMM YYYYY), so the minimum safe space
      is 13 characters, to accomodate the string and its null terminator.


   4. The abbreviations used for the months are those provided by the
      routine 'month_name_military', as follow:


      Month Number Abbreviation          Month Number Abbreviation
      ------------ ------------          ------------ ------------
           1          JAN                     7          JUL
           2          FEB                     8          AUG
           3          MAR                     9          SEP
           4          APR                    10          OCT
           5          MAY                    11          NOV
           6          JUN                    12          DEC
*/
#include <stdio.h>
#include "scdtl_2.h"


void format_date_military (struct DATE_INFO *d, char *s)
{
   int year, month, day;


   year = d->year;
   month = d->month;
   day = d->day;


   s [0] = '\0';


   sprintf (s, "%02d %s %d", day, month_name_military (month), year);


   return;
}




 
< previous page page_91 next page >