home *** CD-ROM | disk | FTP | other *** search
- static char version[] = VERSION;
- /*
- #
- # pform version 1.0 - ascii to postscript converter
- # copyright 1994 - Steven Weintraub
- #
- # This program is created and distribed by Steven Weintraub. It is
- # public domain code, and can be freely distributed without permission
- # as long as this head is retained in all files it appears
- #
- */
- #include "pform.h"
-
- /* This file has some utilities programs for pform. These are :
-
- p_error - output an error message, also te usage message if desired
- p_directions - printout the -? output
- casecmp - case insenstive strcmp
-
- */
-
- /***************************************************************************/
- /* This routine prints out error messages. It alsoprints a usage message if
- requested, and exits if fatal */
-
- void p_error(int fatal,int print_usage,char *format,...)
- {
- va_list args;
- char **usage_ptr;
-
- if (!quiet)
- {
- fprintf(stderr,"%s : ",program);
- if (line_number || dot_lines)
- fprintf(stderr,"Line %d : ",line_number + dot_lines);
- va_start(args,format);
- vfprintf(stderr,format,args);
- va_end(args);
- putc('\n',stderr);
- if (print_usage)
- {
- putc('\n',stderr);
- fprintf(stderr,usage[0],program);
- for (usage_ptr = usage + 1;*usage_ptr;usage_ptr++)
- fprintf(stderr,"%s\n",*usage_ptr);
- fprintf(stderr,"\nUse '%s -?' for more details\n",program);
- }
- }
- if (fatal)
- exit(1);
- }
-
- /* This routine prints the directions to the -? arguement. It first prints
- the usage - the the arguement info - etc. */
-
- void p_directions(void)
- {
- int count = 0;
- char **font_ptr;
- char **usage_ptr;
-
- printf("%s\n\n",version);
- if (!quiet)
- {
- /* print off the first usage value */
- printf(usage[0],program);
- /* print off the rest of the usage string */
- for (usage_ptr = usage + 1;*usage_ptr;usage_ptr++)
- printf("%s\n",*usage_ptr);
- printf("\n");
- /* print the rest of the directions (stored behind the null in usage array) */
- for (usage_ptr++;*usage_ptr;usage_ptr++)
- printf("%s\n",*usage_ptr);
- printf("\n");
- /* print off the defautls */
- #ifdef PRINTER
- printf("Default output goes to the %s printer\n\n",PRINTER);
- #else
- #ifdef DEFAULT_PRINTER_COMMAND
- printf("Default output goes to the default printer\n\n");
- #else
- printf("Default output goes to standard output\n\n");
- #endif /* DEFAULT_PRINTER_COMMAND */
- #endif /* PRINTER */
- #ifdef BLANK_PAGE
- printf("Default output prints a blank page\n\n");
- #else
- printf("Default is output does not start with a blank page\n\n");
- #endif /* BLANK_PAGE */
- /* printf off the font table */
- printf("Valid fonts are :\n\n");
- for (font_ptr = fonts;*font_ptr;font_ptr++)
- {
- printf("%-25s",*font_ptr);
- if (++count == 3)
- {
- printf("\n");
- count = 0;
- }
- }
- }
- printf("\n");
- exit(1);
- }
-
- /* same as strcmp only case insensitive */
-
- int casecmp(char *str1,char *str2)
- {
- for (;*str1 && *str2 && tolower(*str1) == tolower(*str2);str1++,str2++)
- ;
- return(*str1 - *str2);
- }
-