karl@mote.umb.edu ("Karl Berry.") (04/18/89)
This is on a Sun 3/60 running 3.4. gcc 1.34. The contents of variables declared inside a block get clobbered when I compile normally, but are all right when I compile with -O. (Apparently they get put in registers.) In particular, the variable `the_fontname' is all right before line 156, which is a call to realloc, but it is garbage afterwards. Other local variables (`was_one') also get clobbered. Following is the compilation, the debugging run showing the problem, and the debugging run showing it working with -O, and the code. Here is the compilation: gcc -g -v -Wall -I../include -c commandline.c -o commandline.o gcc version 1.34 /usr/local/gnu/lib/gcc-cpp -v -I../include -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Wall -D__HAVE_68881__ -Dmc68020 commandline.c /tmp/cca10662.cpp GNU CPP version 1.34 /usr/local/gnu/lib/gcc-cc1 /tmp/cca10662.cpp -quiet -dumpbase commandline.c -g -Wall -version -o /tmp/cca10662.s GNU C version 1.34 (68k, MIT syntax) compiled by GNU C version 1.34. as -mc68020 /tmp/cca10662.s -o commandline.o gcc -o spectrum -L../lib bitmap.o commandline.o dump.o filter.o histogram.o image.o main.o normal.o polar.o postscript.o statistics.o text.o transform.o -lgf -lfont_io -lfft -lkbase -lm mv spectrum ../bin And the debugging run (gdb 3.1): (Actually, I just realized I'm calling realloc with a null pointer. But that does not affect the problem; a call to malloc will cause the same problems. (I am actually calling a routine of my own that calls realloc/malloc and checks the return value, etc., but I thought it would cloud the issue somewhat to keep that call. This is the standard Sun realloc, etc.) (gdb) b commandline.c:156 Breakpoint 1 at 0x377c: file commandline.c, line 156. (gdb) r Starting program: /u/ra/zapf/karl/research/bin/spectrum -font hello goodbye Bpt 1, parse_commandline (argc=4, argv=(char **) 0xefff960) (commandline.c line 157) 157 ++total_bitmap_count * sizeof(text_type)); (gdb) p the_fontname $1 = (char *) 0x26a98 "hello" (gdb) n 159 text_list[total_bitmap_count-1].fontname = the_fontname; (gdb) p the_fontname $2 = (char *) 0x3798 "#\300" (gdb) p &the_fontname $3 = (char **) 0xefff900 (gdb) q Now, when I compile with -O, I get the following under gdb. Apparently those local variables have been put in registers. Reading symbol data from /u/ra/zapf/karl/research/bin/spectrum...done. (gdb) b commandline.c:156 Breakpoint 1 at 0x333e: file commandline.c, line 156. (gdb) r Starting program: /u/ra/zapf/karl/research/bin/spectrum -font hello goodbye Bpt 1, parse_commandline (argc=4, argv=(char **) 0xefff960) (commandline.c line 157) 157 ++total_bitmap_count * sizeof(text_type)); (gdb) p the_fontname $1 = (char *) 0x26a98 "hello" (gdb) p &$ Attempt to take address of value not located in memory. (gdb) n 159 text_list[total_bitmap_count-1].fontname = the_fontname; (gdb) p the_fontname $2 = (char *) 0x26a98 "hello" (gdb) q And here is the (somewhat lengthy) procedure. The problem line is around line 1320 of this file (after gcc -E). # 1 "commandline.c" # 1 "bitmap.h" # 1 "../include/types.h" typedef unsigned char one_byte; typedef char signed_byte; typedef unsigned short two_bytes; typedef short signed_2_bytes; typedef unsigned int four_bytes; typedef int signed_4_bytes; typedef int byte_count_type; typedef double real; typedef long int scaled; typedef long int fix_word; typedef struct { real real, imag; } complex; typedef int file_descriptor_type; typedef void* address; typedef char* string; typedef enum {false=0, true=1} boolean; typedef struct { unsigned height, width; } dimensions_type; typedef struct { unsigned x, y; } coordinate_type; typedef enum { first_complex_part, second_complex_part } complex_part_type; typedef enum { polar_rep, rectangular_rep } complex_rep_type; # 7 "bitmap.h" typedef struct { dimensions_type dimensions; one_byte* bitmap; } bitmap_type; extern unsigned total_bitmap_count; extern bitmap_type new_bitmap(dimensions_type dimensions); # 4 "commandline.c" # 1 "commandline.h" extern void parse_commandline(int, char**); # 5 "commandline.c" # 1 "dump.h" # 1 "statistics.h" # 1 "../include/types.h" # 45 "../include/types.h" # 4 "statistics.h" typedef struct{ real mean, variance; } statistics_type; extern boolean wants_statistics; extern statistics_type statistics(real*, dimensions_type); # 7 "dump.h" # 1 "text.h" # 1 "bitmap.h" # 43 "bitmap.h" # 7 "text.h" # 1 "../include/types.h" # 45 "../include/types.h" # 8 "text.h" typedef struct { string text; string fontname; } text_type; extern text_type* text_list; extern boolean wants_guillotining; extern unsigned random_string_length; extern char* random_text_file; extern void add_text(text_type text); extern text_type get_text(unsigned index); extern bitmap_type text_to_bitmap(text_type, dimensions_type max_dimensions); # 8 "dump.h" # 1 "../include/types.h" # 45 "../include/types.h" # 9 "dump.h" extern boolean wants_dump; extern string dump_font; extern string dump_text_filename; extern unsigned dump_text_length; extern void dump(real*, statistics_type, text_type, complex_part_type); # 6 "commandline.c" # 1 "filter.h" # 1 "../include/types.h" # 45 "../include/types.h" # 4 "filter.h" typedef enum { none, any, low_pass, high_pass, band_pass, low_pass_cross, high_pass_cross } filter_class; typedef struct { filter_class class; union{ unsigned cutoff; struct { unsigned cutoff; unsigned width; } cross; struct { unsigned outer, inner; } band; } data; } filter_type; extern filter_type the_filter; extern boolean wants_filter; extern unsigned filter( ); extern filter_type opposite_filter( ); # 7 "commandline.c" # 1 "../include/global.h" # 1 "/usr/local/gnu/lib/gcc-include/assert.h" void __eprintf (); # 7 "../include/global.h" # 1 "/usr/include/ctype.h" extern char _ctype_[]; # 8 "../include/global.h" # 1 "/usr/include/math.h" extern int errno, signgam; extern double fmod(), gamma(); extern int matherr(); extern double asinh(), acosh(), atanh(); extern double erf(), erfc(); extern double exp(), expm1(), log(), log10(), log1p(), pow(); extern double fabs(), floor(), ceil(), rint(); extern double lgamma(); extern double hypot(), cabs(); extern double copysign(), drem(), logb(), scalb(); extern int finite(); extern double j0(), j1(), jn(), y0(), y1(), yn(); extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2(); extern double sinh(), cosh(), tanh(); extern double cbrt(), sqrt(); extern double modf(), ldexp(), frexp(), atof(); # 55 "/usr/include/math.h" struct exception { int type; char *name; double arg1; double arg2; double retval; }; # 9 "../include/global.h" # 1 "/usr/include/stdio.h" extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; int _bufsiz; short _flag; char _file; } _iob[]; extern struct _iobuf *fopen(); extern struct _iobuf *fdopen(); extern struct _iobuf *freopen(); extern struct _iobuf *popen(); extern struct _iobuf *tmpfile(); extern long ftell(); extern char *fgets(); extern char *gets(); extern char *ctermid(); extern char *cuserid(); extern char *tempnam(); extern char *tmpnam(); # 10 "../include/global.h" # 1 "/usr/include/sys/file.h" # 1 "/usr/include/sys/fcntl.h" struct flock { short l_type; short l_whence; long l_start; long l_len; short l_pid; short l_xxx; }; # 9 "/usr/include/sys/file.h" # 37 "/usr/include/sys/file.h" # 84 "/usr/include/sys/file.h" # 11 "../include/global.h" # 1 "/usr/include/strings.h" char *strcat(); char *strncat(); int strcmp(); int strncmp(); char *strcpy(); char *strncpy(); int strlen(); char *index(); char *rindex(); # 12 "../include/global.h" # 1 "../include/kbase.h" # 1 "../include/types.h" # 45 "../include/types.h" # 7 "../include/kbase.h" extern address allocate(unsigned size); extern address reallocate(address p, unsigned new_size); extern address allocate_array(unsigned width, unsigned height); extern void safe_free(address*); extern void find_bounds(real* values, unsigned value_count, real* the_min, real* the_max); extern real* map_to_unit(real* values, unsigned value_count); extern string substring( ); extern boolean contains( ); extern int pos( ); extern string concat( ); extern string string_copy(string); extern string init_string(); extern void set_string_element( ); extern string *break_string( ); # 1 "../include/bounding_box.h" # 1 "../include/generic.h" # 1 "../include/types.h" # 45 "../include/types.h" # 4 "../include/generic.h" typedef struct { signed_4_bytes max_row, min_row; signed_4_bytes max_col, min_col; } bounding_box_type; typedef struct { one_byte char_code; signed_4_bytes h_escapement; fix_word tfm_width; } character_locator; typedef unsigned char matrix_element_type; typedef matrix_element_type ** matrix_type; typedef unsigned matrix_index_type; typedef struct { four_bytes char_code; matrix_type bitmap; signed_4_bytes h_escapement; fix_word tfm_width; bounding_box_type char_bb; string string_special; scaled * numeric_special; } generic_char_type; # 11 "../include/bounding_box.h" extern bounding_box_type font_bounding_box; extern bounding_box_type find_cartesian_letter_bounding_box(); extern bounding_box_type cartesian_to_matrix_bounding_box(); extern void init_font_bounding_box(); extern void update_font_bounding_box(); extern bounding_box_type get_font_bounding_box(); # 56 "../include/kbase.h" extern void put_byte( ); extern void put_two( ); extern void put_four( ); extern void put_signed_four( ); extern void put_n_bytes( ); extern one_byte get_byte(); extern two_bytes get_two(); extern four_bytes get_four(); extern signed_4_bytes get_signed_four(); extern address get_n_bytes( ); extern four_bytes get_n_byte_value( ); extern one_byte get_previous_byte(); extern two_bytes get_previous_two(); extern four_bytes get_previous_four(); extern void match_byte( ); extern void match_previous_byte( ); extern void move_to_byte( ); extern four_bytes cur_pos(); extern real fix_to_real( ); extern fix_word real_to_fix( ); extern void print_scaled( ); extern real scaled_to_real( ); extern scaled real_to_scaled( ); # 14 "../include/global.h" # 1 "../include/types.h" # 45 "../include/types.h" # 15 "../include/global.h" extern int write(), read(), open(), lseek(), tell(), abs(), fprintf(), atoi(); extern int fread(), fwrite(), fseek(), fclose(), rename(), _filbuf(); extern int fscanf(); extern long time(); extern void close(), fflush(), perror(); extern void sprintf(), printf(), ungetc(), sscanf(); extern void free(), malloc_debug(int); extern address malloc(unsigned size), realloc(address, unsigned); extern string strchr(), strrchr(), ctime(); extern double atof(); extern volatile void exit(), abort(); typedef char allocated_string[ 128 ]; typedef short side_bearings_value_type; typedef struct side_bearings_structure{ side_bearings_value_type left; side_bearings_value_type right; } side_bearings_type; typedef unsigned char ascii_value_type; typedef unsigned char direction_and_degree_type; typedef unsigned short direction_and_length_type; typedef short segment_point_value_type; typedef struct { segment_point_value_type x; segment_point_value_type y; } segment_point_type; typedef struct { int x; int y; } change_in_type; typedef double scale_factor_type; # 8 "commandline.c" # 1 "histogram.h" # 1 "../include/types.h" # 45 "../include/types.h" # 4 "histogram.h" typedef struct { unsigned bucket_count; real* data; } histogram_type; extern unsigned percent_to_truncate; extern unsigned bucket_count; extern boolean wants_equalization; extern histogram_type histogram( ); # 9 "commandline.c" # 1 "image.h" # 1 "bitmap.h" # 43 "bitmap.h" # 7 "image.h" # 1 "../include/types.h" # 45 "../include/types.h" # 8 "image.h" extern boolean wants_image; extern string* image_filename; extern bitmap_type image(string filename, dimensions_type); # 10 "commandline.c" # 1 "main.h" # 1 "../include/types.h" # 45 "../include/types.h" # 7 "main.h" extern boolean verbose; extern boolean wants_first_part; extern boolean wants_second_part; extern boolean saving_for_later; extern boolean wants_both_parts; extern dimensions_type sample_dimensions; # 11 "commandline.c" # 1 "polar.h" # 1 "../include/types.h" # 45 "../include/types.h" # 7 "polar.h" # 1 "transform.h" # 1 "bitmap.h" # 43 "bitmap.h" # 7 "transform.h" # 1 "../include/types.h" # 45 "../include/types.h" # 8 "transform.h" typedef struct { unsigned pertinent_count; dimensions_type dimensions; complex_rep_type complex_rep; real* the_first_part; real* the_second_part; } transform_type; extern boolean wants_rectangular; extern boolean wants_back_transform; extern transform_type new_transform( ); extern transform_type forward_transform( ); extern bitmap_type back_transform( ); extern string part_name(transform_type transform, complex_part_type part); # 8 "polar.h" extern boolean wants_polar; extern real highest_amplitude_mark; extern real highest_phase_mark; extern void polarize(transform_type*); extern void init_marks(real* highest_amplitude_mark, real* highest_phase_mark, filter_type the_filter, unsigned bucket_count); # 12 "commandline.c" # 1 "postscript.h" # 1 "bitmap.h" # 43 "bitmap.h" # 7 "postscript.h" # 1 "histogram.h" # 17 "histogram.h" # 8 "postscript.h" # 1 "statistics.h" # 14 "statistics.h" # 9 "postscript.h" # 1 "text.h" # 27 "text.h" # 10 "postscript.h" # 1 "../include/types.h" # 45 "../include/types.h" # 11 "postscript.h" extern boolean wants_postscript; extern boolean prepend_prologue; extern string page_title; extern boolean wants_grayscale; extern void start_postscript_output(); extern void post_it(real*, dimensions_type, statistics_type, string); extern void post_histogram(histogram_type, real high_mark, unsigned cutoff); extern void post_legends(text_type, bitmap_type, dimensions_type); extern void finish_postscript_output(boolean wants_grayscale); # 13 "commandline.c" # 1 "text.h" # 27 "text.h" # 14 "commandline.c" # 52 "commandline.c" void parse_commandline(int argc, string argv[]) { static int this_arg; if (argc <= 1 ) { fprintf((&_iob[2]) ,"Usage: %s <arguments>.\n", argv[0]); fprintf((&_iob[2]) , "Input text string is on standard input by default.\nOther options:\n\t-H <size> set the number of samples in horizontal window to <size>.\n\t-W <size> set the number of samples in vertical window to <size>.\n\t-bitmap <font><text > (can specify more than one pair) use these pairs.\n\t-dump <integer><font> use <integer> random strings ``set'' in font <font>.\n\t-dump-text <filename> use random strings from file <filename>. \n\t-dump-text-length <integer> make the random strings <i nteger> long. \n\t-f-lowpass <integer> do a low pass filter; <integer> is taken as the\n\t percentage of samples in each direction above which to zero.\n\t-f-highpass <integer> is like -f-lowpass, but does a high pass filter.\n\t-f-lowcross <integer> <i nteger> does a low pass cross filter; the first\n\t <integer> is taken as the percentage of samples in each direction\n\t that are within the crossbar lengths; the second <integer> is the\n\t percentage of samples that are within the crossbar widths . exit(1); } for (this_arg = 1; this_arg < argc; this_arg++) { if (*argv[this_arg] == '-') { argv[this_arg]++; if ((!strcmp(argv[this_arg], "H")) ) { sample_dimensions.height = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "W")) ) { sample_dimensions.width = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "bitmap")) ) { boolean was_one = false; for (this_arg++; this_arg < argc && *argv[this_arg] != '-'; this_arg++) { was_one = true; text_list = (text_type*) reallocate(text_list, ++total_bitmap_count * sizeof(text_type)); text_list[total_bitmap_count - 1] = ((text_type) {string_copy(argv[this_arg]) , (this_arg < argc ? string_copy(argv[++this_arg]) : ({ { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected string)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; (string) 0 ; }) ) } ); } if (! was_one) { fprintf((&_iob[2]) , "\nWarning: %s.\n", "You're missing the arguments to the -bitmap command."); ; } if (this_arg != argc) this_arg--; } else if ((!strcmp(argv[this_arg], "dump")) ) { wants_dump = true; total_bitmap_count = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; dump_font = (this_arg < argc ? string_copy(argv[++this_arg]) : ({ { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected string)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; (string) 0 ; })) ; } else if ((!strcmp(argv[this_arg], "dump-text")) ) { dump_text_filename = (this_arg < argc ? string_copy(argv[++this_arg]) : ({ { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected string)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; (s tring) 0 ; })) ; } else if ((!strcmp(argv[this_arg], "dump-text-length")) ) { dump_text_length = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "f-lowpass")) ) { wants_filter = true; the_filter.class = low_pass; the_filter.data.cutoff = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "f-highpass")) ) { wants_filter = true; the_filter.class = high_pass; the_filter.data.cutoff = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "f-lowcross")) ) { wants_filter = true; the_filter.class = low_pass_cross; the_filter.data.cross.cutoff = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; the_filter.data.cross.width = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "f-highcross")) ) { wants_filter = true; the_filter.class = high_pass_cross; the_filter.data.cross.cutoff = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; the_filter.data.cross.width = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "font")) ) { boolean was_one = false; string the_fontname = (this_arg < argc ? string_copy(argv[++this_arg]) : ({ { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected string)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; (strin g) 0 ; })) ; for (this_arg++; this_arg < argc && *argv[this_arg] != '-'; this_arg++) { was_one = true; text_list = (text_type*) realloc(text_list, ++total_bitmap_count * sizeof(text_type)); text_list[total_bitmap_count-1].fontname = the_fontname; text_list[total_bitmap_count-1].text = string_copy(argv[this_arg]) ; } if (! was_one) { fprintf((&_iob[2]) , "\nWarning: %s.\n", "You're missing the text argument(s) to -font"); ; } if (this_arg != argc) this_arg--; } else if ((!strcmp(argv[this_arg], "h-amplitude-mark")) ) { highest_amplitude_mark = (this_arg < argc ? atof(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected real)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "h-buckets")) ) { bucket_count = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "h-truncate")) ) { percent_to_truncate = (this_arg < argc ? atoi(argv[++this_arg]) : ( { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected integer)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; 0;} )) ; } else if ((!strcmp(argv[this_arg], "image")) ) { boolean was_one = false; wants_image = true; for (this_arg++; this_arg < argc && *argv[this_arg] != '-'; this_arg++) { was_one = true; image_filename = (string*) reallocate(image_filename, ++total_bitmap_count * sizeof(string)); image_filename[total_bitmap_count - 1] = string_copy(argv[this_arg]) ; } if (! was_one) { fprintf((&_iob[2]) , "\nWarning: %s.\n", "You're missing the filename(s) for -image."); ; } if (this_arg != argc) this_arg--; } else if ((!strcmp(argv[this_arg], "no-first")) ) { wants_first_part = false; wants_both_parts = false; } else if ((!strcmp(argv[this_arg], "no-grayscale")) ) { wants_grayscale = false; } else if ((!strcmp(argv[this_arg], "no-postscript")) ) { wants_postscript = false; } else if ((!strcmp(argv[this_arg], "no-second")) ) { wants_second_part = false; wants_both_parts = false; } else if ((!strcmp(argv[this_arg], "rectangular")) ) { wants_rectangular = true; } else if ((!strcmp(argv[this_arg], "text")) ) { boolean was_one = false; string the_text = (this_arg < argc ? string_copy(argv[++this_arg]) : ({ { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected string)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; (string) 0 ; })) ; for (this_arg++; this_arg < argc && *argv[this_arg] != '-'; this_arg++) { was_one = true; text_list = (text_type*) reallocate(text_list, ++total_bitmap_count * sizeof(text_type)); text_list[total_bitmap_count-1].fontname = string_copy(argv[this_arg]) ; text_list[total_bitmap_count-1].text = the_text; } if (! was_one) { fprintf((&_iob[2]) , "\nWarning: %s.\n", "You're missing the font argument(s) to the -text command."); ; } if (this_arg != argc) this_arg--; } else if ((!strcmp(argv[this_arg], "title")) ) { page_title = (this_arg < argc ? string_copy(argv[++this_arg]) : ({ { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "Can't find another argument (expected string)"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; (string) 0 ; })) ; } else if ((!strcmp(argv[this_arg], "verbose")) ) { verbose = true; } } else { {fprintf((&_iob[2]) , "\nWarning: ") ; fprintf((&_iob[2]) , "Ignoring unknown argument `%s'", argv[this_arg]); { fprintf((&_iob[2]) , ".\n"); } ; } ; } } if (total_bitmap_count == 0 && ! wants_image) { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "No image or bitmap to work on"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; } if (text_list != 0 && wants_image) { { fprintf((&_iob[2]) , "\nPanic: ") ; fprintf((&_iob[2]) , "%s", "The bitmaps have to come from either images or fonts, not both"); { fprintf((&_iob[2]) , ".\n"); exit(1); } ; } ; } }