- va_start(ap, format_str); /* ap points to first unnamed argument */
-
- for(format_ptr=format_str; *format_ptr; format_ptr++)
- {
- if (*format_ptr != '%')
- {
- fprintf(output_stream, "%c", *format_ptr);
- continue;
- }
-
- switch(*++format_ptr)
- {
- case 'd':
- i_value = va_arg(ap, int);
- fprintf(output_stream, "%d", i_value);
- break;
-
- case 'f':
- d_value = va_arg(ap, double);
- fprintf(output_stream, "%f", d_value);
- break;
-
- case 's':
- s_value = va_arg(ap, char *);
- fprintf(output_stream, "%s", s_value);
- break;
-
- default:
- fprintf(stderr, "\n%s: Error(): invalid format string: %s\n",
- program_name, format_str);
- CloseAllAndExit(10);
- }
- }
-