freesweep-0.90/clear.c0100640002255600003100000002675107600422634014425 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: clear.c,v 1.11 2002/07/12 07:06:44 hartmann Exp $ * * **********************************************************************/ #include #include #include "sweep.h" static void InsertChildren(struct Mark **ht, GameStats *Game, int x, int y); static int CalcSquareNumber(GameStats *Game, int xx, int yy); static int ExposeSquare(GameStats *Game, int xx, int yy, int total); static unsigned char* InitLookupTable(void); static struct Mark* NewMark(int x, int y); static int SuperCount(GameStats* Game); /* I should clean these up */ int g_num = 0; unsigned char *g_table = NULL; int g_table_w; int g_table_h = 0; struct Mark *g_mlist = NULL; void Clear(GameStats *Game) { struct Mark **ht = NULL; int total; int x, y; g_num = 0; g_table = InitLookupTable(); /* give it the first candidate */ InsertMark(ht, Game->CursorX, Game->CursorY); /* This is data recursion */ while(DeleteRandomMark(ht, &x, &y) == TRUE) { total = CalcSquareNumber(Game, x, y); if (ExposeSquare(Game, x, y, total) == EMPTY) { InsertChildren(ht, Game, x, y); } } free (g_table); } /* grab the eight or so children around the mark and insert them into the * hash table */ void InsertChildren(struct Mark **ht, GameStats *Game, int x, int y) { unsigned char retval; /* Check the above squares */ if (y-1 >= 0) { /* Check upper-left */ if (x-1 >= 0) { GetMine(x-1, y-1, retval); if (retval == UNKNOWN) { InsertMark(ht, x-1, y-1); } } /* Check directly above */ GetMine(x, y-1, retval); if (retval == UNKNOWN) { InsertMark(ht, x, y-1); } /* Check upper-right */ if (x+1 < Game->Width) { GetMine(x+1, y-1, retval); if (retval == UNKNOWN) { InsertMark(ht, x+1, y-1); } } } if (x-1 >= 0) { GetMine(x-1, y, retval); if (retval == UNKNOWN) { InsertMark(ht, x-1, y); } } if (x+1 < Game->Width) { GetMine(x+1, y, retval); if (retval == UNKNOWN) { InsertMark(ht, x+1, y); } } /* Check the below squares */ if (y+1 < Game->Height) { /* Check lower-left */ if (x-1 >= 0) { GetMine(x-1, y+1, retval); if (retval == UNKNOWN) { InsertMark(ht, x-1, y+1); } } /* Check directly below */ GetMine(x, y+1, retval); if (retval == UNKNOWN) { InsertMark(ht, x, y+1); } /* Check lower-right */ if (x+1 < Game->Width) { GetMine(x+1, y+1, retval); if (retval == UNKNOWN) { InsertMark(ht, x+1, y+1); } } } } /* determine the number of a particular square */ int CalcSquareNumber(GameStats *Game, int x, int y) { unsigned char SquareVal; int Total=0; GetMine(x,y,SquareVal); if (SquareVal != UNKNOWN) { return SquareVal; } /* Check the above squares */ if (y-1 >= 0) { /* Check upper-left */ if (x-1 >= 0) { GetMine(x-1,y-1,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } } /* Check directly above */ GetMine(x,y-1,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } /* Check upper-right */ if (x+1 < Game->Width) { GetMine(x+1,y-1,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } } } if (x-1 >= 0) { GetMine(x-1,y,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } } if (x+1 < Game->Width) { GetMine(x+1,y,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } } /* Check the below squares */ if (y+1 < Game->Height) { /* Check lower-left */ if (x-1 >= 0) { GetMine(x-1,y+1,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } } /* Check directly below */ GetMine(x,y+1,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } /* Check lower-right */ if (x+1 < Game->Width) { GetMine(x+1,y+1,SquareVal); if ((SquareVal == MINE)||(SquareVal == MARKED)||(SquareVal == DETONATED)) { Total++; } } } return Total; } /* fill in what a square is number wise */ int ExposeSquare(GameStats *Game, int x, int y, int total) { SetMine(x, y, total==0?EMPTY:total); return (total==0?EMPTY:total); } unsigned char* InitLookupTable(void) { int width, height; unsigned char *m = NULL; width = MAX_W / 8; if (MAX_W%8) { width++; } height = MAX_H; if (MAX_W%8) { height++; } m = (unsigned char*)malloc(sizeof(unsigned char) * width * height); if (m == NULL) { SweepError("Out of memory. Aborting..."); exit(EXIT_FAILURE); } g_table_w = width; g_table_h = height; memset(m, 0, width*height); return (m); } /* if x,y exists, do nothing, otherwise, make a mark and insert it */ void InsertMark(struct Mark **ht, int x, int y) { struct Mark *m = NULL; if (LOOKUP(g_table, x, y)) { return; } SET(g_table, x, y); g_num++; m = NewMark(x, y); m->next = g_mlist; g_mlist = m; } /* find one in the table and deal with it */ char DeleteRandomMark(struct Mark **ht, int *xx, int *yy) { struct Mark *m = NULL; m = g_mlist; if (m == NULL) { return FALSE; } g_mlist = g_mlist->next; *xx = m->x; *yy = m->y; UNSET(g_table, *xx, *yy); free(m); return TRUE; } /* make a new mark initialized nicely */ struct Mark* NewMark(int x, int y) { struct Mark *m = NULL; m = (struct Mark*)malloc(sizeof(struct Mark) * 1); if (m == NULL) { SweepError("Out of memory! Sorry."); exit(EXIT_FAILURE); } m->x = x; m->y = y; m->next = NULL; return (m); } void SuperClear(GameStats *Game) { int val; struct Mark **ht = NULL; int total; int x, y; x = Game->CursorX; y = Game->CursorY; val = SuperCount(Game); switch(val) { /* they marked incorrectly, and must now pay the price */ case DIE: /* Boom();*/ Game->Status = LOSE; SetMine(x,y,DETONATED); CharSet.FalseMark='x'; CharSet.Mine='o'; break; /* they marked correctly, and I can expand stuff */ case SUPERCLICK: g_num = 0; g_table = InitLookupTable(); /* insert all the ones around me */ InsertChildren(ht, Game, x, y); /* This is data recursion */ while(DeleteRandomMark(ht, &x, &y) == TRUE) { total = CalcSquareNumber(Game, x, y); if (ExposeSquare(Game, x, y, total) == EMPTY) { InsertChildren(ht, Game, x, y); } } free (g_table); break; case DONOTHING: /* yup, just that */ break; default: break; } } /* calculate if I should superclick, die, or do nothing. */ int SuperCount(GameStats* Game) { unsigned char retval; int MinesFound=0,BadFound=0; int x, y; x = Game->CursorX; y = Game->CursorY; /* Check the above squares */ if (y-1 >= 0) { /* Check upper-left */ if (x-1 >= 0) { GetMine(x-1, y-1, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } } /* Check directly above */ GetMine(x, y-1, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } /* Check upper-right */ if (x+1 < Game->Width) { GetMine(x+1, y-1, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } } } if (x-1 >= 0) { GetMine(x-1, y, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } } if (x+1 < Game->Width) { GetMine(x+1, y, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } } /* Check the below squares */ if (y+1 < Game->Height) { /* Check lower-left */ if (x-1 >= 0) { GetMine(x-1, y+1, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } } /* Check directly below */ GetMine(x, y+1, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } /* Check lower-right */ if (x+1 < Game->Width) { GetMine(x+1, y+1, retval); switch (retval) { case MINE: MinesFound++; break; case BAD_MARK: BadFound++; break; default: break; } } } /* some incorrectly marked mines */ if (BadFound != 0) { return DIE; } /* some correctly marked, some not marked mines */ else if (MinesFound != 0 && BadFound == 0) { return DONOTHING; } /* all mines correctly marked */ else { return SUPERCLICK; } } #define TEST(a,b) if(a>=0 && a< Game->Height && b>=0 && bWidth ) { GetMine(x, y, square) ; if (( square == MINE ) || ( square == UNKNOWN )) { Game->CursorX=a ; Game->CursorY=b ; return 0 ; } } int FindNearest(GameStats *Game) { int x, y; int minx, miny, minscore, score; unsigned char square; x = Game->CursorX; y = Game->CursorY; GetMine(x, y, square); if (( square == MINE ) || ( square == UNKNOWN )) { /* We're *on* an unmarked square already! */ return 0; } /* This should be really, really big. */ /* minscore = ( Game->Width ) * ( Game->Width ) * ( Game->Height ) * ( Game->Height ));*/ /* minscore = MAX_INT;*/ minscore = 0x7ffffff; minx = Game->CursorX; miny = Game->CursorY; for ( x = 0 ; x < Game->Width ; x++ ) { for ( y = 0 ; y < Game->Height ; y++ ) { GetMine(x, y, square); if (( square == MINE ) || ( square == UNKNOWN )) { score = (( Game->CursorX - x ) * ( Game->CursorX - x )) + (( Game->CursorY - y ) * ( Game->CursorY - y )); if ( score < minscore ) { minscore = score; minx = x; miny = y; } } } } Game->CursorX = minx; Game->CursorY = miny; #ifdef DEBUG_LOG fprintf(DebugLog, "Minimum score of %d found at %d,%d\n", minscore, minx, miny); fflush(DebugLog); #endif /* DEBUG_LOG */ return 0; } int FindNearestBad(GameStats *Game) { int x, y; int minx, miny, minscore, score; unsigned char square; x = Game->CursorX; y = Game->CursorY; GetMine(x, y, square); if (( square == BAD_MARK ) || ( Game->BadMarkedMines == 0 )) { /* We're done here. */ return 0; } /* This should be really, really big. */ /* minscore = ( Game->Width ) * ( Game->Width ) * ( Game->Height ) * ( Game->Height ));*/ /* minscore = MAX_INT;*/ minscore = 0x7ffffff; minx = Game->CursorX; miny = Game->CursorY; for ( x = 0 ; x < Game->Width ; x++ ) { for ( y = 0 ; y < Game->Height ; y++ ) { GetMine(x, y, square); if ( square == BAD_MARK ) { score = (( Game->CursorX - x ) * ( Game->CursorX - x )) + (( Game->CursorY - y ) * ( Game->CursorY - y )); if ( score < minscore ) { minscore = score; minx = x; miny = y; } } } } Game->CursorX = minx; Game->CursorY = miny; #ifdef DEBUG_LOG fprintf(DebugLog, "Bad mark: minimum score of %d found at %d,%d\n", minscore, minx, miny); fflush(DebugLog); #endif /* DEBUG_LOG */ return 0; } freesweep-0.90/drawing.c0100640002255600003100000005331007603236461014765 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: drawing.c,v 1.24 2002/12/24 05:44:39 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" void StartCurses() { #ifdef SWEEP_MOUSE mmask_t Mask; #endif initscr(); if (has_colors()) { start_color(); init_pair(1,COLOR_WHITE,COLOR_BLACK); init_pair(2,COLOR_BLUE,COLOR_BLACK); init_pair(3,COLOR_CYAN,COLOR_BLACK); init_pair(4,COLOR_GREEN,COLOR_BLACK); init_pair(5,COLOR_MAGENTA,COLOR_BLACK); init_pair(6,COLOR_RED,COLOR_BLACK); init_pair(7,COLOR_BLACK,COLOR_WHITE); init_pair(8,COLOR_BLUE,COLOR_WHITE); init_pair(9,COLOR_CYAN,COLOR_WHITE); init_pair(10,COLOR_GREEN,COLOR_WHITE); init_pair(11,COLOR_MAGENTA,COLOR_WHITE); init_pair(12,COLOR_RED,COLOR_WHITE); } noecho(); keypad(stdscr, TRUE); intrflush(stdscr, TRUE); cbreak(); nonl(); #ifdef SWEEP_MOUSE Mask=REPORT_MOUSE_POSITION|BUTTON1_CLICKED|BUTTON1_DOUBLE_CLICKED|BUTTON3_CLICKED; Mask=mousemask(Mask,NULL); #endif return; } void PrintInfo() { WINDOW* InfoWin; InfoWin=newwin(6,21,0,(COLS-INFO_W)); wborder(InfoWin,CharSet.VLine,CharSet.VLine,CharSet.HLine,CharSet.HLine, CharSet.ULCorner,CharSet.URCorner,CharSet.LLCorner,CharSet.LRCorner); mvwprintw(InfoWin,1,2,"-=- FreeSweep -=-"); mvwprintw(InfoWin,2,2,"by Gus! & Psilord"); wmove(InfoWin,3,1); whline(InfoWin,CharSet.HLine,19); mvwprintw(InfoWin,4,2,"Hit \'?\' for help"); move(0,0); wnoutrefresh(InfoWin); delwin(InfoWin); return; } void AskPrefs(GameStats* Game) { char ValueBuffer[(L_MAX_W+L_MAX_H+3)]; int Value=0, Status=0, CurrentLine=0; /* User input needs to be echoed to the creen at this point. */ echo(); CurrentLine=0; ValueBuffer[0]=0; /* Ask user for grid height. */ mvprintw(CurrentLine,0,"Enter the grid height [%d]:",Game->Height); while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid entry for Height."); mvclrtoeol(CurrentLine,(26+L_MAX_H)); } #if defined HAVE_LIBNCURSES mvgetnstr(CurrentLine,(26+L_MAX_H),ValueBuffer,L_MAX_H); #else mvgetnstr(CurrentLine,(26+L_MAX_H),ValueBuffer,L_MAX_H+2); #endif /* HAVE_LIBNCURSES */ refresh(); if (ValueBuffer[0]==0) { Status=1; mvprintw(CurrentLine,(26+L_MAX_H),"%d",Game->Height); } else { Value=atoi(ValueBuffer); if (CheckHeight(Value)>0) { Game->Height=Value; Status=1; } else { Status=-1; } } } mvclrtoeol(LINES-1,0); Status=0; ValueBuffer[0]=0; CurrentLine++; /* Now for width. */ mvprintw(CurrentLine,0,"Enter the grid width [%d]:",Game->Width); while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid entry for Width."); mvclrtoeol(CurrentLine,(25+L_MAX_W)); } #if defined HAVE_LIBNCURSES mvgetnstr(CurrentLine,(25+L_MAX_W),ValueBuffer,L_MAX_W); #else mvgetnstr(CurrentLine,(25+L_MAX_W),ValueBuffer,L_MAX_W+2); #endif /* HAVE_LIBNCURSES */ refresh(); if (ValueBuffer[0]==0) { Status=1; mvprintw(CurrentLine,(25+L_MAX_W),"%d",Game->Width); } else { Value=atoi(ValueBuffer); if (CheckWidth(Value)>0) { Game->Width=Value; Status=1; } else { Status=-1; } } } mvclrtoeol(LINES-1,0); Status=0; ValueBuffer[0]=0; CurrentLine++; /* Now for number of mines or percentage. */ mvprintw(CurrentLine,0,"Enter the number or percentage of mines ["); if (Game->NumMines==0) { printw("%d%%]:",Game->Percent); } else { printw("%d]:",Game->NumMines); } while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid entry for Mines."); mvclrtoeol(CurrentLine,(41+L_MAX_H+L_MAX_W)); } #if defined HAVE_LIBNCURSES mvgetnstr(CurrentLine,(41+L_MAX_H+L_MAX_W),ValueBuffer,(L_MAX_H+L_MAX_W)); #else mvgetnstr(CurrentLine,(41+L_MAX_H+L_MAX_W),ValueBuffer,(L_MAX_H+L_MAX_W)+2); #endif /* HAVE_LIBNCURSES */ refresh(); /* If they accept the default. */ if (ValueBuffer[0]==0) { if (Game->NumMines==0) { mvprintw(CurrentLine,(41+L_MAX_H+L_MAX_W),"%d%%",Game->Percent); Status=1; } else { /* Since height and width may have changed, check the */ /* default number of mines to make sure it's still valid. */ if (CheckNumMines(Game->NumMines,Game->Height,Game->Width)>0) { mvprintw(CurrentLine,(41+L_MAX_H+L_MAX_W),"%d",Game->NumMines); Status=1; } else { Status=-1; } } } else { Value=atoi(ValueBuffer); if (strchr(ValueBuffer,'%')==0) { /* The value is an actual number. */ if (CheckNumMines(Value,Game->Height,Game->Width)>0) { Game->NumMines=Value; Game->Percent=0; Status=1; } else { Status=-1; } } else { /* The value is a percent. */ Game->NumMines=0; if (CheckPercent(Value)>0) { Game->Percent=Value; Game->NumMines=0; Status=1; } else { Status=-1; } } } } mvclrtoeol(LINES-1,0); Status=0; ValueBuffer[0]=0; CurrentLine++; /* For the Yes-or-no questions, user input is not echoed. */ noecho(); /* Now for the charater set. */ mvprintw(CurrentLine,0,"Use the PC linedraw character set? ["); if (Game->LineDraw==1) { printw("Y/n]:"); } else { printw("y/N]:"); } while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid entry for character set."); mvclrtoeol(CurrentLine,42); } ValueBuffer[0]=mvgetch(CurrentLine,42); refresh(); switch (ValueBuffer[0]) { case '\n': case '\r': Status=1; if (Game->LineDraw==1) { mvprintw(CurrentLine,42,"Yes"); } else { mvprintw(CurrentLine,42,"No"); } break; case 'n': case 'N': Value=0; mvprintw(CurrentLine,42,"No"); InitCharSet(Game,Value); Status=1; break; case 'y': case 'Y': Value=1; mvprintw(CurrentLine,42,"Yes"); InitCharSet(Game,Value); Status=1; break; default: #ifdef DEBUG_LOG fprintf(DebugLog, "Unknown character: %c\n", ValueBuffer[0]); #endif Status=-1; break; } } mvclrtoeol(LINES-1,0); Status=0; ValueBuffer[0]=0; CurrentLine++; /* Now for the default starting behavior. */ mvprintw(CurrentLine,0,"Use FastStart mode for new games? ["); if (Game->Fast>=1) { printw("Y/n]:"); } else { printw("y/N]:"); } while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid entry for FastStart mode."); mvclrtoeol(CurrentLine,41); } ValueBuffer[0]=mvgetch(CurrentLine,41); refresh(); switch(ValueBuffer[0]) { case '\n': case '\r': Status=1; if (Game->Fast==1) { mvprintw(CurrentLine,41,"Yes"); } else { mvprintw(CurrentLine,41,"No"); } break; case 'n': case 'N': Game->Fast=0; mvprintw(CurrentLine,41,"No"); Status=1; break; case 'y': case 'Y': Game->Fast=1; mvprintw(CurrentLine,41,"Yes"); Status=1; break; default: #ifdef DEBUG_LOG fprintf(DebugLog, "Unknown character: %c\n", ValueBuffer[0]); #endif Status=-1; break; } } mvclrtoeol(LINES-1,0); Status=0; ValueBuffer[0]=0; CurrentLine++; /* Now ask about the alert prefs. */ mvprintw(CurrentLine,0,"Use Beep/Flash/No alert? ["); switch (Game->Alert) { case BEEP: default: printw("B/f/n]:"); break; case FLASH: printw("b/F/n]:"); break; case NO_ALERT: printw("b/f/N]:"); break; } while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid entry for Alert mode."); mvclrtoeol(CurrentLine,41); } ValueBuffer[0]=mvgetch(CurrentLine,34); refresh(); switch(ValueBuffer[0]) { case '\n': case '\r': Status=1; switch (Game->Alert) { case BEEP: default: mvprintw(CurrentLine,34,"Beep"); break; case FLASH: mvprintw(CurrentLine,34,"Flash"); break; case NO_ALERT: mvprintw(CurrentLine,34,"None"); break; } break; case 'b': case 'B': Game->Alert=BEEP; mvprintw(CurrentLine,34,"Beep"); Status=1; break; case 'f': case 'F': Game->Alert=FLASH; mvprintw(CurrentLine,34,"Flash"); Status=1; break; case 'n': case 'N': Game->Alert=NO_ALERT; mvprintw(CurrentLine,34,"None"); Status=1; break; default: #ifdef DEBUG_LOG fprintf(DebugLog, "Unknown character: %c\n", ValueBuffer[0]); #endif Status=-1; break; } } mvclrtoeol(LINES-1,0); Status=0; ValueBuffer[0]=0; CurrentLine++; /* Ask about color. */ mvprintw(CurrentLine,0,"Use Color if available? ["); if (Game->Color>=1) { printw("Y/n]:"); } else { printw("y/N]:"); } while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid entry for Color mode."); mvclrtoeol(CurrentLine,31); } ValueBuffer[0]=mvgetch(CurrentLine,31); refresh(); switch(ValueBuffer[0]) { case '\n': case '\r': Status=1; if (Game->Color==1) { mvprintw(CurrentLine,31,"Yes"); } else { mvprintw(CurrentLine,31,"No"); } break; case 'n': case 'N': Game->Color=0; mvprintw(CurrentLine,31,"No"); Status=1; break; case 'y': case 'Y': Game->Color=1; mvprintw(CurrentLine,31,"Yes"); Status=1; break; default: #ifdef DEBUG_LOG fprintf(DebugLog, "Unknown character: %c\n", ValueBuffer[0]); #endif Status=-1; break; } } mvclrtoeol(LINES-1,0); Status=0; ValueBuffer[0]=0; CurrentLine++; /* Ask about saving these prefs. */ mvprintw(CurrentLine,0,"Save these preferences? [Y/n]:"); while (Status<=0) { if (Status<0) { beep(); mvprintw(LINES-1,0,"Invalid response for saving preferences."); mvclrtoeol(CurrentLine,31); } ValueBuffer[0]=mvgetch(CurrentLine,31); refresh(); switch (ValueBuffer[0]) { case '\n': case '\r': Status=1; mvprintw(CurrentLine,31,"Yes"); WritePrefsFile(Game); break; case 'n': case 'N': mvprintw(CurrentLine,31,"No"); Status=1; break; case 'y': case 'Y': mvprintw(CurrentLine,31,"Yes"); WritePrefsFile(Game); Status=1; break; default: #ifdef DEBUG_LOG fprintf(DebugLog, "Unknown character: %c\n", ValueBuffer[0]); #endif Status=-1; } } mvclrtoeol(LINES-1,0); /* Do one last refresh. */ refresh(); return; } void Help() { WINDOW* HelpWin; int Input=0, CurrentLine=0, LinesLeft=0, CurrentY=0; #define HELP_MESSAGES 13 char* Messages[]= { "Arrow keys and vi-style movement keys move the cursor.", "The space bar exposes a square.", "\'f\' flags a space as a mine.", "\'r\' redraws the screen.", "\'0\' moves the cursor to the upper left corner.", "\'$\' moves the cursor to the lower right corner.", "\'c\' centers the cursor.", "\'.\' repeats the last command.", "\'a\' toggles the character set.", "\'b\' toggles the color settings.", "\'?\' displays this help screen.", "\'g\' displays the GNU General Public License.", "\'n\' starts a new game.", "\'x\' prompts for new game parameters.", "\'q\' quits the game.", "Any non-zero number multiplies the next action." }; if ((HelpWin=newwin(0,0,0,0))==NULL) { perror("Help::newwin"); exit(EXIT_FAILURE); } wborder(HelpWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark); mvwprintw(HelpWin,1,2,"Time out - Freesweep Help"); mvwhline(HelpWin,2,1,CharSet.HLine,COLS-2); mvwprintw(HelpWin,3,2,"Useful Keys:"); mvwprintw(HelpWin,LINES-1,1,"--Press \'q\' to quit, space for more, any other key to continue.--"); /* Be sure to update this to account for all of the error messages. */ LinesLeft=HELP_MESSAGES; while (LinesLeft> (LINES - 6)) { CurrentY=4; while (CurrentY< (LINES -2 )) { mvwprintw(HelpWin,CurrentY++,8,Messages[CurrentLine++]); LinesLeft--; } /* Now get a keystroke to continue. */ wmove(HelpWin,0,0); wrefresh(HelpWin); Input=wgetch(HelpWin); switch (Input) { case 'q': clear(); refresh(); endwin(); exit(EXIT_SUCCESS); break; case ' ': wmove(HelpWin,3,0); wclrtobot(HelpWin); wborder(HelpWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark); mvwprintw(HelpWin,LINES-1,1,"--Press \'q\' to quit, space for more, any other key to continue.--"); wrefresh(HelpWin); break; default: wclear(HelpWin); delwin(HelpWin); clear(); noutrefresh(); return; break; } } /* Now print the last few lines */ wborder(HelpWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark); mvwprintw(HelpWin,LINES-1,1,"--Press \'q\' to quit, or any other key to continue.--"); CurrentY=4; while (LinesLeft > 0) { mvwprintw(HelpWin,CurrentY++,8,Messages[CurrentLine++]); LinesLeft--; } wmove(HelpWin,0,0); wrefresh(HelpWin); Input=wgetch(HelpWin); switch (Input) { case 'q': clear(); refresh(); endwin(); exit(EXIT_SUCCESS); break; default: wclear(HelpWin); delwin(HelpWin); clear(); noutrefresh(); return; break; } return; } int DrawBoard(GameStats* Game) { int CoordX=0, CoordY=0, HViewable=0, VViewable=0; unsigned char CellVal; VViewable=((Game->LargeBoardY!=0)?(LINES-6):(Game->Height)); HViewable=((Game->LargeBoardX!=0)?((COLS-INFO_W-2)/3):(Game->Width)); for (CoordY=Game->FocusY;CoordY<(Game->FocusY+VViewable);CoordY++) { for (CoordX=Game->FocusX;CoordX<(Game->FocusX+HViewable);CoordX++) { wmove(Game->Board,(CoordY-Game->FocusY),3*(CoordX-Game->FocusX)+1); CellVal=0; GetMine(CoordX,CoordY,CellVal); switch (CellVal) { case UNKNOWN: waddch(Game->Board,'-'); break; case EMPTY: waddch(Game->Board,CharSet.Space); break; case 1: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,2,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case 2: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,3,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case 3: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,4,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case 4: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,5,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case 5: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,6,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case 6: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,6,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case 7: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,6,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case 8: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,5,NULL); } waddch(Game->Board,(CellVal)+'0'); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; case MINE: waddch(Game->Board,CharSet.Mine); break; case MARKED: waddch(Game->Board,CharSet.Mark); break; case BAD_MARK: waddch(Game->Board,CharSet.FalseMark); break; case DETONATED: if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,6,NULL); } waddch(Game->Board,CharSet.Bombed); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(Game->Board,1,NULL); } break; default: break; } } } wmove(Game->Board,0,0); wnoutrefresh(Game->Board); return 0; } /* PrintBestTimes() opens each entry in a new window, BestTimesWin, which is deleted afterwards. */ void PrintBestTimes(char* Filename) { int Input=0; WINDOW* BestTimesWin; if ((BestTimesWin=newwin(0,0,0,0))==NULL) { perror("PrintHighs::AllocWin"); exit(EXIT_FAILURE); } nodelay(BestTimesWin,FALSE); wborder(BestTimesWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark); mvwprintw(BestTimesWin,1,2,"Best times"); mvwhline(BestTimesWin,2,1,CharSet.HLine,COLS-2); mvwprintw(BestTimesWin,3,4,"Username"); mvwhline(BestTimesWin,4,4,CharSet.HLine,8); mvwprintw(BestTimesWin,3,15,"Height"); mvwhline(BestTimesWin,4,15,CharSet.HLine,6); mvwprintw(BestTimesWin,3,25,"Width"); mvwhline(BestTimesWin,4,25,CharSet.HLine,5); mvwprintw(BestTimesWin,3,34,"Mines"); mvwhline(BestTimesWin,4,33,CharSet.HLine,7); mvwprintw(BestTimesWin,3,44,"Time"); mvwhline(BestTimesWin,4,42,CharSet.HLine,9); mvwprintw(BestTimesWin,3,62,"Date"); mvwhline(BestTimesWin,4,54,CharSet.HLine,24); mvwprintw(BestTimesWin,LINES-1,1,"--Press \'q\' to quit, any other key to continue.--"); wmove(BestTimesWin,0,0); wrefresh(BestTimesWin); Input=wgetch(BestTimesWin); #ifdef DEBUG_LOG fprintf(DebugLog, "Leaving Bets Times view with %c\n", Input); fflush(DebugLog); #endif /* DEBUG_LOG */ if (Input=='q') { clear(); refresh(); endwin(); exit(EXIT_SUCCESS); } else { wclear(BestTimesWin); delwin(BestTimesWin); clear(); noutrefresh(); } return; } void DrawCursor(GameStats* Game) { mvwaddch(Game->Board,(Game->CursorY-Game->FocusY),(3*(Game->CursorX-Game->FocusX)),'<'); mvwaddch(Game->Board,(Game->CursorY-Game->FocusY),(3*(Game->CursorX-Game->FocusX))+2,'>'); move(0,0); return; } void UndrawCursor(GameStats* Game) { /* mvwaddch(Game->Board,Game->CursorY,(3*Game->CursorX),' ');*/ /* mvwaddch(Game->Board,Game->CursorY,(3*Game->CursorX)+2,' ');*/ mvwaddch(Game->Board,(Game->CursorY-Game->FocusY),(3*(Game->CursorX-Game->FocusX)),' '); mvwaddch(Game->Board,(Game->CursorY-Game->FocusY),(3*(Game->CursorX-Game->FocusX))+2,' '); move(0,0); return; } /* Pan() is respondsible for keeping the relevant part of the board displayed. In addition, it also draws the border, including doing any "arrows" to indicate that part of the board is not presently displayed. The panning itself it triggered when the cursor gets within two squares of the edge of the currently displayed area. */ int Pan(GameStats* Game) { chtype Right,Left,Top,Bottom; int VViewable=0, HViewable=0; Right=Left=CharSet.VLine; Top=Bottom=CharSet.HLine; /* The basic border needs to be drawn regardless. */ /* If the board isn't larger than the screen, no need to pan. */ if ((Game->LargeBoardX + Game->LargeBoardY) == 0) { wborder(Game->Border,CharSet.VLine,CharSet.VLine,CharSet.HLine,CharSet.HLine,CharSet.ULCorner,CharSet.URCorner,CharSet.LLCorner,CharSet.LRCorner); wnoutrefresh(Game->Border); return 0; } /* Now to figure out which way to go... */ VViewable=(LINES-6); HViewable=((COLS-INFO_W-2)/3)-1; /* See if the current cursor is even in the focus. */ if ((Game->CursorY < Game->FocusY) || ((Game->FocusY+VViewable) < Game->CursorY) || ((Game->CursorY-Game->FocusY) < 2) || (((Game->FocusY+VViewable)-Game->CursorY) <= 2)) { CenterY(Game); } if ((Game->CursorX < Game->FocusX) || ((Game->FocusX+HViewable) < Game->CursorX) || ((Game->CursorX-Game->FocusX) < 2) || (((Game->FocusX+HViewable)-Game->CursorX) < 2)) { CenterX(Game); } /* Then draw the borders. */ if (Game->LargeBoardX) { /* Check to see if the left side needs to be an arrow boundary. */ if (Game->FocusX>0) { Left=CharSet.LArrow; } /* Check to see if the right side needs to be an arrow boundary. */ if ((Game->FocusX + ((COLS-INFO_W-2)/3) ) < Game->Width ) { Right=CharSet.RArrow; } } if (Game->LargeBoardY) { /* Check to see if the top side needs to be an arrow boundary. */ if (Game->FocusY>0) { Top=CharSet.UArrow; } /* Check to see if the bottom side needs to be an arrow boundary. */ if ((Game->FocusY + (LINES-6)) < Game->Height ) { Bottom=CharSet.DArrow; } } wborder(Game->Border,Left,Right,Top,Bottom,CharSet.ULCorner,CharSet.URCorner,CharSet.LLCorner,CharSet.LRCorner); wnoutrefresh(Game->Border); return 0; } int Center(GameStats* Game) { CenterX(Game); CenterY(Game); return 0; } int CenterX(GameStats* Game) { int HOffset=0; if (Game->LargeBoardX) { HOffset=(((COLS-INFO_W-2)/3)-1)/2; if (Game->CursorX > (Game->Width - HOffset)) { Game->FocusX=(Game->Width-(2*HOffset)-1); } else if ((Game->CursorX - HOffset) >= 0) { Game->FocusX=(Game->CursorX-HOffset); } else { Game->FocusX=0; } } return 0; } int CenterY(GameStats* Game) { int VOffset=0; if (Game->LargeBoardY) { VOffset=(LINES-6)/2; if (Game->CursorY > (Game->Height - VOffset)) { Game->FocusY=(Game->Height - (LINES-6)); } else if ((Game->CursorY - VOffset) >= 0) { Game->FocusY = (Game->CursorY - VOffset); } else { Game->FocusY=0; } } return 0; } freesweep-0.90/error.c0100640002255600003100000000574707600422634014472 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: error.c,v 1.8 2000/11/07 05:34:17 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" static WINDOW* ErrFrame; static WINDOW* ErrWin; /* Although the alert preference is set by the user, SweepAlert() needs to not take an argument. So it gets set into a static variable. Gross, but effective. */ static int ErrAlert; /* SweepError() is the method for putting erros into the console window at the bottom of the screen. Passing a null pointer as the message will invoke a call to ClearError(). */ void SweepError(char* format, ...) { char NewErrMsg[42]; va_list args; if (format==NULL) { ClearError(); } else { ClearError(); va_start(args, format); #if defined HAVE_VSNPRINTF vsnprintf(NewErrMsg,41,format,args); #elif HAVE_VSPRINTF vsprintf(NewErrMsg,format,args); #else #error "Need either vsnprintf() (preferred) or vsprintf()" #endif va_end(args); mvwprintw(ErrWin,0,0,NewErrMsg); SweepAlert(); } wnoutrefresh(ErrWin); move(0,0); noutrefresh(); return; } int InitErrorWin(GameStats* Game) { if ((ErrFrame=newwin(3,42,LINES-4,(COLS/2)-21))==NULL) { return 1; } else if ((ErrWin=derwin(ErrFrame,1,40,1,1))==NULL) { return 1; } wborder(ErrFrame,CharSet.VLine,CharSet.VLine,CharSet.HLine,CharSet.HLine, CharSet.ULCorner, CharSet.URCorner,CharSet.LLCorner,CharSet.LRCorner); wnoutrefresh(ErrWin); wnoutrefresh(ErrFrame); ErrAlert=Game->Alert; return 0; } void ClearError() { wmove(ErrWin,0,0); wclrtoeol(ErrWin); wnoutrefresh(ErrWin); move(0,0); noutrefresh(); return; } int RedrawErrorWin() { return ((wborder(ErrFrame,CharSet.VLine,CharSet.VLine,CharSet.HLine, CharSet.HLine,CharSet.ULCorner,CharSet.URCorner,CharSet.LLCorner, CharSet.LRCorner)!=OK)?ERR:wnoutrefresh(ErrFrame)); } void SweepAlert() { switch (ErrAlert) { case NO_ALERT: break; case FLASH: flash(); break; case BEEP: default: /* No preference gets a beep. */ beep(); break; } return; } void SweepMessage(char* format, ...) { char NewErrMsg[42]; va_list args; ClearError(); if ( format == NULL) { return; } va_start(args, format); #if defined HAVE_VSNPRINTF vsnprintf(NewErrMsg,41,format,args); #elif HAVE_VSPRINTF vsprintf(NewErrMsg,format,args); #else #error "Need either vsnprintf() (preferred) or vsprintf()" #endif va_end(args); mvwprintw(ErrWin,0,0,NewErrMsg); wnoutrefresh(ErrWin); move(0,0); noutrefresh(); return; } void ChangeSweepAlert(int NewAlert) { ErrAlert = NewAlert; return; } freesweep-0.90/fgui.c0100640002255600003100000001645407600422634014270 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: fgui.c,v 1.17 2002/07/12 07:08:03 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" /* percentages of screen space utilized from LINES and COLS */ /* This means I want a window FSWIDTH% of the screen, centered and * FSHEIGHT% of the height, centered */ #define FSWIDTH 0.80 #define FSHEIGHT 0.80 static struct FileBuf* CreateFileBuf(char *dir); static void DestroyFileBuf(struct FileBuf *head); static char *FSelector(void); static char* Choose(struct FileBuf *fb); static void Display(WINDOW *fgui, struct FileBuf *fb, int find, int cursor, int amount); static int qstrcmp(const void *l, const void *r); /* make a linked list of filenames given a directory */ struct FileBuf* CreateFileBuf(char *dir) { char *path = NULL; struct FileBuf *head = NULL; struct FileBuf *tail = NULL; struct FileBuf *del = NULL; struct FileBuf *tmp = NULL; DIR *dent = NULL; struct dirent *dp = NULL; struct FileBuf *farray = NULL; int count = 0; char **sort = NULL; chdir(dir); #if defined(PATH_MAX) path = xgetcwd(NULL, PATH_MAX); #elif defined(HAVE_GET_CURRENT_DIR_NAME) path = get_current_dir_name(); #else /* Now what? No idea! */ #error "Don't know how to proceed on systems without PATH_MAX or get_current_dir_name" #endif dent = xopendir(dir); if ( dent == NULL ) { return NULL; } /* create a linked list of entries, don't use some of the fields for now */ while ((dp = readdir(dent)) != NULL) { tmp = xmalloc(sizeof(struct FileBuf) * 1); tmp->fpath = xmalloc(strlen(dp->d_name) + strlen(path) + 2); tmp->next = NULL; /* create the full name for it */ strcpy(tmp->fpath, path); if (strcmp(path,"/")!=0) { strcat(tmp->fpath, "/"); } strcat(tmp->fpath, dp->d_name); /* insert it into the list, the right way */ if (head == NULL) { head = tmp; } else { tail->next = tmp; } tail = tmp; } closedir(dent); /* ok, take that linked list, and make an array out of it. Then free it */ tmp = head; while(tmp != NULL) { count++; tmp = tmp->next; } farray = (struct FileBuf *)xmalloc(sizeof(struct FileBuf) * count); /* the first element in the array holds how many there are */ farray[0].numents = count; farray[0].path = path; /* stick it into the temporary array for sorting */ sort = (char**)xmalloc(sizeof(char*) * farray[0].numents); count = 0; tmp = head; while(tmp != NULL) { /* move the memory over to it */ sort[count] = tmp->fpath; count++; tmp = tmp->next; } /* sort it nicely */ qsort(sort, farray[0].numents, sizeof(char*), qstrcmp); /* now copy it out of the tmp array into the fb */ count = 0; tmp = head; while(tmp != NULL) { /* move the memory over to it */ farray[count].fpath = sort[count]; count++; tmp = tmp->next; } free(sort); /* free the old list, fpath will be owned by farray now */ tmp = head; while(tmp != NULL) { del = tmp; tmp = tmp->next; free(del); } return farray; } /* a glorified strcmp for qsort */ int qstrcmp(const void *l, const void *r) { char *left = NULL; char *right = NULL; left = *(char**)l; right = *(char**)r; return strcmp(left,right); } /* destroy a list of directory names */ void DestroyFileBuf(struct FileBuf *head) { int i = 0; free(head[0].path); for (i = 0; i < head[0].numents; i++) { free(head[i].fpath); } free(head); } /* allow the user to continue selecting stuff until a file is selected */ char *FSelector(void) { char *selection = NULL; struct stat buf; struct FileBuf *fb = NULL; fb = CreateFileBuf("."); selection = Choose(fb); stat(selection, &buf); /* keep going until I get something that isn't a directory */ while(S_ISDIR(buf.st_mode)) { DestroyFileBuf(fb); if ( ( fb = CreateFileBuf(selection) ) == NULL ) { return NULL; } free(selection); selection = Choose(fb); stat(selection, &buf); } DestroyFileBuf(fb); return selection; } /* this is the nasty function that parses the filedesc and spits up a window for you so you can select something out of it. XXX Must implement "this is correct" option */ char* Choose(struct FileBuf *fb) { WINDOW *gui = NULL, *fgui = NULL; int nlines, ncols, bx, by; int xdist, ydist; chtype in; int cursor = 1; /* where the cursor starts in relation to the window */ int find = 0; /* the index of the top of the fb display */ /* the area I have to put the window */ xdist = (COLS-INFO_W-2); ydist = (LINES-6); /* find out how big, and where the window is, it is also centered */ nlines = (int)(ydist * FSHEIGHT); ncols = (int)(xdist * FSWIDTH); bx = xdist/2 - ncols/2; by = ydist/2 - nlines/2; /* make border window */ gui = newwin(nlines, ncols, by, bx); if (gui == NULL) { perror("Choose::newwin"); exit(EXIT_FAILURE); } wborder(gui,CharSet.VLine,CharSet.VLine,CharSet.HLine,CharSet.HLine, CharSet.ULCorner,CharSet.URCorner,CharSet.LLCorner,CharSet.LRCorner); wmove(gui, by, bx); wrefresh(gui); /* make the window that will hold the information I want */ fgui = derwin(gui, nlines-2, ncols-2, 1, 1); /* set it to the head of the list */ werase(fgui); Display(fgui, fb, find, cursor, nlines-3); wrefresh(fgui); /* most of the nlines-3 stuff is because the first line is reserved for * the path. */ in=getch(); if ( in == KEY_LEFT ) { /* Find a way to return without catching an error. */ return NULL; } while ((in != ' ') && (in != KEY_RIGHT)) { switch (in) { /* move the cursor down */ case 'j': case KEY_DOWN: if (cursor < (nlines - 3) && cursor < fb[0].numents) { cursor++; } else if (find != fb[0].numents - (nlines-3) && fb[0].numents > nlines-3) { find++; } break; /* move the cursor up */ case 'k': case KEY_UP: if (cursor > 1) { cursor--; } else if (find > 0) { find--; } break; default: break; } werase(fgui); Display(fgui, fb, find, cursor, nlines-3); wrefresh(fgui); in=getch(); } werase(fgui); werase(gui); wrefresh(fgui); wrefresh(gui); delwin(fgui); delwin(gui); return strdup(fb[find + cursor - 1].fpath); } /* draw the part of the FileBuf I have specified in the window */ void Display(WINDOW *fgui, struct FileBuf *fb, int find, int cursor, int amount) { char *p = NULL; int i; /* display the path, on the first line */ mvwprintw(fgui, 0, 0, "-->"); mvwprintw(fgui, 0, 3, fb[0].path); for (i = 0; i < amount && i+find < fb[0].numents; i++) { p = fb[find+i].fpath + strlen(fb[find+i].fpath) - 1; while(*p != '/') p--; p++; /* there will always be a / in it */ mvwprintw(fgui, i+1, 1, p); } /* highlight the cursor line */ mvwprintw(fgui, cursor, 0, ">"); } /* This controls all of the logic for saving a file, when it is done, it returns the file name to where to save the game. */ char* FSGUI(void) { char *file = NULL; StopTimer(); file = FSelector(); StartTimer(); return file; } freesweep-0.90/files.c0100640002255600003100000001277207600422634014437 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: files.c,v 1.9 2002/12/19 07:04:05 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" int SourceFile(GameStats* Game,FILE* PrefsFile) { char RawBuffer[MAX_LINE]; char *NameBuffer, *ValueBuffer; int Value=0; while (feof(PrefsFile)==0) { if (fgets(RawBuffer,MAX_LINE,PrefsFile)==0) { return 0; } if ((NameBuffer=strtok(RawBuffer,DELIMITERS))!=0) { /* This is essentially a great big switch statement. */ if ((ValueBuffer=strtok(NULL,DELIMITERS))!=0) { if (strncasecmp(NameBuffer,"color",5)==0) { Value=atoi(ValueBuffer); ((CheckColor(Value)>0)?Game->Color=Value:fprintf(stderr,"Invalid value for color in preference file.\n")); } else if (strncasecmp(NameBuffer,"faststart",9)==0) { Value=atoi(ValueBuffer); ((CheckFast(Value)>0)?Game->Fast=Value:fprintf(stderr,"Invalid value for faststart in preference file.\n")); } else if (strncasecmp(NameBuffer,"height",6)==0) { Value=atoi(ValueBuffer); ((CheckHeight(Value)>0)?Game->Height=Value:fprintf(stderr,"Invalid value for height in preference file.\n")); } else if (strncasecmp(NameBuffer,"linedraw",8)==0) { Value=atoi(ValueBuffer); ((CheckLineDraw(Value)>0)?InitCharSet(Game,Value):fprintf(stderr,"Invalid value for linedraw in preference file.\n")); } else if (strncasecmp(NameBuffer,"percent",7)==0) { Value=atoi(ValueBuffer); ((CheckPercent(Value)>0)?Game->Percent=Value,Game->NumMines=0:fprintf(stderr,"Invaid value for percent in preference file.\n")); } else if (strncasecmp(NameBuffer,"mines",5)==0) { Value=atoi(ValueBuffer); ((CheckNumMines(Value,Game->Height,Game->Width)>0)?Game->NumMines=Value,Game->Percent=0:fprintf(stderr,"Invalid value for mines in preference file.\n")); } else if (strncasecmp(NameBuffer,"width",5)==0) { Value=atoi(ValueBuffer); ((CheckWidth(Value)>0)?Game->Width=Value:fprintf(stderr,"Invalid value for width in preference file.\n")); } else if (strncasecmp(NameBuffer,"alert",5)==0) { /* This option takes different strings as arguments. */ if (strncasecmp(ValueBuffer,"beep",4)==0) { Game->Alert=BEEP; } else if (strncasecmp(ValueBuffer,"flash",5)==0) { Game->Alert=FLASH; } else if (strncasecmp(ValueBuffer,"none",4)==0) { Game->Alert=NO_ALERT; } else { fprintf(stderr,"Bad value for Alert in preference file.\n"); } } else if (strncasecmp(NameBuffer,"#",1)!=0) { fprintf(stderr,"Unknown tag %s in file.\n",NameBuffer); } } } } return 0; } int SourceHomeFile(GameStats* Game) { FILE* PrefsFile; char *Buffer, *Pathname; Pathname=(char*)xmalloc(MAX_LINE); if ((Buffer=getenv("HOME"))==NULL) { perror("SourceHomeFile::getenv"); return 1; } strcpy(Pathname,Buffer); strcat(Pathname,"/"); strcat(Pathname,DFL_PREFS_FILE); if ((PrefsFile=fopen(Pathname,"r"))==NULL) { /* The user has no personal preferences. */ free(Pathname); return 0; } else if (SourceFile(Game,PrefsFile)==1) { /* An error occurred while reading the file. Try closing it. */ fclose(PrefsFile); free(Pathname); return 1; } else { /* Done, so close the file. */ fclose(PrefsFile); free(Pathname); return 0; } } int SourceGlobalFile(GameStats* Game) { FILE* PrefsFile; if ((PrefsFile=fopen(GLOBAL_PREFS_FILE,"r"))==NULL) { /* The global file is invalid or non-existant. */ fprintf(stderr,"Unable to open the global prefernces file %s\n", GLOBAL_PREFS_FILE); /* perror("SourceGlobalFile::fopen"); */ return 1; } else if (SourceFile(Game,PrefsFile)==1) { /* An error occurred while reading the file. Try closing it. */ fclose(PrefsFile); return 1; } else { /* Done, so close the file. */ fclose(PrefsFile); return 0; } } int WritePrefsFile(GameStats* Game) { FILE* PrefsFile; char *Buffer, Pathname[MAX_LINE+1]; if ((Buffer=getenv("HOME"))==NULL) { perror("WriteHomeFile::getenv"); return 1; } strcpy(Pathname,Buffer); strcat(Pathname,"/"); strcat(Pathname,DFL_PREFS_FILE); if ((PrefsFile=fopen(Pathname,"w"))==NULL) { perror("WritePrefsFile::fopen"); return 1; } else { fprintf(PrefsFile,"# Freesweep version %s\n",VERSION); fprintf(PrefsFile,"# This is a generated file, but you can edit it if you like.\n"); fprintf(PrefsFile,"Height=%d\n",Game->Height); fprintf(PrefsFile,"Width=%d\n",Game->Width); if (Game->NumMines==0) { fprintf(PrefsFile,"Percent=%d\n",Game->Percent); } else { fprintf(PrefsFile,"Mines=%d\n",Game->NumMines); } fprintf(PrefsFile,"FastStart=%d\n",Game->Fast); fprintf(PrefsFile,"Color=%d\n",Game->Color); fprintf(PrefsFile,"LineDraw=%d\n",Game->LineDraw); switch (Game->Alert) { case BEEP: fprintf(PrefsFile,"Alert=Beep\n"); break; case FLASH: fprintf(PrefsFile,"Alert=Flash\n"); break; case NO_ALERT: fprintf(PrefsFile,"Alert=None\n"); break; default: break; } fclose(PrefsFile); } return 0; } freesweep-0.90/game.c0100640002255600003100000003135606753654407014262 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: game.c,v 1.32 1999/08/09 05:25:35 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" /* The various Check* functions. Each returns 1 if a valid input, else -1 */ int CheckHeight(int NewVal) { return (((NewVal>2)&&(NewVal<=MAX_H))?1:-1); } int CheckWidth(int NewVal) { return (((NewVal>2)&&(NewVal<=MAX_W))?1:-1); } int CheckPercent(int NewVal) { return (((NewVal>0)&&(NewVal<100))?1:-1); } int CheckRefresh(int NewVal) { return (((NewVal>0)&&(NewVal<=10))?1:-1); } int CheckFast(int NewVal) { return (((NewVal==0)||(NewVal==1))?1:-1); } int CheckColor(int NewVal) { return (((NewVal==0)||(NewVal==1))?1:-1); } int CheckLineDraw(int NewVal) { return (((NewVal==0)||(NewVal==1))?1:-1); } /* CheckNumMines is the only member of the check* family that requires input besides NewVal. Since the number of mines cannot be greater than the size of the field, height and width must be ascertained beforehand. */ int CheckNumMines(int NewVal,int Height,int Width) { return (((NewVal>0)&&(NewVal<(Height*Width)))?1:-1); } int InitGame(GameStats* Game) { Game->Height=DEFAULT_HEIGHT; Game->Width=DEFAULT_WIDTH; Game->Percent=DEFAULT_PERCENT; Game->Color=DEFAULT_COLOR; Game->NumMines=DEFAULT_NUMMINES; Game->MarkedMines=0; Game->BadMarkedMines=0; Game->Fast=DEFAULT_FASTSTART; Game->Alert=DEFAULT_ALERT; Game->LargeBoardX=Game->LargeBoardY=0; Game->FocusX=Game->FocusY=0; Game->Time=0; Game->Status=INPROG; InitCharSet(Game,DEFAULT_LINEDRAW); return 0; } /* Get the game ready for a reconfigure */ void Wipe(GameStats *Game) { if (Game->Percent != 0) { Game->NumMines=0; } Game->MarkedMines=0; Game->BadMarkedMines=0; Game->LargeBoardX=Game->LargeBoardY=0; Game->FocusX=Game->FocusY=0; Game->Time=0; if (Game->Percent != 0) { Game->NumMines=0; } werase(Game->Board); wnoutrefresh(Game->Board); werase(Game->Border); wnoutrefresh(Game->Border); delwin(Game->Board); delwin(Game->Border); free(Game->Field); } void SetCharSet(int Value) { CharSet.Mine='-'; CharSet.Space=' '; CharSet.Bombed='*'; if (Value==1) { CharSet.ULCorner=ACS_ULCORNER; CharSet.URCorner=ACS_URCORNER; CharSet.LLCorner=ACS_LLCORNER; CharSet.LRCorner=ACS_LRCORNER; CharSet.HLine=ACS_HLINE; CharSet.VLine=ACS_VLINE; CharSet.UArrow=ACS_UARROW; CharSet.DArrow=ACS_DARROW; CharSet.RArrow=ACS_RARROW; CharSet.LArrow=ACS_LARROW; CharSet.Mark=ACS_DIAMOND; CharSet.FalseMark=ACS_DIAMOND; } else { CharSet.ULCorner='+'; CharSet.URCorner='+'; CharSet.LLCorner='+'; CharSet.LRCorner='+'; CharSet.HLine='-'; CharSet.VLine='|'; CharSet.UArrow='^'; CharSet.DArrow='v'; CharSet.RArrow='>'; CharSet.LArrow='<'; CharSet.Mark='#'; CharSet.FalseMark='#'; } return; } void SwitchCharSet(GameStats* Game) { if (Game->LineDraw==0) { Game->LineDraw=1; SetCharSet(1); } else { Game->LineDraw=0; SetCharSet(0); } return; } int InitCharSet(GameStats* Game, int Value) { if (Value==1) { Game->LineDraw=1; SetCharSet(1); } else { Game->LineDraw=0; SetCharSet(0); } return 0; } int ReadyGame(GameStats* Game) { int VViewable=0, HViewable=0; VViewable=(LINES-6); HViewable=((COLS-INFO_W-2)/3); if ((Game->Field=calloc((Game->Height*( ( Game->Width % 2 ? (Game->Width) +1 : Game->Width )))/2, sizeof(char)))==NULL) { perror("ReadyGame::AllocField"); exit(EXIT_FAILURE); } /* Yeah, I know it's a crappy way to get a random number. */ srand(time(NULL)); if ((COLS-INFO_W)>=((3*Game->Width)+2)) { Game->LargeBoardX=0; } else { Game->LargeBoardX=1; } if ((LINES-4)>=(Game->Height+2)) { Game->LargeBoardY=0; } else { Game->LargeBoardY=1; } /* Determine the correct size of the border window, and allocate it */ if (Game->LargeBoardX && Game->LargeBoardY) { Game->Border=newwin((LINES-4),(COLS-INFO_W),0,0); Game->Board=derwin(Game->Border,VViewable,(3*HViewable),1,1); } else if (Game->LargeBoardX) { Game->Border=newwin((Game->Height+2),(COLS-INFO_W),0,0); Game->Board=derwin(Game->Border,Game->Height,(3*HViewable),1,1); } else if (Game->LargeBoardY) { Game->Border=newwin((LINES-4),((3*Game->Width)+2),0,0); Game->Board=derwin(Game->Border,VViewable,(3*Game->Width),1,1); } else { Game->Border=newwin((Game->Height+2),((3*Game->Width)+2),0,0); Game->Board=derwin(Game->Border,Game->Height,(3*Game->Width),1,1); } if ((Game->Border==NULL)||(Game->Board==NULL)) { perror("ReadyGame::AllocWin"); exit(EXIT_FAILURE); } return 0; } int ParseArgs(GameStats* Game, int Argc, char** Argv) { #if HAVE_GETOPT || HAVE_GETOPT_LONG int Value=0, Opt=0, SaveFlag=0, FastFlag=0, QueryFlag=0, ErrorFlag=0, BestTimesFlag=0, DumpFlag=0, GPLFlag=0, PercentOrNum=0, HelpFlag=0; extern int opterr, optind; extern char* optarg; #if defined HAVE_GETOPT_LONG static struct option long_options[] = { {"percent", required_argument, 0, '%'}, {"alt-charset", no_argument, 0, 'a'}, {"show-best-times", no_argument, 0, 'b'}, {"dump-best-times", no_argument, 0, 'd'}, {"fast", no_argument, 0, 'f'}, {"show-gpl", no_argument, 0, 'g'}, {"height", required_argument, 0, 'h'}, {"help", no_argument, 0, 'H'}, {"interactive", no_argument, 0, 'i'}, {"mines", no_argument, 0, 'm'}, {"save-prefs", no_argument, 0, 's'}, {"version", no_argument, 0, 'v'}, {"width", required_argument, 0, 'w'}, {0, 0, 0, 0} }; /* Clear the error flag. */ opterr=0; /* Parse the command line options. */ while ((Opt=getopt_long(Argc,Argv,"%:abdfgh:im:svw:",long_options, NULL))!=EOF) #elif HAVE_GETOPT /* Clear the error flag. */ opterr=0; /* Parse the command line options. */ while ((Opt=getopt(Argc,Argv,"%:abdfgh:im:svw:"))!=EOF) #endif /* HAVE_GETOPT */ { switch (Opt) { case '%': /* Set percent to optarg */ Value=atoi(optarg); ((CheckPercent(Value)>=0)?Game->Percent=Value:fprintf(stderr,"Invalid value for percent.\n")); PercentOrNum++; break; case 'H': /* Show the help listing, but exit without error. */ break; case 'a': SwitchCharSet(Game); break; case 'b': BestTimesFlag++; break; case 'd': DumpFlag++; break; case 'f': FastFlag++; break; case 'g': GPLFlag++; break; case 'h': /* Set height to optarg */ Value=atoi(optarg); ((CheckHeight(Value)>=0)?Game->Height=Value:fprintf(stderr,"Invalid value for height.\n")); break; case 'i': QueryFlag++; break; case 'm': /* Set nummines to optarg if PercentFlag is not set.*/ Value=atoi(optarg); ((CheckNumMines(Value,Game->Height,Game->Width)>=0)?Game->NumMines=Value:fprintf(stderr,"Invalid value for number of mines.\n")); PercentOrNum++; break; case 's': /* Set the save flag */ SaveFlag++; break; case 'v': printf("Freesweep %s by\nGus Hartmann (hartmann@cs.wisc.edu) and Pete Keller (psilord@cs.wisc.edu).\n",VERSION); exit(EXIT_SUCCESS); break; case 'w': /* Set width to optarg */ Value=atoi(optarg); ((CheckWidth(Value)>=0)?Game->Width=Value:fprintf(stderr,"Invalid value for width.\n")); break; case '?': default: ErrorFlag++; break; } Value=0; } /* Make sure there aren't any more arguments. */ /* Also insure that there was not more than one -s was passed. */ if (SaveFlag>1) { fprintf(stderr,"Only one save preferences command can be specified.\n"); ErrorFlag++; } if (PercentOrNum > 1) { fprintf(stderr, "Only one value for mines or percentage can be specified.\n"); ErrorFlag++; } if (GPLFlag>1) { fprintf(stderr,"The GNU GPL can only be displayed once.\n"); ErrorFlag++; } if ((BestTimesFlag + DumpFlag) > 1) { fprintf(stderr,"Only one show best times or dump best times can be specified.\n"); ErrorFlag++; } if ((FastFlag+QueryFlag)>1) { fprintf(stderr,"Only one -f or -i can be specified.\n"); ErrorFlag=1; } if (optind!=Argc) { fprintf(stderr,"Non-option arguments are invalid.\n"); ErrorFlag++; } else if (FastFlag!=0) { Game->Fast=1; } else if (QueryFlag!=0) { Game->Fast=0; } if (ErrorFlag + HelpFlag > 0) { #if defined HAVE_GETOPT_LONG fprintf(stderr,"Usage:\n freesweep [OPTIONS]\n\t-%% value, --percent=value\tSet percent to value\n\t-a, --alt-charset\t\tUse the alternate character set\n\t-b, --show-best-times\t\tDisplay best times\n\t-d, --dump-best-times\t\tPrint best times to stdout\n\t-f, --fast\t\t\tStart in fast mode\n\t-g, --show-gpl\t\t\tDisplay the GNU General Public License\n\t-h value, --height=value\tSet height to value\n\t-H, --help\t\t\tDisplay this help message\n\t-i, --interactive\t\tStart in interactive mode\n\t-m value, --mines=value\t\tSet mines to value\n\t-s, --save-prefs\t\tSave any specified preferences\n\t-v, --version\t\t\tDisplay version information\n\t-w value, --width=value\t\tSet width to value\n"); #else fprintf(stderr,"Usage:\n freesweep [OPTIONS]\n\t-%% value\tSet percent to value\n\t-a\t\tUse the alternate character set\n\t-b\t\tDisplay best times\n\t-d\t\tPrint best times to stdout\n\t-f\t\tStart in fast mode\n\t-g\t\tDisplay the GNU General Public License\n\t-H\t\tDisplay this help message\n\t-h value\tSet height to value\n\t-i\t\tStart in interactive mode\n\t-m value\tSet mines to value\n\t-s\t\tSave any specified preferences\n\t-v\t\tDisplay version information\n\t-w value\tSet width to value\n"); #endif if (ErrorFlag != 0) { exit(EXIT_FAILURE); } else { exit(EXIT_SUCCESS); } } if (BestTimesFlag==1) { StartCurses(); InitCharSet(Game,Game->LineDraw); PrintBestTimes(NULL); clear(); noutrefresh(); doupdate(); endwin(); exit(EXIT_SUCCESS); } if (GPLFlag==1) { StartCurses(); InitCharSet(Game,Game->LineDraw); PrintGPL(NULL); clear(); noutrefresh(); doupdate(); endwin(); exit(EXIT_SUCCESS); } /* XXX FOO This needs to dump the best times to stdout! */ if (DumpFlag==1) { exit(EXIT_SUCCESS); } if (SaveFlag==1) { WritePrefsFile(Game); } #endif /* HAVE_GETOPT || HAVE_GETOPT_LONG */ return 0; } /* DumpGame() prints a great deal of good information about the current Game* to the DebugLog. It prints nothing to any other file descriptor. Calling it without having defined DEBUG_LOG is utterly useless. */ void DumpGame(GameStats* Game) { #ifdef DEBUG_LOG fprintf(DebugLog,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"); fprintf(DebugLog,"Height is %d, Width is %d\n",Game->Height,Game->Width); fprintf(DebugLog,"Percent is %d, NumMines is %d\n",Game->Percent,Game->NumMines); fprintf(DebugLog,"MarkedMines is %d\n",Game->MarkedMines); fprintf(DebugLog,"Fast is %d, LineDraw is %d\n",Game->Fast,Game->LineDraw); fprintf(DebugLog,"CursorY is %d, CursorX is %d\n",Game->CursorY,Game->CursorX); fprintf(DebugLog,"LargeBoardY is %d, LargeBoardX is %d\n",Game->LargeBoardY,Game->LargeBoardX); fprintf(DebugLog,"FocusY is %d, FocusX is %d\n",Game->FocusY,Game->FocusX); fprintf(DebugLog,"Time is %d\n",Game->Time); fprintf(DebugLog,"Alert is %d (",Game->Alert); switch (Game->Alert) { case NO_ALERT: fprintf(DebugLog,"None)\n"); break; case FLASH: fprintf(DebugLog,"Flash)\n"); break; case BEEP: default: fprintf(DebugLog,"Beep)\n"); break; } fprintf(DebugLog,"Field is %p\n",Game->Field); fprintf(DebugLog,"Border is %p\n",Game->Border); fprintf(DebugLog,"Board is %p\n",Game->Board); fprintf(DebugLog,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"); fflush(DebugLog); #endif /* DEBUG_LOG */ return; } int ReReadyGame(GameStats* Game) { int MinesToSet=0, RandX=0, RandY=0, VViewable=0, HViewable=0; unsigned char CellVal; VViewable=(LINES-6); HViewable=((COLS-INFO_W-2)/3); /* Set all of Game->Field to 0 */ memset(Game->Field, 0, ((Game->Height*(( Game->Width % 2 ? (Game->Width) +1 : Game->Width )))/2)); if (Game->Percent!=0) { MinesToSet=(Game->Percent*Game->Width*Game->Height)/100; } else { MinesToSet=Game->NumMines; } Game->NumMines = MinesToSet; /* Yeah, I know it's a crappy way to get a random number. */ srand(time(NULL)); while (MinesToSet>0) { RandX=rand()%Game->Width; RandY=rand()%Game->Height; GetMine(RandX,RandY,CellVal); /* This is gonna be ugly... */ if (!( (abs((((Game->Width)/2)-RandX))<2) && (abs((((Game->Height)/2)-RandY))<2))) { if (CellVal!=MINE) { SetMine(RandX,RandY,MINE); MinesToSet--; } } } Game->MarkedMines = 0; Game->BadMarkedMines = 0; Game->CursorX=Game->Width/2; Game->CursorY=Game->Height/2; return 0; } freesweep-0.90/gpl.c0100640002255600003100000005205606753654407014133 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: gpl.c,v 1.12 1999/08/09 05:25:36 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" #define GPL_LINES 341 void PrintGPL() { WINDOW* GPLWin; int Input=0, LinesLeft=0, CurrentY=0, CurrentLine=0; char* Messages[]= { " GNU GENERAL PUBLIC LICENSE", " Version 2, June 1991", "", " Copyright (C) 1989, 1991 Free Software Foundation, Inc.", " 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA", " Everyone is permitted to copy and distribute verbatim copies", " of this license document, but changing it is not allowed.", "", " Preamble", "", " The licenses for most software are designed to take away your", "freedom to share and change it. By contrast, the GNU General Public", "License is intended to guarantee your freedom to share and change free", "software--to make sure the software is free for all its users. This", "General Public License applies to most of the Free Software", "Foundation's software and to any other program whose authors commit to", "using it. (Some other Free Software Foundation software is covered by", "the GNU Library General Public License instead.) You can apply it to", "your programs, too.", "", " When we speak of free software, we are referring to freedom, not", "price. Our General Public Licenses are designed to make sure that you", "have the freedom to distribute copies of free software (and charge for", "this service if you wish), that you receive source code or can get it", "if you want it, that you can change the software or use pieces of it", "in new free programs; and that you know you can do these things.", "", " To protect your rights, we need to make restrictions that forbid", "anyone to deny you these rights or to ask you to surrender the rights.", "These restrictions translate to certain responsibilities for you if you", "distribute copies of the software, or if you modify it.", "", " For example, if you distribute copies of such a program, whether", "gratis or for a fee, you must give the recipients all the rights that", "you have. You must make sure that they, too, receive or can get the", "source code. And you must show them these terms so they know their", "rights.", "", " We protect your rights with two steps: (1) copyright the software, and", "(2) offer you this license which gives you legal permission to copy,", "distribute and/or modify the software.", "", " Also, for each author's protection and ours, we want to make certain", "that everyone understands that there is no warranty for this free", "software. If the software is modified by someone else and passed on, we", "want its recipients to know that what they have is not the original, so", "that any problems introduced by others will not reflect on the original", "authors' reputations.", "", " Finally, any free program is threatened constantly by software", "patents. We wish to avoid the danger that redistributors of a free", "program will individually obtain patent licenses, in effect making the", "program proprietary. To prevent this, we have made it clear that any", "patent must be licensed for everyone's free use or not licensed at all.", "", " The precise terms and conditions for copying, distribution and", "modification follow.", "", " GNU GENERAL PUBLIC LICENSE", " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION", "", " 0. This License applies to any program or other work which contains", "a notice placed by the copyright holder saying it may be distributed", "under the terms of this General Public License. The \"Program\", below,", "refers to any such program or work, and a \"work based on the Program\"", "means either the Program or any derivative work under copyright law:", "that is to say, a work containing the Program or a portion of it,", "either verbatim or with modifications and/or translated into another", "language. (Hereinafter, translation is included without limitation in", "the term \"modification\".) Each licensee is addressed as \"you\".", "", "Activities other than copying, distribution and modification are not", "covered by this License; they are outside its scope. The act of", "running the Program is not restricted, and the output from the Program", "is covered only if its contents constitute a work based on the", "Program (independent of having been made by running the Program).", "Whether that is true depends on what the Program does.", "", " 1. You may copy and distribute verbatim copies of the Program's", "source code as you receive it, in any medium, provided that you", "conspicuously and appropriately publish on each copy an appropriate", "copyright notice and disclaimer of warranty; keep intact all the", "notices that refer to this License and to the absence of any warranty;", "and give any other recipients of the Program a copy of this License", "along with the Program.", "", "You may charge a fee for the physical act of transferring a copy, and", "you may at your option offer warranty protection in exchange for a fee.", "", " 2. You may modify your copy or copies of the Program or any portion", "of it, thus forming a work based on the Program, and copy and", "distribute such modifications or work under the terms of Section 1", "above, provided that you also meet all of these conditions:", "", " a) You must cause the modified files to carry prominent notices", " stating that you changed the files and the date of any change.", "", " b) You must cause any work that you distribute or publish, that in", " whole or in part contains or is derived from the Program or any", " part thereof, to be licensed as a whole at no charge to all third", " parties under the terms of this License.", "", " c) If the modified program normally reads commands interactively", " when run, you must cause it, when started running for such", " interactive use in the most ordinary way, to print or display an", " announcement including an appropriate copyright notice and a", " notice that there is no warranty (or else, saying that you provide", " a warranty) and that users may redistribute the program under", " these conditions, and telling the user how to view a copy of this", " License. (Exception: if the Program itself is interactive but", " does not normally print such an announcement, your work based on", " the Program is not required to print an announcement.)", "", "These requirements apply to the modified work as a whole. If", "identifiable sections of that work are not derived from the Program,", "and can be reasonably considered independent and separate works in", "themselves, then this License, and its terms, do not apply to those", "sections when you distribute them as separate works. But when you", "distribute the same sections as part of a whole which is a work based", "on the Program, the distribution of the whole must be on the terms of", "this License, whose permissions for other licensees extend to the", "entire whole, and thus to each and every part regardless of who", "wrote it.", "", "Thus, it is not the intent of this section to claim rights or contest", "your rights to work written entirely by you; rather, the intent is to", "exercise the right to control the distribution of derivative or", "collective works based on the Program.", "", "In addition, mere aggregation of another work not based on the Program", "with the Program (or with a work based on the Program) on a volume of", "a storage or distribution medium does not bring the other work under", "the scope of this License.", "", " 3. You may copy and distribute the Program (or a work based on it,", "under Section 2) in object code or executable form under the terms of", "Sections 1 and 2 above provided that you also do one of the following:", "", " a) Accompany it with the complete corresponding machine-readable", " source code, which must be distributed under the terms of Sections", " 1 and 2 above on a medium customarily used for software interchange; or,", "", " b) Accompany it with a written offer, valid for at least three", " years, to give any third party, for a charge no more than your", " cost of physically performing source distribution, a complete", " machine-readable copy of the corresponding source code, to be", " distributed under the terms of Sections 1 and 2 above on a medium", " customarily used for software interchange; or,", "", " c) Accompany it with the information you received as to the offer", " to distribute corresponding source code. (This alternative is", " allowed only for noncommercial distribution and only if you", " received the program in object code or executable form with such", " an offer, in accord with Subsection b above.)", "", "The source code for a work means the preferred form of the work for", "making modifications to it. For an executable work, complete source", "code means all the source code for all modules it contains, plus any", "associated interface definition files, plus the scripts used to", "control compilation and installation of the executable. However, as a", "special exception, the source code distributed need not include", "anything that is normally distributed (in either source or binary", "form) with the major components (compiler, kernel, and so on) of the", "operating system on which the executable runs, unless that component", "itself accompanies the executable.", "", "If distribution of executable or object code is made by offering", "access to copy from a designated place, then offering equivalent", "access to copy the source code from the same place counts as", "distribution of the source code, even though third parties are not", "compelled to copy the source along with the object code.", "", " 4. You may not copy, modify, sublicense, or distribute the Program", "except as expressly provided under this License. Any attempt", "otherwise to copy, modify, sublicense or distribute the Program is", "void, and will automatically terminate your rights under this License.", "However, parties who have received copies, or rights, from you under", "this License will not have their licenses terminated so long as such", "parties remain in full compliance.", "", " 5. You are not required to accept this License, since you have not", "signed it. However, nothing else grants you permission to modify or", "distribute the Program or its derivative works. These actions are", "prohibited by law if you do not accept this License. Therefore, by", "modifying or distributing the Program (or any work based on the", "Program), you indicate your acceptance of this License to do so, and", "all its terms and conditions for copying, distributing or modifying", "the Program or works based on it.", "", " 6. Each time you redistribute the Program (or any work based on the", "Program), the recipient automatically receives a license from the", "original licensor to copy, distribute or modify the Program subject to", "these terms and conditions. You may not impose any further", "restrictions on the recipients' exercise of the rights granted herein.", "You are not responsible for enforcing compliance by third parties to", "this License.", "", " 7. If, as a consequence of a court judgment or allegation of patent", "infringement or for any other reason (not limited to patent issues),", "conditions are imposed on you (whether by court order, agreement or", "otherwise) that contradict the conditions of this License, they do not", "excuse you from the conditions of this License. If you cannot", "distribute so as to satisfy simultaneously your obligations under this", "License and any other pertinent obligations, then as a consequence you", "may not distribute the Program at all. For example, if a patent", "license would not permit royalty-free redistribution of the Program by", "all those who receive copies directly or indirectly through you, then", "the only way you could satisfy both it and this License would be to", "refrain entirely from distribution of the Program.", "", "If any portion of this section is held invalid or unenforceable under", "any particular circumstance, the balance of the section is intended to", "apply and the section as a whole is intended to apply in other", "circumstances.", "", "It is not the purpose of this section to induce you to infringe any", "patents or other property right claims or to contest validity of any", "such claims; this section has the sole purpose of protecting the", "integrity of the free software distribution system, which is", "implemented by public license practices. Many people have made", "generous contributions to the wide range of software distributed", "through that system in reliance on consistent application of that", "system; it is up to the author/donor to decide if he or she is willing", "to distribute software through any other system and a licensee cannot", "impose that choice.", "", "This section is intended to make thoroughly clear what is believed to", "be a consequence of the rest of this License.", "", " 8. If the distribution and/or use of the Program is restricted in", "certain countries either by patents or by copyrighted interfaces, the", "original copyright holder who places the Program under this License", "may add an explicit geographical distribution limitation excluding", "those countries, so that distribution is permitted only in or among", "countries not thus excluded. In such case, this License incorporates", "the limitation as if written in the body of this License.", "", " 9. The Free Software Foundation may publish revised and/or new versions", "of the General Public License from time to time. Such new versions will", "be similar in spirit to the present version, but may differ in detail to", "address new problems or concerns.", "", "Each version is given a distinguishing version number. If the Program", "specifies a version number of this License which applies to it and \"any", "later version\", you have the option of following the terms and conditions", "either of that version or of any later version published by the Free", "Software Foundation. If the Program does not specify a version number of", "this License, you may choose any version ever published by the Free Software", "Foundation.", "", " 10. If you wish to incorporate parts of the Program into other free", "programs whose distribution conditions are different, write to the author", "to ask for permission. For software which is copyrighted by the Free", "Software Foundation, write to the Free Software Foundation; we sometimes", "make exceptions for this. Our decision will be guided by the two goals", "of preserving the free status of all derivatives of our free software and", "of promoting the sharing and reuse of software generally.", "", " NO WARRANTY", "", " 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY", "FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN", "OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES", "PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED", "OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF", "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS", "TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE", "PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,", "REPAIR OR CORRECTION.", "", " 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING", "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR", "REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,", "INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING", "OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED", "TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY", "YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER", "PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE", "POSSIBILITY OF SUCH DAMAGES.", "", " END OF TERMS AND CONDITIONS", "", " How to Apply These Terms to Your New Programs", "", " If you develop a new program, and you want it to be of the greatest", "possible use to the public, the best way to achieve this is to make it", "free software which everyone can redistribute and change under these terms.", "", " To do so, attach the following notices to the program. It is safest", "to attach them to the start of each source file to most effectively", "convey the exclusion of warranty; and each file should have at least", "the \"copyright\" line and a pointer to where the full notice is found.", "", " ", " Copyright (C) 19yy ", "", " This program is free software; you can redistribute it and/or modify", " it under the terms of the GNU General Public License as published by", " the Free Software Foundation; either version 2 of the License, or", " (at your option) any later version.", "", " This program is distributed in the hope that it will be useful,", " but WITHOUT ANY WARRANTY; without even the implied warranty of", " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", " GNU General Public License for more details.", "", " You should have received a copy of the GNU General Public License", " along with this program; if not, write to the Free Software", " Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA", "", "", "Also add information on how to contact you by electronic and paper mail.", "", "If the program is interactive, make it output a short notice like this", "when it starts in an interactive mode:", "", " Gnomovision version 69, Copyright (C) 19yy name of author", " Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.", " This is free software, and you are welcome to redistribute it", " under certain conditions; type `show c' for details.", "", "The hypothetical commands `show w' and `show c' should show the appropriate", "parts of the General Public License. Of course, the commands you use may", "be called something other than `show w' and `show c'; they could even be", "mouse-clicks or menu items--whatever suits your program.", "", "You should also get your employer (if you work as a programmer) or your", "school, if any, to sign a \"copyright disclaimer\" for the program, if", "necessary. Here is a sample; alter the names:", "", " Yoyodyne, Inc., hereby disclaims all copyright interest in the program", " `Gnomovision' (which makes passes at compilers) written by James Hacker.", "", " , 1 April 1989", " Ty Coon, President of Vice", "", "This General Public License does not permit incorporating your program into", "proprietary programs. If your program is a subroutine library, you may", "consider it more useful to permit linking proprietary applications with the", "library. If this is what you want to do, use the GNU Library General", "Public License instead of this License." }; if ((GPLWin=newwin(0,0,0,0))==NULL) { perror("PrintGPL::newwin"); exit(EXIT_FAILURE); } StopTimer(); wborder(GPLWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark); mvwprintw(GPLWin,1,2,"Time out - The GNU General Public License"); mvwhline(GPLWin,2,1,CharSet.HLine,COLS-2); mvwprintw(GPLWin,LINES-1,1,"--Press \'q\' to quit, any other key to continue.--"); /* Be sure to update this to account for all of the error messages. */ LinesLeft=GPL_LINES; while (LinesLeft> (LINES - 6)) { CurrentY=4; while (CurrentY< (LINES -2 )) { mvwprintw(GPLWin,CurrentY++,2,Messages[CurrentLine++]); LinesLeft--; } /* Now get a keystroke to continue. */ wmove(GPLWin,0,0); wrefresh(GPLWin); Input=wgetch(GPLWin); switch (Input) { case 'q': werase(GPLWin); delwin(GPLWin); clear(); noutrefresh(); StartTimer(); return; break; default: wmove(GPLWin,3,0); wclrtobot(GPLWin); wborder(GPLWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark); mvwprintw(GPLWin,LINES-1,1,"--Press \'q\' to quit, any other key for more.--"); wrefresh(GPLWin); break; } } /* Now print the last few lines */ CurrentY=4; while (LinesLeft > 0) { mvwprintw(GPLWin,CurrentY++,2,Messages[CurrentLine++]); LinesLeft--; } wborder(GPLWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark); mvwprintw(GPLWin,LINES-1,1,"--Press any key to quit. --"); wmove(GPLWin,0,0); wrefresh(GPLWin); Input=wgetch(GPLWin); werase(GPLWin); delwin(GPLWin); clear(); noutrefresh(); StartTimer(); return; } freesweep-0.90/main.c0100640002255600003100000001044107600422634014250 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: main.c,v 1.35 2002/12/19 07:04:05 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" int main(int argc, char** argv) { GameStats* Game; chtype Input=0; /* Set up the curses cleaner in case of disaster */ signal(SIGSEGV, sighandler); signal(SIGBUS, sighandler); signal(SIGILL, sighandler); #ifdef DEBUG_LOG if ((DebugLog=fopen("debug.log","a"))==0) { perror("Main::OpenDebugLog"); return 1; } #endif /* DEBUG_LOG */ if ((Game=malloc(sizeof(GameStats)))==NULL) { perror("Main::AllocGame"); return 1; } InitGame(Game); SourceGlobalFile(Game); SourceHomeFile(Game); if (ParseArgs(Game,argc,argv)>0) { return 1; } /* Output all the relevant information about the compilation. */ printf("Freesweep v%s by\nGus Hartmann (hartmann@cs.wisc.edu) and Pete Keller (psilord@cs.wisc.edu).\n",VERSION); printf("Freesweep comes with ABSOLUTELY NO WARRANTY; see the file COPYING for more info.\n"); #ifdef DEBUG_LOG fprintf(DebugLog,"Freesweep v%s by Gus Hartmann and Pete Keller.\n",VERSION); #endif /* DEBUG_LOG */ /* Start ncurses */ StartCurses(); /* Prompt the user for new setings, if necessary. */ if (Game->Fast==0) { AskPrefs(Game); } clear(); noutrefresh(); if (InitErrorWin(Game) + InitStatsWin() > 0) { /* Do something bad. */ } ReadyGame(Game); noutrefresh(); /* set up signal handler and stuff */ while (1) { /* Make sure the right character set is in use. */ InitCharSet(Game,Game->LineDraw); /* Touch a couple windows */ RedrawErrorWin(); RedrawStatsWin(); ReReadyGame(Game); PrintInfo(); noutrefresh(); PrintStats(Game); doupdate(); Center(Game); StartTimer(); /* This is the main loop.*/ while (Game->Status==INPROG) { PrintStats(Game); Pan(Game); DrawCursor(Game); DrawBoard(Game); doupdate(); UndrawCursor(Game); SweepError(NULL); GetInput(Game); Game->Time = g_tick; } g_tick = 0; Game->Time = g_tick; /* If we won, the game is already saved */ StopTimer(); /* Update the final action of the player */ Pan(Game); DrawCursor(Game); DrawBoard(Game); doupdate(); UndrawCursor(Game); /* see what happened */ switch(Game->Status) { case ABORT: ReReadyGame(Game); break; case RECONF: StopTimer(); clear(); noutrefresh(); Wipe(Game); AskPrefs(Game); ChangeSweepAlert(Game->Alert); ReadyGame(Game); Center(Game); clear(); noutrefresh(); StartTimer(); break; case LOSE: StopTimer(); DrawCursor(Game); SweepMessage("BOOM! Any key to continue, 'q' to quit."); nodelay(Game->Board,FALSE); Input=mvwgetch(Game->Board,0,0); wnoutrefresh(Game->Board); refresh(); if (Input == 'q') { clear(); refresh(); endwin(); #ifdef DEBUG_LOG fprintf(DebugLog,"========================================\n"); fclose(DebugLog); #endif /* DEBUG_LOG */ return 0; } else { SweepMessage(NULL); UndrawCursor(Game); } break; case WIN: StopTimer(); DrawCursor(Game); SweepMessage("You Win! Press a key to continue."); nodelay(Game->Board,FALSE); Input=mvwgetch(Game->Board,0,0); wnoutrefresh(Game->Board); refresh(); if (Input == 'q') { clear(); refresh(); endwin(); #ifdef DEBUG_LOG fprintf(DebugLog,"========================================\n"); fclose(DebugLog); #endif /* DEBUG_LOG */ return 0; } else { SweepMessage(NULL); UndrawCursor(Game); } break; default: break; } /* It might be nice to log this before reseting it. */ Game->Status=INPROG; flushinp(); } endwin(); #ifdef DEBUG_LOG fprintf(DebugLog,"========================================\n"); fclose(DebugLog); #endif /* DEBUG_LOG */ return 0; } freesweep-0.90/pbests.c0100640002255600003100000002722407600422634014633 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: pbests.c,v 1.29 2000/11/07 05:31:09 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" static struct BestFileDesc* NewBFD(void); static void LoadBestTimesFile(struct BestFileDesc *bfd, char *filename); static void BFDSort(struct BestFileDesc *bfd); static void InsertEntry(struct BestFileDesc *bfd, struct BestEntry *n); static void SaveBestTimesFile(struct BestFileDesc *bfd, char *filename); static struct BestEntry* NewBestEntry(GameStats *Game); static void Unpack(struct BestFileDesc *bfd, FILE *abyss); static void Pack(struct BestFileDesc *bfd, FILE *fp); static int BECmpFunc(const void *l, const void *r); static void tlockf(FILE *fp, char * name); static void tunlockf(FILE *fp); static void DumpBFD(struct BestFileDesc *bfd, int valid); extern int errno; /* need a simple line buffer */ struct MBuf { unsigned int len; char *buf; }; /* the one function that does it all */ void UpdateBestTimesFile(GameStats *Game, char *filename) { struct BestFileDesc *bfd = NULL; struct BestEntry *b = NULL; bfd = NewBFD(); b = NewBestEntry(Game); DumpGame(Game); LoadBestTimesFile(bfd, filename); DumpBFD(bfd, FALSE); fflush(NULL); InsertEntry(bfd, b); DumpBFD(bfd, TRUE); fflush(NULL); BFDSort(bfd); DumpBFD(bfd, TRUE); fflush(NULL); SaveBestTimesFile(bfd, filename); fflush(NULL); free(b); free(bfd->ents); free(bfd); } /* construct a new best file descriptor */ struct BestFileDesc* NewBFD(void) { struct BestFileDesc *bfd = NULL; bfd = (struct BestFileDesc*)xmalloc(sizeof(struct BestFileDesc) * 1); bfd->ents = NULL; bfd->numents = 0; bfd->replflag = FALSE; return bfd; } /* summon from the depths of the abyss the best times file */ void LoadBestTimesFile(struct BestFileDesc *bfd, char *truename) { FILE *abyss = NULL; again: abyss = fopen(truename, "r+"); if (abyss == NULL) { abyss = fopen(truename, "w"); tlockf(abyss, truename); fprintf(abyss, "0\n0\n"); tunlockf(abyss); fclose(abyss); goto again; /* XXX So sue me, I'm lazy */ } tlockf(abyss, truename); /* take the ascii/binary mess the file is and make it into a nice bfd */ Unpack(bfd, abyss); tunlockf(abyss); fclose(abyss); /* you just try! */ } void Unpack(struct BestFileDesc *bfd, FILE *abyss) { unsigned char *space = NULL; unsigned int numents = 0; unsigned int size = 0; unsigned int i = 0; unsigned char *p = NULL; struct BestEntry *b = NULL; /* how many entries do I have? */ fscanf(abyss, "%u\n", &numents); if (numents == 0) /* uh oh, first time */ { /* one more than I need, for later */ bfd->ents = (struct BestEntry*)xmalloc(sizeof(struct BestEntry)); } else { /* one more than I need, for later */ bfd->ents = (struct BestEntry*) xmalloc(sizeof(struct BestEntry)*numents + sizeof(struct BestEntry)); } bfd->numents = numents; /* yes, this could be zero */ /* how many bytes do I need to read? */ fscanf(abyss, "%u\n", &size); /* see if there is any hope in hell */ if (size != 0) { space = (unsigned char*)xmalloc(sizeof(unsigned char) * size + 1); /* this also null terminates any string I put into it */ memset(space, 0, sizeof(unsigned char) * size + 1); /* read it in */ fread(space, size, 1, abyss); /* convert it to real ascii */ for (i = 0; i < size; i++) { /* space[i] ^= MAGIC_NUMBER;*/ } /* walk through memory looking for newlines and building the entries * as you go */ p = space; for (i = 0; i < bfd->numents; i++) { b = &bfd->ents[i]; /* save me typing */ /* get all the data out and into the entry */ sscanf((char *)p, "%[^(](a%dm%dt%d)%s", b->name, &b->area, &b->mines, &b->time, b->date); while(*p++ != '\n'); } free(space); } } void BFDSort(struct BestFileDesc *bfd) { if (bfd->replflag == TRUE) { /* I just replaced a node, everything is still sorted */ return; } else { /* qsort the whole mess */ qsort(bfd->ents, bfd->numents+1, sizeof(bfd->ents[0]), BECmpFunc); } } /* the Best Entry comparison function */ int BECmpFunc(const void *l, const void *r) { struct BestEntry *bl, *br; bl = (struct BestEntry*)l; br = (struct BestEntry*)r; if (bl->area < br->area) { return 1; } else if (bl->area > br->area) { return -1; } else if (bl->area == br->area) { if (bl->mines < br->mines) { return 1; } else if (bl->mines > br->mines) { return -1; } else if (bl->mines == br->mines) { if (bl->time < br->time) { return 1; } else if (bl->time > br->time) { return -1; } else if (bl->time == br->time) { return 0; } } } /* shut the compiler up */ /* this never happens */ return 0; } void InsertEntry(struct BestFileDesc *bfd, struct BestEntry *n) { int replaced = FALSE; int i = 0; /* search until I find a match */ for (i = 0; i < bfd->numents; i++) { /* did the area match? */ if (n->area == bfd->ents[i].area) { /* did the number of mines match? */ if (n->mines == bfd->ents[i].mines) { /* yup, replace it and mark the flag */ bfd->ents[i].time = n->time; strncpy(bfd->ents[i].name, n->name, MAX_NAME); strncpy(bfd->ents[i].date, n->date, MAX_DATE); replaced = TRUE; } } } if (replaced == TRUE) { bfd->replflag = TRUE; return; } else { /* use the x-tra one I got initially */ bfd->ents[bfd->numents].area = n->area; bfd->ents[bfd->numents].mines = n->mines; bfd->ents[bfd->numents].time = n->time; strncpy(bfd->ents[bfd->numents].name, n->name, MAX_NAME); strncpy(bfd->ents[bfd->numents].date, n->date, MAX_DATE); } } void SaveBestTimesFile(struct BestFileDesc *bfd, char *name) { FILE *fp = NULL; fp = fopen(name, "w"); tlockf(fp, name); /* convert the bfd to a mess and write it out */ Pack(bfd, fp); tunlockf(fp); fclose(fp); } void Pack(struct BestFileDesc *bfd, FILE *fp) { struct MBuf *mbuf = NULL; unsigned int bfdnum = 0; unsigned int maxsize = 0, totalsize = 0; unsigned int i, j; struct BestEntry *b = NULL; /* see how many I need to write out */ if (bfd->replflag == FALSE) { bfdnum = bfd->numents + 1; } else { bfdnum = bfd->numents; } mbuf = (struct MBuf*)xmalloc(sizeof(struct MBuf) * bfdnum); /* compute the maximum size I will need to allocate for each line * in the buflines array */ /* this is: three unsigned ints converted to ascii + maximum name len + * maximum date len + 2 paren separators + 3 letters + 1 newline + 1 null */ maxsize = 3 * (unsigned int)ceil(log10(pow(2, sizeof(unsigned int)*8))) + MAX_NAME + MAX_DATE + 2 + 3 + 1 + 1; totalsize = 0; /* shove the entries into the line buffer */ for (i = 0; i < bfdnum; i++) { /* make a new line */ mbuf[i].buf = (char*)xmalloc(sizeof(char) * maxsize + 1); /* print the line into the buffer */ b = &bfd->ents[i]; #if defined HAVE_SNPRINTF snprintf(mbuf[i].buf, maxsize, "%s(a%um%ut%u)%s\n", #else sprintf(mbuf[i].buf, "%s(a%um%ut%u)%s\n", #endif b->name, b->area, b->mines, b->time, b->date); mbuf[i].len = strlen(mbuf[i].buf); /* encrypt the data */ for (j = 0; j < mbuf[i].len; j++) { /* mbuf[i].buf[j] ^= MAGIC_NUMBER;*/ } totalsize += mbuf[i].len; } /* now that the data is encrypted and ready, shove it out to the file */ /* number of entries */ fprintf(fp, "%u\n", bfdnum); /* byte size of file */ fprintf(fp, "%u\n", totalsize); /* the data */ for (i = 0; i < bfdnum; i++) { fwrite(mbuf[i].buf, mbuf[i].len, 1, fp); } /* free up all of the shit I just used */ for (i = 0; i < bfdnum; i++) { free(mbuf[i].buf); } free(mbuf); } struct BestEntry* NewBestEntry(GameStats *Game) { struct BestEntry *b = NULL; time_t now; char *buf = NULL, *p = NULL; b = (struct BestEntry*)xmalloc(sizeof(struct BestEntry) * 1); /* fill in some attributes */ b->area = Game->Height * Game->Width; b->mines = Game->NumMines; b->time = Game->Time; /* do the username */ buf = getenv("USER"); if (buf == NULL) { SweepError("You do not have a username!"); buf = "unknown"; } strcpy(b->name, buf); /* get the real time it was completed */ time(&now); buf = ctime(&now); if (buf == NULL) { buf = "unknown"; } p = strchr(buf, '\n'); /* some clean up work */ if (p != NULL) { *p = 0; } strcpy(b->date, buf); /* add _ instead of spaces for easier data format storage */ while((p = strchr(b->date, ' ')) != NULL) { *p = '_'; } return b; } /* Full Path To Best Times File in HOME */ char* FPTBTF(void) { char *home = NULL; char *fp = NULL; home = getenv("HOME"); if (home == NULL) { SweepError("You don't have a home dir!"); /* XXX fix this up */ exit(EXIT_FAILURE); } /* get me some memory for the string */ fp = (char*)xmalloc(strlen(home) + strlen(DFL_BESTS_FILE) + 2); /* make the full path */ strcpy(fp, home); strcat(fp, "/" DFL_BESTS_FILE); return fp; } #if defined USE_GROUP_BEST_FILE /* full path to group best times file */ char* FPTGBTF(void) { char *fp = NULL; /* get me some memory for the string */ fp = (char*)xmalloc(strlen(mkstr(SCORESDIR)) + 11); /* make the full path */ strcpy(fp, mkstr(SCORESDIR)); strcat(fp, "/sweeptimes"); return fp; } #endif /* USE_GROUP_BEST_FILE */ static void DumpBFD(struct BestFileDesc *bfd, int valid) { #ifdef DEBUG_LOG int i = 0; fprintf(DebugLog, "BFD DUMP START\n"); fprintf(DebugLog, "Numents -> %u\n", bfd->numents); fprintf(DebugLog, "Replflag -> %s\n", bfd->replflag?"TRUE":"FALSE"); for (i = 0; i < bfd->numents; i++) { fprintf(DebugLog, "- %s %u %u %u %s\n", bfd->ents[i].name, bfd->ents[i].area, bfd->ents[i].mines, bfd->ents[i].time, bfd->ents[i].date); } if (valid == TRUE) { if (bfd->replflag == FALSE) { fprintf(DebugLog, "AND\n"); fprintf(DebugLog, "- %s %u %u %u %s\n", bfd->ents[i].name, bfd->ents[i].area, bfd->ents[i].mines, bfd->ents[i].time, bfd->ents[i].date); } } fprintf(DebugLog, "BFD DUMP END\n"); #endif /* DEBUG_LOG */ } /* Lock a file for exclusive use */ void tlockf(FILE *fp, char *name) { int fd; /* this is actually dark magic. You aren't supposed to mix fileno * and streams */ fflush(fp); #if defined(HAVE_FILENO) fd = fileno(fp); #else #error "Need fileno() replacement" #endif lseek(fd, 0L, SEEK_SET); #if defined(HAVE_FLOCK) && defined(HAVE_LOCKF) if(flock(fd, LOCK_EX) == -1) #elif defined(HAVE_FLOCK) if(flock(fd, LOCK_EX) == -1) #elif defined(HAVE_LOCKF) if(lockf(fd, F_LOCK, 0L) == -1) #else #error "Need flock() or lockf()" #endif { #ifdef DEBUG_LOG fprintf(DebugLog, "Can't lock file: (%d)%s\n", errno, name); #endif /* DEBUG_LOG */ SweepError("Cannot lock file: %s\n", name); exit(EXIT_FAILURE); } } /* unlock a locked file */ void tunlockf(FILE *fp) { int fd; /* this is actually dark magic. You aren't supposed to mix fileno * and streams */ fflush(fp); #if defined(HAVE_FILENO) fd = fileno(fp); #else #error "Need fileno() replacement" #endif lseek(fd, 0L, SEEK_SET); #if defined(HAVE_FLOCK) && defined(HAVE_LOCKF) if(flock(fd, LOCK_UN) == -1) #elif defined(HAVE_FLOCK) if(flock(fd, LOCK_UN) == -1) #elif defined(HAVE_LOCKF) if(lockf(fd, F_ULOCK, 0L) == -1) #else #error "Need flock() or lockf()" #endif { #ifdef DEBUG_LOG fprintf(DebugLog, "Can't unlock file: %d\n", errno); #endif /* DEBUG_LOG */ SweepError("Cannot unlock file: %d\n", errno); exit(EXIT_FAILURE); } } freesweep-0.90/play.c0100640002255600003100000002713607600422634014302 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: play.c,v 1.41 2002/12/19 07:04:05 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" static int LastNum; static int LastKey; int GetInput(GameStats* Game) { unsigned char RetVal; int Multiplier=1; int UserInput=0; char *pathname = NULL; GameStats* LoadedGame; #ifdef SWEEP_MOUSE MEVENT MouseInput; #endif /* SWEEP_MOUSE */ UserInput=getch(); /* Check to see if it's a number; if so build up the multiplier. */ /* '0' isn't a valid first digit, since it means "go to the origin" */ /* '0' will be valid once there is a different first digit. */ if ((UserInput > '0')&&(UserInput <= '9')) { Multiplier=(UserInput-'0'); UserInput=getch(); while ((UserInput >= '0')&&(UserInput <= '9')) { Multiplier=((Multiplier*10)+(UserInput-'0')); UserInput=getch(); } } if (UserInput=='.') { UserInput=LastKey; Multiplier=(Multiplier*LastNum); } else { LastKey=UserInput; LastNum=Multiplier; } switch (UserInput) { /* Going Left? */ case 'h': case KEY_LEFT: MoveLeft(Game,Multiplier); break; /* Going Down? */ case 'j': case KEY_DOWN: MoveDown(Game,Multiplier); break; /* Going Up? */ case 'k': case KEY_UP: MoveUp(Game,Multiplier); break; /* Going Right? */ case 'l': case KEY_RIGHT: MoveRight(Game,Multiplier); break; /* Diagonals. */ case KEY_A1: MoveUp(Game,Multiplier); MoveLeft(Game,Multiplier); break; case KEY_A3: MoveUp(Game,Multiplier); MoveRight(Game,Multiplier); break; case KEY_C1: MoveDown(Game,Multiplier); MoveLeft(Game,Multiplier); break; case KEY_C3: MoveDown(Game,Multiplier); MoveRight(Game,Multiplier); break; /* The non-motion keys. */ /* The accepted values for flagging a space as a mine. */ case 'f': case KEY_B2: if (Multiplier!=1) { SweepError("Can only mark the mine once."); Multiplier=1; } GetMine(Game->CursorX,Game->CursorY,RetVal); switch (RetVal) { case MINE: SetMine(Game->CursorX,Game->CursorY,MARKED); Game->MarkedMines++; break; case MARKED: SetMine(Game->CursorX,Game->CursorY,MINE); Game->MarkedMines--; break; case BAD_MARK: SetMine(Game->CursorX,Game->CursorY,UNKNOWN); Game->BadMarkedMines--; break; case UNKNOWN: SetMine(Game->CursorX,Game->CursorY,BAD_MARK); Game->BadMarkedMines++; break; default: SweepError("Cannot mark as a mine."); break; } if (Game->MarkedMines == Game->NumMines && Game->BadMarkedMines == 0) { StopTimer(); /* YouWin();*/ Game->Status = WIN; #ifdef DEBUG_LOG fprintf(DebugLog, "Num %d, Marked %d, Bad %d\n", Game->NumMines, Game->MarkedMines, Game->BadMarkedMines); fflush(DebugLog); #endif /* DEBUG_LOG */ pathname = FPTBTF(); UpdateBestTimesFile(Game, pathname); free(pathname); #ifdef USE_GROUP_BEST_FILE pathname = FPTGBTF(); UpdateBestTimesFile(Game, pathname); free(pathname); #endif } StartTimer(); break; /* the accepted key to make a 'new' game */ case 'n': if (Multiplier != 1) { SweepError("Can only make a new game once."); Multiplier=1; } Game->Status = ABORT; break; /* The accepted key to make a reconfigure if the game */ case 'x': if (Multiplier != 1) { SweepError("Can only reconfigure game once."); Multiplier=1; } Game->Status = RECONF; break; /* The accepted key to open the save gui */ case 'w': if (Multiplier != 1) { SweepError("Can only save game once."); Multiplier=1; } if ( (pathname = FSGUI() ) != NULL ) { if (( LoadedGame = LoadGame(pathname) ) == NULL ) { SweepError("Error loading game %s", pathname); } else { werase(Game->Board); wnoutrefresh(Game->Board); werase(Game->Border); wnoutrefresh(Game->Border); delwin(Game->Board); delwin(Game->Border); free(Game->Field); free(Game); Game = LoadedGame; SweepError("Done Loading"); } break; } else { SweepError("Unable to open file"); } break; /* The accepted keys to expose a space. */ case ' ': case KEY_IC: if (Multiplier!=1) { SweepError("Can only expose the square once."); Multiplier=1; } GetMine(Game->CursorX,Game->CursorY,RetVal); switch (RetVal) { case BAD_MARK: case MARKED: SweepError("Cannot expose a flagged mine."); break; case MINE: StopTimer(); /* BOOM! */ /* Boom();*/ SetMine(Game->CursorX,Game->CursorY,DETONATED); CharSet.FalseMark='x'; CharSet.Mine='o'; Game->Status=LOSE; #ifdef DEBUG_LOG fprintf(DebugLog,"Mine exposed! Setting Status to LOSE.\n"); fflush(DebugLog); #endif /* DEBUG_LOG */ /* StartTimer();*/ break; case UNKNOWN: Clear(Game); break; case EMPTY: SweepError("Square already exposed."); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: /* Double-click */ SuperClear(Game); break; default: break; } break; /* The accepted keys to redraw the screen. */ case 'r': case KEY_REFRESH: case '\f': if (Multiplier!=1) { SweepError("Can only refresh the display once."); Multiplier=1; } PrintInfo(); RedrawStatsWin(); RedrawErrorWin(); touchwin(Game->Border); touchwin(Game->Board); noutrefresh(); break; /* The accepted keys to display the help screen. */ case '?': case KEY_HELP: if (Multiplier!=1) { SweepError("Can only display help screen once."); Multiplier=1; } StopTimer(); Help(); PrintInfo(); RedrawErrorWin(); RedrawStatsWin(); StartTimer(); break; /* The accepted keys to display the license screen. */ case 'g': if (Multiplier!=1) { SweepError("Can only display GNU GPL once."); Multiplier=1; } PrintGPL(); PrintInfo(); RedrawErrorWin(); RedrawStatsWin(); break; /* The accepted keys to display the best times screen. */ case 'b': if (Multiplier!=1) { SweepError("Can only display best times once."); Multiplier=1; } PrintBestTimes(NULL); PrintInfo(); RedrawErrorWin(); RedrawStatsWin(); noutrefresh(); doupdate(); break; /* The accepted values to center the cursor on board */ case 'c': if (Multiplier!=1) { SweepError("Can only center cursor once."); Multiplier=1; } Game->CursorX=Game->Width/2; Game->CursorY=Game->Height/2; break; /* A test key. Sort of feature-of-the-day. */ case 't': if (Multiplier!=1) { SweepError("Can only once."); Multiplier=1; } SweepMessage("_________0_________0(%u, %u)_________0_________0", Game->CursorX, Game->CursorY); break; case 'e': FindNearest(Game); break; case 'y': FindNearestBad(Game); break; /* The accepted values to suspend the game. */ case KEY_SUSPEND: case 'z': if (Multiplier!=1) { SweepError("Can only suspend the program once."); Multiplier=1; } break; case 'q': if (Multiplier!=1) { SweepError("Can only quit once."); Multiplier=1; } #ifdef DEBUG_LOG fprintf(DebugLog,"Quitting quietly.\n========================================\n"); fclose(DebugLog); #endif /* DEBUG_LOG */ clear(); refresh(); endwin(); exit(EXIT_SUCCESS); break; case '0': if (Multiplier!=1) { SweepError("Can only return to the origin once."); Multiplier=1; } Game->CursorY=0; Game->CursorX=0; break; case '$': if (Multiplier!=1) { SweepError("Can only go to the end once."); Multiplier=1; } Game->CursorY=Game->Height-1; Game->CursorX=Game->Width-1; break; case 'a': /* FOO - needs to redraw everything. */ if (Multiplier!=1) { if ((Multiplier%2)!=0) { SweepMessage("Toggling character set."); SwitchCharSet(Game); PrintInfo(); RedrawErrorWin(); RedrawStatsWin(); } else { SweepMessage("Not toggling character set."); } } else { SweepMessage("Toggling character set."); SwitchCharSet(Game); PrintInfo(); RedrawErrorWin(); RedrawStatsWin(); } break; case 'd': DumpGame(Game); break; #ifdef SWEEP_MOUSE case KEY_MOUSE: if (NCURSES_MOUSE_VERSION==1) { if (getmouse(&MouseInput)==ERR) { } } break; #endif /* SWEEP_MOUSE */ #ifdef DEBUG_LOG case '|': fprintf(DebugLog,"Entering cheat mode.\n"); CharSet.Mine='+'; break; #endif /* DEBUG_LOG */ /* XXX Save a game */ case 's': SaveGame(Game, "./foo.svg"); SweepError("Done Saving"); break; /* XXX load a game */ case 'o': werase(Game->Board); wnoutrefresh(Game->Board); werase(Game->Border); wnoutrefresh(Game->Border); delwin(Game->Board); delwin(Game->Border); free(Game->Field); free(Game); Game = LoadGame("./foo.svg"); SweepError("Done Loading"); break; case 'u': if ( Game->Color == 0 ) { Game->Color = 1; } else { Game->Color = 0; } break; case 'i': SaveGameImage(Game, "foo.ppm"); break; case ERR: return 1; break; default: #ifdef DEBUG_LOG fprintf(DebugLog,"Got unknown keystroke: %c\n", UserInput); #endif /* DEBUG_LOG */ LastNum=1; LastKey=ERR; SweepError("Bad Input."); return 1; break; } LastNum=Multiplier; LastKey=UserInput; return 0; } void MoveLeft(GameStats* Game,int Num) { if (Game->CursorX >= Num) { Game->CursorX-=Num; } else { SweepError("Cannot move past left side of board."); Game->CursorX=0; } return; } void MoveRight(GameStats* Game,int Num) { if ((Game->CursorX + Num) < Game->Width) { Game->CursorX+=Num; } else { SweepError("Cannot move past right side of board."); Game->CursorX=(Game->Width-1); } return; } void MoveUp(GameStats* Game,int Num) { if (Game->CursorY >= Num) { Game->CursorY-=Num; } else { SweepError("Cannot move past top of board."); Game->CursorY=0; } return; } void MoveDown(GameStats* Game,int Num) { if ((Game->CursorY + Num) < Game->Height) { Game->CursorY+=Num; } else { SweepError("Cannot move past bottom of board."); Game->CursorY=(Game->Height-1); } return; } void Boom(void) { WINDOW* BoomWin; if ((BoomWin=newwin(LINES/3,COLS/3,LINES/3,COLS/3))==NULL) { perror("Boom::Alloc Window"); return; } if (wborder(BoomWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark)!=OK) { perror("Boom::Draw Border"); return; } mvwprintw(BoomWin,(LINES/6)-1,(COLS-15)/6,"Boom!"); wrefresh(BoomWin); werase(BoomWin); wnoutrefresh(BoomWin); delwin(BoomWin); return; } void YouWin(void) { WINDOW* YouWin; if ((YouWin=newwin(LINES/3,COLS/3,LINES/3,COLS/3))==NULL) { perror("YouWin::Alloc Window"); return; } if (wborder(YouWin,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark,CharSet.Mark)!=OK) { perror("YouWin::Draw Border"); return; } mvwprintw(YouWin,(LINES/6)-1,(COLS-15)/6,"You Win!"); wrefresh(YouWin); napms(1000); werase(YouWin); wnoutrefresh(YouWin); delwin(YouWin); return; } freesweep-0.90/sl.c0100640002255600003100000000704107600422634013744 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: sl.c,v 1.10 2000/11/07 05:29:03 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" void SaveGame(GameStats* Game, char *fname) { FILE *fo = NULL; if ( ( fo = fopen(fname, "w") ) == NULL ) { SweepError("Unable to save game"); return; } /* dump the stats out */ fprintf(fo, "%d\n%d\n%d\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n" "%u\n%u\n%u\n", Game->Height, Game->Width, Game->Percent, Game->NumMines, Game->MarkedMines, Game->BadMarkedMines, Game->Color, Game->Fast, Game->Alert, Game->LineDraw, Game->CursorX, Game->CursorY, Game->LargeBoardX, Game->LargeBoardY, Game->Status, Game->FocusX, Game->FocusY, Game->Time); /* dump the field out */ fwrite(Game->Field, (Game->Height*((Game->Width % 2 ? (Game->Width) +1 : Game->Width ))/2) * sizeof(unsigned char), 1, fo); fclose(fo); } GameStats* LoadGame(char *fname) { FILE *fi = NULL; GameStats *Game = NULL; int VViewable = 0, HViewable = 0; VViewable=(LINES-6); HViewable=((COLS-INFO_W-2)/3); Game = (GameStats*)xmalloc(sizeof(GameStats)); if (( fi = fopen(fname, "r") ) == NULL ) { return NULL; } /* Load the Game Stats */ if ( fscanf(fi, "%d\n%d\n%d\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n" "%u\n%u\n%u\n", &Game->Height, &Game->Width, &Game->Percent, &Game->NumMines, &Game->MarkedMines, &Game->BadMarkedMines, &Game->Color, &Game->Fast, &Game->Alert, &Game->LineDraw, &Game->CursorX, &Game->CursorY, &Game->LargeBoardX, &Game->LargeBoardY, &Game->Status, &Game->FocusX, &Game->FocusY, &Game->Time) == 0 ) { return NULL; } /* make the field I need to write into */ if ((Game->Field=calloc((Game->Height*( ( Game->Width % 2 ? (Game->Width) +1 : Game->Width )))/2, sizeof(char)))==NULL) { SweepError("Out of Memory."); /* XXX clean this up */ exit(EXIT_FAILURE); } /* load the board */ fread(Game->Field, (Game->Height*((Game->Width % 2 ? (Game->Width) +1 : Game->Width ))/2) * sizeof(unsigned char), 1, fi); /* make the new window setup for it */ if (Game->LargeBoardX && Game->LargeBoardY) { Game->Border=newwin((LINES-4),(COLS-INFO_W),0,0); /* Game->Board=newwin(VViewable,(3*HViewable),1,1);*/ Game->Board=derwin(Game->Border,VViewable,(3*HViewable),1,1); } else if (Game->LargeBoardX) { Game->Border=newwin((Game->Height+2),(COLS-INFO_W),0,0); /* Game->Board=newwin(Game->Height,(3*HViewable),1,1);*/ Game->Board=derwin(Game->Border,Game->Height,(3*HViewable),1,1); } else if (Game->LargeBoardY) { Game->Border=newwin((LINES-4),((3*Game->Width)+2),0,0); /* Game->Board=newwin(VViewable,(3*Game->Width),1,1);*/ Game->Board=derwin(Game->Border,VViewable,(3*Game->Width),1,1); } else { Game->Border=newwin((Game->Height+2),((3*Game->Width)+2),0,0); /* Game->Board=newwin(Game->Height,(3*Game->Width),1,1);*/ Game->Board=derwin(Game->Border,Game->Height,(3*Game->Width),1,1); } if ((Game->Border==NULL)||(Game->Board==NULL)) { return NULL; } /* Set the game clock as the real clock */ g_tick = Game->Time; return Game; } freesweep-0.90/stats.c0100640002255600003100000000602207601156760014467 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: stats.c,v 1.11 2002/12/20 08:44:53 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" static WINDOW* StatsFrame; static WINDOW* StatsWin; static void ClearStats(void); int InitStatsWin(void) { if ((StatsFrame=newwin(7,INFO_W,6,(COLS-INFO_W)))==NULL) { return 1; } else if ((StatsWin=derwin(StatsFrame,5,19,1,1))==NULL) { return 1; } wborder(StatsFrame,CharSet.VLine,CharSet.VLine,CharSet.HLine,CharSet.HLine, CharSet.ULCorner, CharSet.URCorner,CharSet.LLCorner,CharSet.LRCorner); wnoutrefresh(StatsFrame); wnoutrefresh(StatsWin); return 0; } void ClearStats() { werase(StatsWin); wnoutrefresh(StatsWin); move(0,0); noutrefresh(); return; } int RedrawStatsWin(void) { return ((wborder(StatsFrame,CharSet.VLine,CharSet.VLine,CharSet.HLine, CharSet.HLine,CharSet.ULCorner,CharSet.URCorner,CharSet.LLCorner, CharSet.LRCorner)!=OK)?ERR:wnoutrefresh(StatsFrame)); } void PrintStats(GameStats *Game) { float percentage=0.0; percentage=100 * ((Game->MarkedMines + Game->BadMarkedMines) / (Game->NumMines * 1.0)); ClearStats(); /* mvwprintw(StatsWin, 0, 0, "Time: %ds", Game->Time);*/ /* Put better clock here. */ if ( Game->Time >= 86400 ) { mvwprintw(StatsWin, 0, 0, "Time: %d:%02d:%02d:%02ds", Game->Time / 86400, ( Game->Time % 86400 ) / 3600, ( Game->Time % 3600 ) / 60 , Game->Time % 60 ); } else if ( Game->Time >= 3600 ) { mvwprintw(StatsWin, 0, 0, "Time: %d:%02d:%02ds", Game->Time / 3600, ( Game->Time % 3600 ) / 60 , Game->Time % 60 ); } else if ( Game->Time >= 60 ) { mvwprintw(StatsWin, 0, 0, "Time: %d:%02ds", Game->Time / 60 , Game->Time % 60 ); } else { mvwprintw(StatsWin, 0, 0, "Time: %ds", Game->Time); } mvwprintw(StatsWin, 1, 0, "Loc: %d, %d", Game->CursorX, Game->CursorY); mvwprintw(StatsWin, 2, 0, "Mines: %d", Game->NumMines); mvwprintw(StatsWin, 3, 0, "Marks:"); mvwprintw(StatsWin, 4, 0, "Percentage:"); if ( percentage > 100.0) { if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(StatsWin,6,NULL); } else { wstandout(StatsWin); } mvwprintw(StatsWin, 3, 7, "%d", Game->MarkedMines + Game->BadMarkedMines); mvwprintw(StatsWin, 4, 12, "%3.2f%%", percentage); if (Game->Color != 0 && (has_colors() == TRUE)) { wcolor_set(StatsWin,1,NULL); } else { wstandend(StatsWin); } } else { mvwprintw(StatsWin, 3, 7, "%d", Game->MarkedMines + Game->BadMarkedMines); mvwprintw(StatsWin, 4, 12, "%3.2f%%", percentage); } wnoutrefresh(StatsWin); move(0,0); noutrefresh(); return; } freesweep-0.90/tick.c0100640002255600003100000000267006753654407014300 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: tick.c,v 1.8 1999/08/09 05:25:36 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" volatile unsigned int g_tick = 0; RETSIGTYPE sighandler(int signo) { switch(signo) { case SIGALRM: g_tick++; signal(SIGALRM, sighandler); alarm(1); return; break; case SIGSEGV: clear(); refresh(); endwin(); printf("\n\t***Segmentation Fault detected. Cleaning up....\n\n"); exit(EXIT_FAILURE); break; case SIGBUS: clear(); refresh(); endwin(); printf("\n\t***Bus Error detected. Cleaning up....\n\n"); exit(EXIT_FAILURE); break; case SIGILL: clear(); refresh(); endwin(); printf("\n\t***Illegal Instruction detected. Cleaning up....\n\n"); exit(EXIT_FAILURE); break; default: break; } signal(SIGALRM, sighandler); } freesweep-0.90/utils.c0100640002255600003100000000276207600422634014473 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: utils.c,v 1.7 2000/11/07 05:25:03 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" void* xmalloc(size_t num) { void *vec = NULL; vec = (void*)malloc(sizeof(unsigned char) * num); if (vec == NULL) { SweepError("Out of Memory. Sorry"); exit(EXIT_FAILURE); } return vec; } #ifndef HAVE_STRDUP char *strdup(char *s) { char *c = NULL; c = (char*)xmalloc(strlen(s) + 1); strcpy(c, s); return(c); } #endif char* xgetcwd(char *buf, size_t size) { char *path = NULL; path = getcwd(buf, size); if (path == NULL) { SweepError("Could not get current working directory."); exit(EXIT_FAILURE); } return path; } DIR* xopendir(const char *path) { DIR *dirent = NULL; dirent = opendir(path); if (dirent == NULL) { return NULL; } return dirent; } /* start and stop the timer */ void StartTimer(void) { signal(SIGALRM, sighandler); alarm(1); } /* stop the timer */ void StopTimer(void) { signal(SIGALRM, SIG_IGN); } freesweep-0.90/image.c0100640002255600003100000000332607600422634014412 0ustar hartmannusers/********************************************************************** * This source code is copyright 1999 by Gus Hartmann & Peter Keller * * It may be distributed under the terms of the GNU General Purpose * * License, version 2 or above; see the file COPYING for more * * information. * * * * $Id: image.c,v 1.3 2000/11/07 05:31:26 hartmann Exp $ * * **********************************************************************/ #include "sweep.h" void SaveGameImage(GameStats* Game, char *fname) { int width, height; unsigned char value; FILE *fo = NULL; if ( (fo = fopen(fname, "w") ) == NULL ) { SweepError("Unable to save game image"); return; } /* dump the stats out */ fprintf(fo, "P6\n%d\n%d\n255\n", Game->Width, Game->Height); for ( height = 0 ; height < Game->Height ; height++ ) { for ( width = 0 ; width < Game->Width ; width++ ) { if (( abs(width - Game->CursorX) < 2 ) && ( abs( Game->CursorY - height) < 10 )) { fwrite("\xff\x00\x00", 1, 3, fo); } else if (( abs(width - Game->CursorX) < 10 ) && ( abs(Game->CursorY - height) < 2 )) { fwrite("\xff\x00\x00", 1, 3, fo); } else { GetMine(width, height, value); switch ( value ) { case UNKNOWN: case MINE: fwrite("\x00\x00\x00", 1, 3, fo); break; case MARKED: case BAD_MARK: fwrite("\x00\x00\xff", 1, 3, fo); break; case DETONATED: fwrite("\xff\x00\x00", 1, 3, fo); break; case EMPTY: default: fwrite("\xff\xff\xff", 1, 3, fo); break; } } } } fclose(fo); } freesweep-0.90/README0100640002255600003100000000333007600422634014037 0ustar hartmannusers This will eventually be a readme file. For now, just a list of notes. Freesweep is licensed under the GNU GPL, version 2 or above. See the file COPYING, run freesweep with the -g flag, or hit 'g' while playing the game to see it. The code is copyright Gus Hartmann and Peter Keller. We need to have some sort of standard header in all the files the mentions the copyright and GNU GPL. Bugs should be mailed to sweep@cs.wisc.edu, if it works, or hartmann@cs.wisc.edu otherwise. Color works, but right now the values are not customizable. Sorry. If no file locking mechanism is found, group-writable best times will be disabled. While the game is playable on any terminal supported by curses/ncurses, the help and high scores windows are designed to use a screen 80 columns wide. On most X keymaps, both the left arrow and the down arrow don't work, reporting "Unknown keystroke." Unfortunately, somehow this leaves an extra 'o' lying around, leading to a saved game getting loaded. Really fucking bizarre- Sun's curses doesn't have the arrows-under-X problem. Fix up the error condition for what happens when you can't write to the best times file and shit. Just quitting doesn't seem to good. Also, fix the creation permissions of the group file. Like either the client can make a new one with 666 perms, or the installer makes one with the correct permissions. See if purify bitches about what I wrote with the reconfig shit. See what purify is bitching about in the load/save game code. Sun's curses doesn't do standout() correctly on a Linux term. Special thanks to Pete Keller for lots of help. Thanks to the FSF for the license and certain chunks of code. Thanks to the Undergraduate Project Lab at the University of Wisconsin freesweep-0.90/Makefile0100640002255600003100000000453307603236537014635 0ustar hartmannusers###################################################################### # $Id: Makefile.in,v 1.52 2002/12/24 04:23:57 hartmann Exp $ ###################################################################### TARGET = freesweep VERSION = 0.90 SRCS = clear.c drawing.c error.c fgui.c files.c game.c gpl.c main.c pbests.c\ play.c sl.c stats.c tick.c utils.c image.c HEADS = sweep.h defaults.h acconfig.h MISC = README Makefile sweeprc install-sh configure.in Makefile.in\ config.guess configure config.sub sweep.h.in freesweep.6.in CHANGES\ config.h.in CLEANUP = a.out $(TARGET) core made $(OBJS) config.cache config.log\ config.status srcdir = . prefix = /usr/local exec_prefix = ${prefix} #bindir = $(exec_prefix)/bin bindir = ${exec_prefix}/bin CC = gcc CFLAGS = -Wall -DVERSION=\"$(VERSION)\" -g -O2 LIBS = -lm -lncurses LDFLAGS = OBJS = $(SRCS:.c=.o) TARGET_DIR = $(TARGET)-$(VERSION) FILES = $(SRCS) $(MISC) $(HEADS) # for systems that have purify PURE_ARGS = /s/purify/bin/purify -collector=/s/purify/bin/collect2 .SUFFIXES: .c .o .PHONY: clean sterile lines distclean maintainer-clean mrproper ####################################################################### %.o: %.c $(HEADS) Makefile @/bin/rm -f $*.o $(CC) $(CFLAGS) -c $< $(TARGET): $(OBJS) $(HEADS) $(MISC) @/bin/rm -f $(TARGET) $(PURIFY) $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o $(TARGET) configure: configure.in autoconf #config.h.in: acconfig.h # autoheader clean: @-/bin/rm -rf $(CLEANUP) pure: @make clean @make "PURIFY=$(PURE_ARGS)" install: $(TARGET) $(TARGET).6 touch sweeptimes ./install-sh -c -m 2555 -o root -g games -s $(TARGET) $(bindir)/$(TARGET) ./install-sh -c -m 0664 -o root -g games sweeptimes /sweeptimes ./install-sh -c -m 0644 -o root -g games sweeprc /usr/local/share/sweeprc ./install-sh -c -m 0444 -o root -g games $(TARGET).6 ${prefix}/man/man6/$(TARGET).6 distclean: @make sterile maintainer-clean: @make sterile mrproper: @make sterile sterile: -make clean @-/bin/rm -f *.o core made $(TARGET) a.out sweep.h configure Makefile freesweep.6 debug.log tar: $(SRCS) $(MISC) (cd ../ ; ln -s sweep $(TARGET_DIR)) (cd ../ ; /bin/tar cvfh $(TARGET_DIR).tar $(FILES:%=$(TARGET_DIR)/%)) (cd ../ ; rm $(TARGET_DIR)) tags: $(SRCS) $(HEADS) $(MISC) @ctags $(SRCS) $(HEADS) lines: $(SRCS) $(HEADS) @echo 'Total lines of code:' @wc -l $(SRCS) $(HEADS) | sort -rn freesweep-0.90/sweeprc0100660002255600012760000000010106660433246014212 0ustar hartmannbsp# Freesweep Version 0.8 height=10 width=10 percent=20 Linedraw=0 freesweep-0.90/install-sh0100770002255600012760000001124406660433246014634 0ustar hartmannbsp#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" tranformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 freesweep-0.90/configure.in0100640002255600003100000001642507603236461015505 0ustar hartmannusersdnl dnl $Id: configure.in,v 1.43 2002/12/24 03:54:26 hartmann Exp $ dnl dnl IU_LIB_NCURSES -- check for, and configure, ncurses dnl dnl If libncurses is found to exist on this system and the --disable-ncurses dnl flag wasn't specified, defines LIBNCURSES with the appropriate linker dnl specification, and possibly defines NCURSES_INCLUDE with the appropriate dnl -I flag to get access to ncurses include files. dnl AC_DEFUN([IU_LIB_NCURSES], [ AC_ARG_ENABLE(ncurses, [ --disable-ncurses don't prefer -lncurses over -lcurses], , enable_ncurses=yes) if test "$enable_ncurses" = yes; then AC_CHECK_LIB(ncurses, initscr, LIBNCURSES="-lncurses") if test "$LIBNCURSES"; then # Use ncurses header files instead of the ordinary ones, if possible; # is there a better way of doing this, that avoids looking in specific # directories? AC_ARG_WITH(ncurses-include-dir, [ --with-ncurses-include-dir=DIR Set directory containing the include files for use with -lncurses, when it isn't installed as the default curses library. If DIR is "none", then no special ncurses include files are used. --without-ncurses-include-dir Equivalent to --with-ncurses-include-dir=none])dnl if test "${with_ncurses_include_dir+set}" = set; then AC_MSG_CHECKING(for ncurses include dir) case "$with_ncurses_include_dir" in no|none) freesweep_cv_includedir_ncurses=none;; *) freesweep_cv_includedir_ncurses="$with_ncurses_include_dir";; esac AC_MSG_RESULT($freesweep_cv_includedir_ncurses) else AC_CACHE_CHECK(for ncurses include dir, freesweep_cv_includedir_ncurses, for D in $includedir $prefix/include /local/include /usr/local/include /include /usr/include; do if test -d $D/ncurses; then freesweep_cv_includedir_ncurses="$D/ncurses" break fi test "$freesweep_cv_includedir_ncurses" \ || freesweep_cv_includedir_ncurses=none done) fi if test "$freesweep_cv_includedir_ncurses" = none; then NCURSES_INCLUDE="" else NCURSES_INCLUDE="-I$freesweep_cv_includedir_ncurses" fi fi fi AC_SUBST(NCURSES_INCLUDE) AC_SUBST(LIBNCURSES)])dnl dnl IU_LIB_TERMCAP -- check for various termcap libraries dnl dnl Checks for various common libraries implementing the termcap interface, dnl including ncurses (unless --disable ncurses is specified), curses (which dnl does on some systems), termcap, and termlib. If termcap is found, then dnl LIBTERMCAP is defined with the appropriate linker specification. dnl AC_DEFUN([IU_LIB_TERMCAP], [ AC_REQUIRE([IU_LIB_NCURSES]) if test "$LIBNCURSES"; then LIBTERMCAP="$LIBNCURSES" else AC_CHECK_LIB(curses, tgetent, LIBTERMCAP=-lcurses) if test "$ac_cv_lib_curses_tgetent" = no; then AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap) fi if test "$ac_cv_lib_termcap_tgetent" = no; then AC_CHECK_LIB(termlib, tgetent, LIBTERMCAP=-ltermlib) fi fi AC_SUBST(LIBTERMCAP)])dnl dnl IU_LIB_CURSES -- checke for curses, and associated libraries dnl dnl Checks for varions libraries implementing the curses interface, and if dnl found, defines LIBCURSES to be the appropriate linker specification, dnl *including* any termcap libraries if needed (some versions of curses dnl don't need termcap). dnl AC_DEFUN([IU_LIB_CURSES], [ AC_REQUIRE([IU_LIB_TERMCAP]) AC_REQUIRE([IU_LIB_NCURSES]) if test "$LIBNCURSES"; then LIBCURSES="$LIBNCURSES" # ncurses doesn't require termcap else _IU_SAVE_LIBS="$LIBS" LIBS="$LIBTERMCAP" AC_CHECK_LIB(curses, initscr, LIBCURSES="-lcurses") if test "$LIBCURSES" -a "$LIBTERMCAP" -a "$LIBCURSES" != "$LIBTERMCAP"; then AC_CACHE_CHECK(whether curses needs $LIBTERMCAP, freesweep_cv_curses_needs_termcap, LIBS="$LIBCURSES" AC_TRY_LINK([#include ], [initscr ();], [freesweep_cv_curses_needs_termcap=no], [freesweep_cv_curses_needs_termcap=yes])) if test $freesweep_cv_curses_needs_termcap = yes; then LIBCURSES="$LIBCURSES $LIBTERMCAP" fi fi LIBS="$_IU_SAVE_LIBS" fi AC_SUBST(LIBCURSES)])dnl dnl Process this file with autoconf to produce a configure script. AC_INIT(sweep.h.in)dnl AC_CONFIG_HEADER(config.h)dnl dnl Find out where we're building AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC AC_PROG_LN_S AC_PROG_MAKE_SET AC_PATH_PROG(TAR, tar)dnl AC_PATH_PROG(GZIP, gzip)dnl AC_PATH_PROG(RM, rm)dnl dnl Set the prefsdir to something AC_ARG_WITH(prefsdir, [ --with-prefsdir=DIR put the shared best time file in DIR [/usr/local/share]], PREFSDIR=$with_prefsdir, PREFSDIR='/usr/local/share')dnl AC_SUBST(PREFSDIR)dnl dnl Set the scoresdir to something dnl AC_ARG_WITH(scoresdir, [ --with-scoresdir=DIR put the shared best time file in DIR [/usr/local/share]], SCORESDIR=$with_scoresdir, SCORESDIR='/usr/local/share')dnl AC_ARG_WITH(scoresdir, [ --with-scoresdir=DIR put the shared best time file in DIR [/usr/local/share]], SCORESDIR=$with_scoresdir)dnl AC_SUBST(SCORESDIR)dnl if test X$SCORESDIR != X ; then AC_DEFINE_UNQUOTED(SCORESDIR, $SCORESDIR)dnl fi dnl Look for ncurses in a variable. dnl Check for debugging file AC_ARG_ENABLE(debug-log, [ --enable-debug-log Enables debugging file, debug.log.], enable_debug_log=yes) if test "$enable_debug_log" = 'yes' ; then AC_DEFINE(DEBUG_LOG)dnl fi dnl Check for curses and ncurses. IU_LIB_NCURSES IU_LIB_CURSES if test "X${LIBNCURSES}" != "X" ; then LIBS="${LIBNCURSES} ${LIBS}" HAVE_LIBNCURSES=1 AC_SUBST(HAVE_LIBNCURSES)dnl else dnl Look for curses AC_CHECK_LIB(curses,main)dnl fi dnl Replace `main' with a function in -lm: AC_CHECK_LIB(m,main)dnl dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(limits.h string.h unistd.h sys/file.h getopt.h errno.h sys/types.h)dnl dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(strdup memset memmove fileno lockf flock get_current_dir_name)dnl # Look for lesser but similar functions. AC_DEFUN([AC_FUNC_SNPRINTF], [AC_CACHE_CHECK(for working snprintf, ac_cv_func_snprintf, [AC_TRY_RUN([#include int main () { exit (!(3 <= snprintf(NULL,0,"%d",100))); } ], ac_cv_func_snprintf=yes, ac_cv_func_snprintf=no, ac_cv_func_snprintf=no)]) if test $ac_cv_func_snprintf = yes; then AC_DEFINE(HAVE_SNPRINTF) fi ]) AC_CHECK_FUNCS(snprintf)dnl if test "${ac_cv_func_snprintf}" = 'no' ; then AC_MSG_WARN([Consider getting a system with snprintf.]) AC_CHECK_FUNCS(sprintf)dnl fi AC_CHECK_FUNCS(vsnprintf)dnl if test "${ac_cv_func_vsnprintf}" = 'no' ; then AC_MSG_WARN([Consider getting a system with vsnprintf.]) AC_CHECK_FUNCS(vsprintf)dnl fi AC_CHECK_FUNCS(getopt_long)dnl if test "${ac_cv_func_getopt_long}" = 'no' ; then AC_MSG_WARN([Consider getting a system with getopt_long.]) AC_CHECK_FUNCS(getopt)dnl fi dnl If neither locking mechanism is there, disable group scores. if test "${with_scoresdir}" != '' ; then if test "${ac_cv_func_flock}" = 'no' && test "${ac_cv_func_lockf}" = 'no' ; then AC_MSG_WARN([Neither lockf nor flock was found. Best times files will be risky.])dnl else AC_DEFINE(USE_GROUP_BEST_FILE)dnl fi fi AC_OUTPUT(Makefile sweep.h freesweep.6)dnl freesweep-0.90/Makefile.in0100640002255600003100000000454007603236521015231 0ustar hartmannusers###################################################################### # $Id: Makefile.in,v 1.52 2002/12/24 04:23:57 hartmann Exp $ ###################################################################### TARGET = freesweep VERSION = 0.90 SRCS = clear.c drawing.c error.c fgui.c files.c game.c gpl.c main.c pbests.c\ play.c sl.c stats.c tick.c utils.c image.c HEADS = sweep.h defaults.h acconfig.h MISC = README Makefile sweeprc install-sh configure.in Makefile.in\ config.guess configure config.sub sweep.h.in freesweep.6.in CHANGES\ config.h.in CLEANUP = a.out $(TARGET) core made $(OBJS) config.cache config.log\ config.status srcdir = @srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ #bindir = $(exec_prefix)/bin bindir = @bindir@ CC = @CC@ CFLAGS = -Wall -DVERSION=\"$(VERSION)\" @CFLAGS@ LIBS = @LIBS@ LDFLAGS = @LDFLAGS@ OBJS = $(SRCS:.c=.o) TARGET_DIR = $(TARGET)-$(VERSION) FILES = $(SRCS) $(MISC) $(HEADS) # for systems that have purify PURE_ARGS = /s/purify/bin/purify -collector=/s/purify/bin/collect2 .SUFFIXES: .c .o .PHONY: clean sterile lines distclean maintainer-clean mrproper ####################################################################### %.o: %.c $(HEADS) Makefile @@RM@ -f $*.o $(CC) $(CFLAGS) -c $< $(TARGET): $(OBJS) $(HEADS) $(MISC) @@RM@ -f $(TARGET) $(PURIFY) $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o $(TARGET) configure: configure.in autoconf #config.h.in: acconfig.h # autoheader clean: @-@RM@ -rf $(CLEANUP) pure: @make clean @make "PURIFY=$(PURE_ARGS)" install: $(TARGET) $(TARGET).6 touch sweeptimes ./install-sh -c -m 2555 -o root -g games -s $(TARGET) $(bindir)/$(TARGET) ./install-sh -c -m 0664 -o root -g games sweeptimes @SCORESDIR@/sweeptimes ./install-sh -c -m 0644 -o root -g games sweeprc @PREFSDIR@/sweeprc ./install-sh -c -m 0444 -o root -g games $(TARGET).6 @mandir@/man6/$(TARGET).6 distclean: @make sterile maintainer-clean: @make sterile mrproper: @make sterile sterile: -make clean @-@RM@ -f *.o core made $(TARGET) a.out sweep.h configure Makefile freesweep.6 debug.log tar: $(SRCS) $(MISC) (cd ../ ; @LN_S@ sweep $(TARGET_DIR)) (cd ../ ; @TAR@ cvfh $(TARGET_DIR).tar $(FILES:%=$(TARGET_DIR)/%)) (cd ../ ; rm $(TARGET_DIR)) tags: $(SRCS) $(HEADS) $(MISC) @ctags $(SRCS) $(HEADS) lines: $(SRCS) $(HEADS) @echo 'Total lines of code:' @wc -l $(SRCS) $(HEADS) | sort -rn freesweep-0.90/config.guess0100750002255600003100000007477407201672655015531 0ustar hartmannusers#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 # Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # The master version of this file is at the FSF in /home/gd/gnu/lib. # Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit system type (host/target name). # # Only a few systems have been added to this list; please add others # (but try to keep the structure clean). # # Use $HOST_CC if defined. $CC may point to a cross-compiler if test x"$CC_FOR_BUILD" = x; then if test x"$HOST_CC" != x; then CC_FOR_BUILD="$HOST_CC" else if test x"$CC" != x; then CC_FOR_BUILD="$CC" else CC_FOR_BUILD=cc fi fi fi # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-cbm-sysv4 exit 0;; amiga:NetBSD:*:*) echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; arm32:NetBSD:*:*) echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; atari*:NetBSD:*:*) echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; macppc:NetBSD:*:*) echo powerpc-apple-netbsd${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:4) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=4.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) sed 's/^ //' << EOF >$dummy.c #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` rm -f $dummy.c $dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i?86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; hppa*:OpenBSD:*:*) echo hppa-unknown-openbsd exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*T3E:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; F301:UNIX_System_V:*:*) echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` exit 0 ;; hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | i?86:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) if test -x /usr/bin/objformat; then if test "elf" = "`/usr/bin/objformat`"; then echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` exit 0 fi fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_help_string=`cd /; ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g s/.*supported emulations: *// s/ .*// p'` case "$ld_supported_emulations" in *ia64) echo "${UNAME_MACHINE}-unknown-linux" exit 0 ;; i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; elf32arm*) echo "${UNAME_MACHINE}-unknown-linux-gnu" exit 0 ;; armelf_linux*) echo "${UNAME_MACHINE}-unknown-linux-gnu" exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; elf32ppc) # Determine Lib Version cat >$dummy.c < #if defined(__GLIBC__) extern char __libc_version[]; extern char __libc_release[]; #endif main(argc, argv) int argc; char *argv[]; { #if defined(__GLIBC__) printf("%s %s\n", __libc_version, __libc_release); #else printf("unkown\n"); #endif return 0; } EOF LIBC="" $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy | grep 1\.99 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.c $dummy echo powerpc-unknown-linux-gnu${LIBC} exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then sed 's/^ //' <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF LIBC="" $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. # If ld does not provide *any* "supported emulations:" # that means it is gnuoldld. echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 case "${UNAME_MACHINE}" in i?86) VENDOR=pc; ;; *) VENDOR=unknown; ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < #ifdef __cplusplus int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; i?86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i?86:*:5:7*) # Fixed at (any) Pentium or better UNAME_MACHINE=i586 if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-qnx-qnx${UNAME_VERSION} exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) printf ("vax-dec-bsd\n"); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi #echo '(Unable to guess system type)' 1>&2 exit 1 freesweep-0.90/configure0100750002255600003100000040453507603236461015105 0ustar hartmannusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} ac_unique_file="sweep.h.in" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. build=$build_alias host=$host_alias target=$target_alias # FIXME: should be removed in autoconf 3.0. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat < if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. EOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue cd $ac_subdir # A "../" for each directory in /$ac_subdir. ac_dots=`echo $ac_subdir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` case $srcdir in .) # No --srcdir option. We are building in place. ac_sub_srcdir=$srcdir ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_sub_srcdir=$srcdir/$ac_subdir ;; *) # Relative path. ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; esac # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_sub_srcdir/configure.gnu; then echo $SHELL $ac_sub_srcdir/configure.gnu --help=recursive elif test -f $ac_sub_srcdir/configure; then echo $SHELL $ac_sub_srcdir/configure --help=recursive elif test -f $ac_sub_srcdir/configure.ac || test -f $ac_sub_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\EOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. EOF exit 0 fi exec 5>config.log cat >&5 </dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` PATH = $PATH _ASUNAME } >&5 cat >&5 <\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" ac_sep=" " ;; esac # Get rid of the leading space. done # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. trap 'exit_status=$? # Save into config.log some information that might help in debugging. echo >&5 echo "## ----------------- ##" >&5 echo "## Cache variables. ##" >&5 echo "## ----------------- ##" >&5 echo >&5 # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } >&5 sed "/^$/d" confdefs.h >conftest.log if test -s conftest.log; then echo >&5 echo "## ------------ ##" >&5 echo "## confdefs.h. ##" >&5 echo "## ------------ ##" >&5 echo >&5 cat conftest.log >&5 fi (echo; echo) >&5 test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" >&5 echo "$as_me: exit $exit_status" >&5 rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:878: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:889: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:897: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:913: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:917: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:923: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:925: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:927: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. It doesn't matter if # we pass some twice (in addition to the command line arguments). if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:946: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:948: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if { (echo "$as_me:968: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:971: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else ac_path_separator=: fi PATH_SEPARATOR="$ac_path_separator" rm -f conftest.sh ac_config_headers="$ac_config_headers config.h" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:999: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:1009: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:1013: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:1022: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:1026: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1031: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` test -z "$build_alias" && build_alias=$ac_cv_build echo "$as_me:1041: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:1050: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1055: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` test -z "$host_alias" && host_alias=$ac_cv_host ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:1073: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:1088: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1096: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1099: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:1108: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:1123: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1131: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1134: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:1147: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:1162: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1170: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1173: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1182: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:1197: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1205: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1208: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1221: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:1241: found $ac_dir/$ac_word" >&5 break done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1263: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1266: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:1277: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:1292: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1300: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1303: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1316: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:1331: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1339: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1342: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:1354: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:1359:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:1362: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1365: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1367: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1370: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1372: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1375: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line 1379 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:1395: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:1398: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1401: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. for ac_file in `ls a.exe conftest.exe 2>/dev/null; ls a.out conftest 2>/dev/null; ls a.* conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1424: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:1430: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1435: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:1441: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1444: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1451: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:1459: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1466: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1468: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1471: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1473: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1476: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:1492: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:1498: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:1504: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1510 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1522: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1525: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1537: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:1544: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1548: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1554 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1569: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1572: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1575: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1578: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:1590: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:1596: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1602 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1614: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1617: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1620: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1623: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:1633: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1660: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1663: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1666: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1669: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line 1681 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1694: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1697: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1700: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1703: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line 1713 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1725: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1728: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1731: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1734: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:1761: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:1765: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:1768: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi echo "$as_me:1772: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:1792: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:1796: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # Extract the first word of "tar", so it can be a program name with args. set dummy tar; ac_word=$2 echo "$as_me:1803: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_TAR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $TAR in [\\/]* | ?:[\\/]*) ac_cv_path_TAR="$TAR" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_TAR="$ac_dir/$ac_word" echo "$as_me:1820: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi TAR=$ac_cv_path_TAR if test -n "$TAR"; then echo "$as_me:1831: result: $TAR" >&5 echo "${ECHO_T}$TAR" >&6 else echo "$as_me:1834: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "gzip", so it can be a program name with args. set dummy gzip; ac_word=$2 echo "$as_me:1839: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GZIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GZIP in [\\/]* | ?:[\\/]*) ac_cv_path_GZIP="$GZIP" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_GZIP="$ac_dir/$ac_word" echo "$as_me:1856: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi GZIP=$ac_cv_path_GZIP if test -n "$GZIP"; then echo "$as_me:1867: result: $GZIP" >&5 echo "${ECHO_T}$GZIP" >&6 else echo "$as_me:1870: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo "$as_me:1875: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_RM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $RM in [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_RM="$ac_dir/$ac_word" echo "$as_me:1892: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi RM=$ac_cv_path_RM if test -n "$RM"; then echo "$as_me:1903: result: $RM" >&5 echo "${ECHO_T}$RM" >&6 else echo "$as_me:1906: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check whether --with-prefsdir or --without-prefsdir was given. if test "${with_prefsdir+set}" = set; then withval="$with_prefsdir" PREFSDIR=$with_prefsdir else PREFSDIR='/usr/local/share' fi; # Check whether --with-scoresdir or --without-scoresdir was given. if test "${with_scoresdir+set}" = set; then withval="$with_scoresdir" SCORESDIR=$with_scoresdir fi; if test X$SCORESDIR != X ; then cat >>confdefs.h <>confdefs.h <<\EOF #define DEBUG_LOG 1 EOF fi # Check whether --enable-ncurses or --disable-ncurses was given. if test "${enable_ncurses+set}" = set; then enableval="$enable_ncurses" else enable_ncurses=yes fi; if test "$enable_ncurses" = yes; then echo "$as_me:1947: checking for initscr in -lncurses" >&5 echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 1955 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char initscr (); int main () { initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:1974: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1977: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:1980: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1983: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_initscr=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_ncurses_initscr=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:1994: result: $ac_cv_lib_ncurses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6 if test $ac_cv_lib_ncurses_initscr = yes; then LIBNCURSES="-lncurses" fi if test "$LIBNCURSES"; then # Use ncurses header files instead of the ordinary ones, if possible; # is there a better way of doing this, that avoids looking in specific # directories? # Check whether --with-ncurses-include-dir or --without-ncurses-include-dir was given. if test "${with_ncurses_include_dir+set}" = set; then withval="$with_ncurses_include_dir" fi; if test "${with_ncurses_include_dir+set}" = set; then echo "$as_me:2010: checking for ncurses include dir" >&5 echo $ECHO_N "checking for ncurses include dir... $ECHO_C" >&6 case "$with_ncurses_include_dir" in no|none) freesweep_cv_includedir_ncurses=none;; *) freesweep_cv_includedir_ncurses="$with_ncurses_include_dir";; esac echo "$as_me:2018: result: $freesweep_cv_includedir_ncurses" >&5 echo "${ECHO_T}$freesweep_cv_includedir_ncurses" >&6 else echo "$as_me:2021: checking for ncurses include dir" >&5 echo $ECHO_N "checking for ncurses include dir... $ECHO_C" >&6 if test "${freesweep_cv_includedir_ncurses+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else for D in $includedir $prefix/include /local/include /usr/local/include /include /usr/include; do if test -d $D/ncurses; then freesweep_cv_includedir_ncurses="$D/ncurses" break fi test "$freesweep_cv_includedir_ncurses" \ || freesweep_cv_includedir_ncurses=none done fi echo "$as_me:2035: result: $freesweep_cv_includedir_ncurses" >&5 echo "${ECHO_T}$freesweep_cv_includedir_ncurses" >&6 fi if test "$freesweep_cv_includedir_ncurses" = none; then NCURSES_INCLUDE="" else NCURSES_INCLUDE="-I$freesweep_cv_includedir_ncurses" fi fi fi if test "$LIBNCURSES"; then LIBTERMCAP="$LIBNCURSES" else echo "$as_me:2049: checking for tgetent in -lcurses" >&5 echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2057 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); int main () { tgetent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2076: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2079: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2082: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2085: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_tgetent=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_curses_tgetent=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2096: result: $ac_cv_lib_curses_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6 if test $ac_cv_lib_curses_tgetent = yes; then LIBTERMCAP=-lcurses fi if test "$ac_cv_lib_curses_tgetent" = no; then echo "$as_me:2103: checking for tgetent in -ltermcap" >&5 echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6 if test "${ac_cv_lib_termcap_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2111 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); int main () { tgetent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2130: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2133: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2136: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2139: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_termcap_tgetent=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_termcap_tgetent=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2150: result: $ac_cv_lib_termcap_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6 if test $ac_cv_lib_termcap_tgetent = yes; then LIBTERMCAP=-ltermcap fi fi if test "$ac_cv_lib_termcap_tgetent" = no; then echo "$as_me:2158: checking for tgetent in -ltermlib" >&5 echo $ECHO_N "checking for tgetent in -ltermlib... $ECHO_C" >&6 if test "${ac_cv_lib_termlib_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermlib $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2166 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); int main () { tgetent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2185: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2188: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2191: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2194: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_termlib_tgetent=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_termlib_tgetent=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2205: result: $ac_cv_lib_termlib_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_termlib_tgetent" >&6 if test $ac_cv_lib_termlib_tgetent = yes; then LIBTERMCAP=-ltermlib fi fi fi if test "$LIBNCURSES"; then LIBCURSES="$LIBNCURSES" # ncurses doesn't require termcap else _IU_SAVE_LIBS="$LIBS" LIBS="$LIBTERMCAP" echo "$as_me:2219: checking for initscr in -lcurses" >&5 echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2227 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char initscr (); int main () { initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2246: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2249: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2252: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2255: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_initscr=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_curses_initscr=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2266: result: $ac_cv_lib_curses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6 if test $ac_cv_lib_curses_initscr = yes; then LIBCURSES="-lcurses" fi if test "$LIBCURSES" -a "$LIBTERMCAP" -a "$LIBCURSES" != "$LIBTERMCAP"; then echo "$as_me:2273: checking whether curses needs $LIBTERMCAP" >&5 echo $ECHO_N "checking whether curses needs $LIBTERMCAP... $ECHO_C" >&6 if test "${freesweep_cv_curses_needs_termcap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else LIBS="$LIBCURSES" cat >conftest.$ac_ext <<_ACEOF #line 2280 "configure" #include "confdefs.h" #include int main () { initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2292: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2295: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2298: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2301: \$? = $ac_status" >&5 (exit $ac_status); }; }; then freesweep_cv_curses_needs_termcap=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 freesweep_cv_curses_needs_termcap=yes fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:2311: result: $freesweep_cv_curses_needs_termcap" >&5 echo "${ECHO_T}$freesweep_cv_curses_needs_termcap" >&6 if test $freesweep_cv_curses_needs_termcap = yes; then LIBCURSES="$LIBCURSES $LIBTERMCAP" fi fi LIBS="$_IU_SAVE_LIBS" fi if test "X${LIBNCURSES}" != "X" ; then LIBS="${LIBNCURSES} ${LIBS}" HAVE_LIBNCURSES=1 else echo "$as_me:2325: checking for main in -lcurses" >&5 echo $ECHO_N "checking for main in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2333 "configure" #include "confdefs.h" int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2345: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2348: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2351: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2354: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_main=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_curses_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2365: result: $ac_cv_lib_curses_main" >&5 echo "${ECHO_T}$ac_cv_lib_curses_main" >&6 if test $ac_cv_lib_curses_main = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6 if test "${ac_cv_lib_m_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2385 "configure" #include "confdefs.h" int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2397: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2400: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2403: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2406: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_m_main=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_m_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2417: result: $ac_cv_lib_m_main" >&5 echo "${ECHO_T}$ac_cv_lib_m_main" >&6 if test $ac_cv_lib_m_main = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 2454 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:2459: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2465: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 2488 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:2492: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2498: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:2535: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 2545 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:2550: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2556: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 2579 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:2583: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2589: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:2617: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:2628: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2634 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:2642: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2648: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 2670 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 2688 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line 2709 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:2735: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2738: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:2740: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2743: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:2756: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_header in limits.h string.h unistd.h sys/file.h getopt.h errno.h sys/types.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:2769: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2775 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:2779: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2785: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_ext fi echo "$as_me:2804: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line 2822 "configure" #include "confdefs.h" #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:2871: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2874: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2877: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2880: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:2897: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:2900: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac echo "$as_me:2905: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2911 "configure" #include "confdefs.h" int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2969: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2972: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2975: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2978: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2988: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\EOF #define const EOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:3004: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3010 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3016: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3019: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3022: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3025: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3035: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3051 "configure" #include "confdefs.h" $ac_includes_default int main () { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3066: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3069: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3072: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3075: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3085: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3103 "configure" #include "confdefs.h" #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3125: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3128: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3131: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3134: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3144: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3160 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:3191: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3194: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:3197: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3200: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:3210: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3231 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:3262: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3265: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:3268: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3271: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:3281: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo "$as_me: WARNING: Consider getting a system with snprintf." >&2;} for ac_func in sprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:3297: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3303 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:3334: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3337: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:3340: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3343: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:3353: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3373 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:3404: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3407: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:3410: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3413: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:3423: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo "$as_me: WARNING: Consider getting a system with vsnprintf." >&2;} for ac_func in vsprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:3439: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3445 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:3476: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3479: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:3482: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3485: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:3495: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3515 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:3546: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3549: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:3552: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3555: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:3565: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo "$as_me: WARNING: Consider getting a system with getopt_long." >&2;} for ac_func in getopt do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:3581: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3587 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:3618: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3621: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:3624: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3627: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:3637: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo "$as_me: WARNING: Neither lockf nor flock was found. Best times files will be risky." >&2;} else cat >>confdefs.h <<\EOF #define USE_GROUP_BEST_FILE 1 EOF fi fi ac_config_files="$ac_config_files Makefile sweep.h freesweep.6" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:3738: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated automatically by configure. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } exec 6>&1 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\EOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:3910: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. -*) { { echo "$as_me:3929: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done exec 5>>config.log cat >&5 << _ACEOF ## ----------------------- ## ## Running config.status. ## ## ----------------------- ## This file was extended by $as_me 2.52, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS > $ac_cs_invocation on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF EOF cat >>$CONFIG_STATUS <<\EOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "sweep.h" ) CONFIG_FILES="$CONFIG_FILES sweep.h" ;; "freesweep.6" ) CONFIG_FILES="$CONFIG_FILES freesweep.6" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:3968: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : ${TMPDIR=/tmp} { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } EOF cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@DEFS@,$DEFS,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@LN_S@,$LN_S,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@TAR@,$TAR,;t t s,@GZIP@,$GZIP,;t t s,@RM@,$RM,;t t s,@PREFSDIR@,$PREFSDIR,;t t s,@SCORESDIR@,$SCORESDIR,;t t s,@NCURSES_INCLUDE@,$NCURSES_INCLUDE,;t t s,@LIBNCURSES@,$LIBNCURSES,;t t s,@LIBTERMCAP@,$LIBTERMCAP,;t t s,@LIBCURSES@,$LIBCURSES,;t t s,@HAVE_LIBNCURSES@,$HAVE_LIBNCURSES,;t t s,@CPP@,$CPP,;t t CEOF EOF cat >>$CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" EOF cat >>$CONFIG_STATUS <<\EOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` else ac_dir_suffix= ac_dots= fi case $srcdir in .) ac_srcdir=. if test -z "$ac_dots"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_dots$srcdir$ac_dir_suffix ac_top_srcdir=$ac_dots$srcdir ;; esac if test x"$ac_file" != x-; then { echo "$as_me:4186: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ configure_input="Generated automatically from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:4204: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:4217: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done EOF cat >>$CONFIG_STATUS <<\EOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:4277: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:4288: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:4301: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in EOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\EOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end EOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\EOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\EOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated automatically by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then { echo "$as_me:4418: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } fi rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done EOF cat >>$CONFIG_STATUS <<\EOF { (exit 0); exit 0; } EOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: exec 5>/dev/null $SHELL $CONFIG_STATUS || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi freesweep-0.90/config.sub0100750002255600003100000005772707201672655015173 0ustar hartmannusers#! /bin/sh # Configuration validation subroutine script, version 1.1. # Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. if [ x$1 = x ] then echo Configuration name missing. 1>&2 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 echo "or $0 ALIAS" 1>&2 echo where ALIAS is a recognized configuration type. 1>&2 exit 1 fi # First pass through any local machine types. case $1 in *local*) echo $1 exit 0 ;; *) ;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in linux-gnu*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ | thumb | d10v | fr30) basic_machine=$basic_machine-unknown ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i[34567]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ | f301-* | armv*-* | t3e-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* ) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-cbm ;; amigaos | amigados) basic_machine=m68k-cbm os=-amigaos ;; amigaunix | amix) basic_machine=m68k-cbm os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [ctj]90-cray) basic_machine=c90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[34567]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[34567]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; i386-go32 | go32) basic_machine=i386-unknown os=-go32 ;; i386-mingw32 | mingw32) basic_machine=i386-unknown os=-mingw32 ;; i386-qnx | qnx) basic_machine=i386-qnx ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-unknown os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; np1) basic_machine=np1-gould ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=rs6000-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sparc | sparcv9) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -qnx) os=-qnx4 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -*MiNT) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f301-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -*MiNT) vendor=atari ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os freesweep-0.90/sweep.h.in0100640002255600003100000002125307601156760015071 0ustar hartmannusers/********************************************************************* * $Id: sweep.h.in,v 1.36 2002/12/21 21:32:09 hartmann Exp $ *********************************************************************/ #ifndef __SWEEP_H__ #define __SWEEP_H__ #include "config.h" #define mkstr(s) # s /* The library header files. */ #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #ifdef HAVE_GETOPT_H #include #endif /* HAVE_GETOPT_H */ #ifdef HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_LIBNCURSES #include "@NCURSES_INCLUDE@/ncurses.h" #define DEFAULT_LINEDRAW 1 #else /* HAVE_LIBNCURSES */ #include #define DEFAULT_LINEDRAW 0 #endif /* HAVE_LIBNCURSES */ #if defined HAVE_FLOCK && defined HAVE_SYS_FILE_H #include #endif #if defined(HAVE_LIMITS_H) #include #endif /* XXX make this work with configure */ #include #include #ifdef NCURSES_MOUSE_VERSION #define SWEEP_MOUSE #endif /* NCURSES_MOUSE_VERSION */ #if defined SCORESDIR #define USE_GROUP_BEST_FILE #endif #include "defaults.h" /* These are all the defines used in freesweep */ /* These are defines for convenience */ #define DELIMITERS " \t=" #define DFL_GROUP_PATH "@SCORESDIR@" #define MAGIC_NUMBER 128 #ifdef __CYGWIN__ #define DFL_PREFS_FILE "_sweeprc" #define DFL_BESTS_FILE "_sweeptimes" #else #define DFL_PREFS_FILE ".sweeprc" #define DFL_BESTS_FILE ".sweeptimes" #endif /* __CYGWIN__ */ #define GLOBAL_PREFS_FILE "@PREFSDIR@/sweeprc" /* used for the superclick feature in the game */ #define SUPERCLICK 0 #define DIE 1 #define DONOTHING 2 /* These are defines for maximum accepted values */ #define MAX_LINE 1024 #define MAX_H 2048 #define MAX_W 2048 #define L_MAX_H 4 #define L_MAX_W 4 #define INFO_W 21 #define MAX_NAME 80 #define MAX_DATE 26 /* These are the macros for cell values. */ #define UNKNOWN 0x0 #define MINE 0x9 #define MARKED 0xa #define BAD_MARK 0xb #define EMPTY 0xc #define DETONATED 0xd /* These are for winning and losing. */ #define INPROG 0 #define WIN 1 #define LOSE 2 #define ABORT 3 #define RECONF 4 /* These are for the alert types. */ #define BEEP 0 #define FLASH 1 #define NO_ALERT 2 /* These are the macros that reduce the memory usage by *half*. */ #define GetMine(x,y,ret) \ ret=(unsigned char)(!((ret)=Game->Field[((x)/2+(y)*( ( Game->Width +1 )/2))])\ ?UNKNOWN:((x)%2)?(ret)&0x0f:((ret)&0xf0)>>4) #define SetMine(x,y,val) \ Game->Field[((x)/2)+(y)*( ( Game->Width +1 )/2)]=(!((x)%2)?((Game->Field[((x)\ /2)+(y)*( ( Game->Width +1 )/2)]&0x0f)|((unsigned char)(val)<<4)):\ ((Game->Field[((x)/2)+(y)*( ( Game->Width +1 ) /2)]&0xf0)|((unsigned char)(val)\ &0x0f))) /* This extends the naming convention of ncurses functions. */ #define mvclrtoeol(y,x) (move(y,x)==ERR?ERR:clrtoeol()); #define noutrefresh() wnoutrefresh(stdscr) #ifndef mvwhline #define mvwhline(w,y,x,z,n) (wmove(w,y,x)==ERR?ERR:whline(w,z,n)); #endif /* mvwhline */ #ifndef mvwvline #define mvwvline(w,y,x,z,n) (wmove(w,y,x)==ERR?ERR:wvline(w,z,n)); #endif /* mvwvline */ #ifndef mvgetnstr #define mvgetnstr(y, x, str, n) (wmove(stdscr, y, x)==ERR?ERR:wgetnstr(stdscr, str, n)); #endif /* mvgetnstr */ #ifndef ValidCoordinate #define ValidCoordinate(x,y) ( ( (x>=0) && (xWidth) && (y>=0) && (yHeight) ) ? 1 : 0 ) #endif /* These are all the structs used in freesweep */ /* This is the struct containing all the various drawing characters. */ typedef struct _DrawChars { chtype ULCorner; chtype URCorner; chtype LLCorner; chtype LRCorner; chtype HLine; chtype VLine; chtype UArrow; chtype DArrow; chtype LArrow; chtype RArrow; chtype Mine; chtype Space; chtype Mark; chtype FalseMark; chtype Bombed; } DrawChars; /* This is the struct containing all the relevant game information. */ typedef struct _GameStats { int Height; int Width; int Percent; unsigned int NumMines; unsigned int MarkedMines; unsigned int BadMarkedMines; int Color; int Fast; int Alert; int LineDraw; int CursorX, CursorY; int LargeBoardX, LargeBoardY; int Status; unsigned int FocusX, FocusY; unsigned int Time; unsigned char* Field; WINDOW* Border; WINDOW* Board; } GameStats; /* This is the struct for the clearing algo. */ struct Mark { int x, y; struct Mark *next; }; /* this is the _NEW_ format for the best times score */ struct BestEntry { unsigned int area; unsigned int mines; unsigned int time; char name[MAX_NAME]; char date[MAX_DATE]; char *attribs; }; struct BestFileDesc { /* the array of entries from the file, with one more in it. */ struct BestEntry *ents; /* the number of entries in the descriptor */ int numents; /* did I replace, or add? */ int replflag; }; typedef struct _CoordPair { int CoordX, CoordY; } CoordPair; /* stuff needed for the file gui */ /* this is not very well designed, but oh well */ struct FileBuf { char *fpath; char *path; int numents; struct FileBuf *next; struct FileBuf *prev; }; #ifdef DEBUG_LOG FILE* DebugLog; #endif /* DEBUG_LOG */ DrawChars CharSet; /* These are the functions defined in files.c */ int SourceHomeFile(GameStats* Game); int SourceGlobalFile(GameStats* Game); int SourceFile(GameStats* Game,FILE* PrefsFile); int WritePrefsFile(GameStats* Game); int OldPrefsFile(GameStats* Game); /* These are the functions defined in drawing.c */ void StartCurses(); void PrintInfo(); void AskPrefs(GameStats* Game); void Help(); void PrintBestTimes(char* FileName); int DrawBoard(GameStats* Game); void DrawCursor(GameStats* Game); void UndrawCursor(GameStats* Game); int Pan(GameStats* Game); int Center(GameStats* Game); int CenterY(GameStats* Game); int CenterX(GameStats* Game); /* These are the functions defined in game.c */ int CheckColor(int NewVal); int CheckFast(int NewVal); int CheckHeight(int NewVal); int CheckLineDraw(int NewVal); int CheckNumMines(int NewVal, int Height, int Width); int CheckPercent(int NewVal); int CheckWidth(int NewVal); int InitGame(GameStats* Game); int ReadyGame(GameStats* Game); void SwitchCharSet(GameStats* Game); int InitCharSet(GameStats* Game,int Value); void SetCharSet(int Value); int ParseArgs(GameStats* Game, int Argc, char** Argv); void DumpGame(GameStats* Game); int ReReadyGame(GameStats* Game); void Wipe(GameStats *Game); /* These are the functions defined in play.c */ int GetInput(GameStats* Game); void MoveLeft(GameStats* Game, int Num); void MoveRight(GameStats* Game, int Num); void MoveUp(GameStats* Game, int Num); void MoveDown(GameStats* Game, int Num); void Boom(void); void YouWin(void); int ClickSquare(GameStats* Game, int ThisX, int ThisY); int DoubleClickSquare(GameStats* Game, int ThisX, int ThisY); /* These are the functions defined in error.c */ void SweepError(char* format, ...); int InitErrorWin(GameStats* Game); void ClearError(); int RedrawErrorWin(); void SweepAlert(); void SweepMessage(char* format, ...); void ChangeSweepAlert(int NewAlert); /* These are the functions defined in stats.c */ void PrintStats(GameStats *Game); int InitStatsWin(void); int RedrawStatsWin(void); /* These are the functions described in utils.c */ void* xmalloc(size_t num); char* xgetcwd(char *buf, size_t size); DIR* xopendir(const char *buf); void StartTimer(void); void StopTimer(void); /* this is in pbests.c, which will eventually become bests.c */ void UpdateBestTimesFile(GameStats *Game, char *filename); char* FPTBTF(void); #if defined USE_GROUP_BEST_FILE char* FPTGBTF(void); #endif /* These are the functions defined in clear.c */ void InsertMark(struct Mark **ht, int x, int y); char DeleteRandomMark(struct Mark **ht, int *x, int *y); void Clear(GameStats *Game); void SuperClear(GameStats *Game); int FindNearest(GameStats *Game); int FindNearestBad(GameStats *Game); /* These are the functions in fgui.c */ char* FSGUI(void); /* macros to lookup crap in the look up table for the clearing algo */ #define LOOKUP(t, xx, yy) \ (unsigned char)((t)[(xx)/8 + yy * g_table_w]) & \ (((unsigned char)0x80)>>((xx)%8)) #define SET(t, xx, yy) \ ((t)[(xx)/8 + yy * g_table_w]) |= \ (((unsigned char)0x80)>>((xx)%8)) #define UNSET(t, xx, yy) \ ((t)[(xx)/8 + yy * g_table_w]) &= \ ~(((unsigned char)0x80)>>((xx)%8)) /* functions defined in sl.c for save/load games */ void SaveGame(GameStats* Game, char *fname); GameStats* LoadGame(char *fname); /* functions defined in gpl.c */ void PrintGPL(); /* functions defined in tick.c */ extern volatile unsigned int g_tick; RETSIGTYPE sighandler(int signo); /* functions in image.c */ void SaveGameImage(GameStats* Game, char *fname); #endif /* __SWEEP_H__ */ freesweep-0.90/freesweep.6.in0100640002255600003100000001502506753654406015660 0ustar hartmannusers.TH FREESWEEP 6 "Version 0.86" "Gus Hartmann & Pete Keller" .SH NAME freesweep \- a curses minesweeper-style game .SH SYNOPSIS .TP 6 \fBfreesweep\fP [\fB\-%\fP\ \fIvalue\fP] [\fB\-a\fP] [\fB\-f\fP\ |\ \fB\-i\fP] [\fB\-h\fP\ \fIvalue\fP] [\fB\-m\fP\ \fIvalue\fP] [\fB\-s\fP] [\fB\-w\fP\ \fIvalue\fP] [\fB\-\-alt\-charset\fP] [\fB\-\-fast\fP] [\fB\-\-height=\fP\fIvalue\fP] [\fB\-\-interactive\fP\ |\ \fB\-\-save\-prefs\fP] [\fB\-\-mines=\fP\fIvalue\fP] [\fB\-\-percent=\fP\fIvalue\fP] [\fB\-\-width=\fP\fIvalue\fP] .TP 6 \fBfreesweep\fP [\fB\-a\fP] [\fB\-b\fP\ |\ \fB\-d\fP] [\fB\-\-alt\-charset\fP] [\fB\-\-dump\-best\-times\fP\ |\ \fB\-\-show\-best\-times\fP] .TP 6 \fBfreesweep\fP [\fB\-a\fP] [\fB\-g\fP] [\fB\-\-show\-gpl\fP] .TP 6 \fBfreesweep\fP [\fB\-v\fP] [\fB\-\-version\fP] .TP 6 \fBfreesweep\fP [\fB\-H\fP] [\fB\-\-help\fP] .SH DESCRIPTION \fBfreesweep\fP is a curses-based minesweeper game for *nix. .SH OPTIONS .TP \fB\-%\fP\ \fIvalue\fP, \fB\-\-percent=\fP\fIvalue\fP Sets the number of mines to \fIvalue\fP percent of the number of squares on the board, rounded to the nearest integer. This option cannot be used with the \-m or \-\-mines options. .TP \fB\-a\fP, \fB\-\-alt\-charset\fP Switch character sets between standard ASCII and PC-style linedraw characters. Use of this option on the command line indicates that the character set should be the set \fInot\fP specified in the preferences file. See the FILES section below. The character set can also be toggled during play using the 'a' key, which can be useful when a terminal fails to have the PC-style linedraw character set. See the COMMANDS section below. .TP \fB\-b\fP, \fB\-\-show\-best\-times\fP Use the curses best times viewer rather than starting a game, then exit. The best times viewer can also be accessed during play by selecting the 'b' key. See the COMMANDS section below. .TP \fB\-d\fP, \fB\-\-dump\-best\-times\fP Print the list of best times, sorted in descending order to stdout. More information will be placed in this manual page regarding the column format when it has been clearly established. .TP \fB\-f\fP, \fB\-\-fast\fP This option bypasses the intercative dialog normally run initially. All values must either be specified on the command line or in the preferences files. .TP \fB\-g\fP, \fB\-\-show\-gpl\fP Display the GNU General Public License, in a nice curses page viewer. Currently version 2 of the license is displayed; however, freesweep is licensed under version 2 or later of the GNU GPL, so this license may be superceded in the future. .TP \fB\-H\fP, \fB\-\-help\fP Print the lost of valid command line options, then exit. .TP \fB\-h\fP\ \fIvalue\fP, \fB\-\-height=\fP\fIvalue\fP Set height to \fIvalue\fP. If the interactive dialog is run initially, any value passed for height will be listed as the default. .TP \fB\-i\fP, \fB\-\-interactive\fP Force the interactive menu to be run initially. This is primarily used to override the FastStart option specified in the preferences file. It cannot be used with the \fB\-f\-fP or \fB\-\-fast\fP options. .TP \fB\-m\fP\ \fIvalue\fP, \fB\-\-mines=\fP\fIvalue\fP Set the number of mines to \fIvalue\fP. This option cannot be used with the \-% or \-\-percent options. .TP \fB\-s\fP, \fB\-\-save\-prefs\fP Save any preferences passed on the command line. This option is normally used with the FastStart option (specified with \fB\-f\fP or \fB\-\-fast\fP) .TP \fB\-v\fP, \fB\-\-version\fP Display version information and exit. Use of this option overrides all other options. .TP \fB\-w\fP\ \fIvalue\fP, \fB\-\-width=\fP\fIvalue\fP Set width to \fIvalue\fP. If the interactive dialog is run initially, any value passed for width will be listed as the default. .SH COMMANDS When started normally, freesweep will conduct a dialog to query the following information from the player: height and width of the board, number of mines (as either an integer or in terms of size of the board), if PC-style line drawing characters are to be used, if future games should use FastStart mode, how to announce alerts (beep, visual bell, or none), and if the newly entered preferences should be saved. This dialog is skipped if the \-f or \-\-fast flags are passed, or if the FastStart option is selected in the preference file. In normal play, freesweep waits for keystrokes, and then reacts according to the recieved value. Some keystrokes may be modified by a preceding integer; these are noted in the list below by a preceding \fIn\fP. The following keystroke values are valid: .TP \fIn\fP\, \fIn\fPh, \fIn\fPj, \fIn\fPk, \fIn\fPl The arrow keys move the cursor \fIn\fP squares in the corresponding direction, as limited by the boundaries of the playing field. A warning is issued should this occur. The default integer is one. The vi-style motion keys h, j, k, and l are also accepted, and are equivalent to the arrow keys. .TP a Toggle between the standard ASCII character set and PC-style linedraw. .TP b Display the best times list, one screenful at a time. The game clock is suspended for the duration of the best times viewer. .TP g Display the GNU General Public License, version 2. The game clock is suspended for the duration of the viewing of the GNU GPL. The text is displayed one screenful at a time; 'q' returns to game play, any other key advances to the next screenful. .TP ? Display a help screen, containing a listing of valid commands. The game clock is suspended for the duration of the viewing of this screen. .TP f Toggle flagging the current square as a mine. Flagged squares cannot be exposed. .TP .SH FILES .TP 10 .I ~/.sweeprc The user's sweep resource file. .TP 10 .I ~/.sweeptimes The user's sweep best times file. .TP 10 \fI@PREFSDIR@/sweeprc\fP The global default sweep resource file. .TP 10 \fI@SCORESDIR@/sweeptimes\fP The shared best times file. The global preference file is read first, then the player's preference file. Any command line options are considered next, and lastly any input from the interactive dialog. .SH AUTHORS Gus Hartmann .br Pete Keller .br .SH CREDITS This program would not have been written had there been more machines capable of running X Windows in the lab where I learned to program, the .I Undergraduate Project Lab at the \fIUniversity of Wisconsin Department of Computer Sciences\fP .SH BUGS The best times code is currently only partially implemented. The viewer for the GNU GPL and the best times cannot go backwards. This manual page always includes the GNU-style long options, even on systems which do not support them. Other bugs should be reported to . freesweep-0.90/CHANGES0100640002255600003100000000040506746447162014167 0ustar hartmannusers24 April 1999 Fixed build for Cygwin32 platform - thanks to Alan de Smet 22 July 1999 Changed strings.h to string.h , and added maintainer-clean to Makefile.in - thanks to Antti-Juhani Kaijanaho Fixed the output for usage. freesweep-0.90/config.h.in0100640002255600003100000000673707603236461015224 0ustar hartmannusers/* config.h.in. Generated automatically from configure.in by autoheader. */ /* acconfig.h This file is in the public domain. Descriptive text for the C preprocessor macros that the distributed Autoconf macros can define. No software package will use all of them; autoheader copies the ones your configure.in uses into your configuration header file templates. The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). Although this order can split up related entries, it makes it easier to check whether a given entry is in the file. Leave the following blank line there!! Autoheader needs it. */ /* Set this to be blah blah blah. */ /* #ifndef DEBUG_LOG #define DEBUG_LOG debug.log #endif */ #undef DEBUG_LOG /* Set this blah blah blah. */ #undef SCORESDIR /* Comment this out to use a shared best times file. */ #undef USE_GROUP_BEST_FILE /* Leave that blank line there!! Autoheader needs it. If you're adding to this file, keep in mind: The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). */ /* Define if you have the header file. */ #undef HAVE_ERRNO_H /* Define if you have the `fileno' function. */ #undef HAVE_FILENO /* Define if you have the `flock' function. */ #undef HAVE_FLOCK /* Define if you have the `getopt' function. */ #undef HAVE_GETOPT /* Define if you have the header file. */ #undef HAVE_GETOPT_H /* Define if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define if you have the `get_current_dir_name' function. */ #undef HAVE_GET_CURRENT_DIR_NAME /* Define if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if you have the `curses' library (-lcurses). */ #undef HAVE_LIBCURSES /* Define if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define if you have the header file. */ #undef HAVE_LIMITS_H /* Define if you have the `lockf' function. */ #undef HAVE_LOCKF /* Define if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define if you have the header file. */ #undef HAVE_MEMORY_H /* Define if you have the `memset' function. */ #undef HAVE_MEMSET /* Define if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define if you have the `sprintf' function. */ #undef HAVE_SPRINTF /* Define if you have the header file. */ #undef HAVE_STDINT_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define if you have the header file. */ #undef HAVE_STRINGS_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define if you have the `vsprintf' function. */ #undef HAVE_VSPRINTF /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `unsigned' if does not define. */ #undef size_t freesweep-0.90/sweep.h0100640002255600003100000002122507603236537014466 0ustar hartmannusers/********************************************************************* * $Id: sweep.h.in,v 1.36 2002/12/21 21:32:09 hartmann Exp $ *********************************************************************/ #ifndef __SWEEP_H__ #define __SWEEP_H__ #include "config.h" #define mkstr(s) # s /* The library header files. */ #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #ifdef HAVE_GETOPT_H #include #endif /* HAVE_GETOPT_H */ #ifdef HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_LIBNCURSES #include "/ncurses.h" #define DEFAULT_LINEDRAW 1 #else /* HAVE_LIBNCURSES */ #include #define DEFAULT_LINEDRAW 0 #endif /* HAVE_LIBNCURSES */ #if defined HAVE_FLOCK && defined HAVE_SYS_FILE_H #include #endif #if defined(HAVE_LIMITS_H) #include #endif /* XXX make this work with configure */ #include #include #ifdef NCURSES_MOUSE_VERSION #define SWEEP_MOUSE #endif /* NCURSES_MOUSE_VERSION */ #if defined SCORESDIR #define USE_GROUP_BEST_FILE #endif #include "defaults.h" /* These are all the defines used in freesweep */ /* These are defines for convenience */ #define DELIMITERS " \t=" #define DFL_GROUP_PATH "" #define MAGIC_NUMBER 128 #ifdef __CYGWIN__ #define DFL_PREFS_FILE "_sweeprc" #define DFL_BESTS_FILE "_sweeptimes" #else #define DFL_PREFS_FILE ".sweeprc" #define DFL_BESTS_FILE ".sweeptimes" #endif /* __CYGWIN__ */ #define GLOBAL_PREFS_FILE "/usr/local/share/sweeprc" /* used for the superclick feature in the game */ #define SUPERCLICK 0 #define DIE 1 #define DONOTHING 2 /* These are defines for maximum accepted values */ #define MAX_LINE 1024 #define MAX_H 2048 #define MAX_W 2048 #define L_MAX_H 4 #define L_MAX_W 4 #define INFO_W 21 #define MAX_NAME 80 #define MAX_DATE 26 /* These are the macros for cell values. */ #define UNKNOWN 0x0 #define MINE 0x9 #define MARKED 0xa #define BAD_MARK 0xb #define EMPTY 0xc #define DETONATED 0xd /* These are for winning and losing. */ #define INPROG 0 #define WIN 1 #define LOSE 2 #define ABORT 3 #define RECONF 4 /* These are for the alert types. */ #define BEEP 0 #define FLASH 1 #define NO_ALERT 2 /* These are the macros that reduce the memory usage by *half*. */ #define GetMine(x,y,ret) \ ret=(unsigned char)(!((ret)=Game->Field[((x)/2+(y)*( ( Game->Width +1 )/2))])\ ?UNKNOWN:((x)%2)?(ret)&0x0f:((ret)&0xf0)>>4) #define SetMine(x,y,val) \ Game->Field[((x)/2)+(y)*( ( Game->Width +1 )/2)]=(!((x)%2)?((Game->Field[((x)\ /2)+(y)*( ( Game->Width +1 )/2)]&0x0f)|((unsigned char)(val)<<4)):\ ((Game->Field[((x)/2)+(y)*( ( Game->Width +1 ) /2)]&0xf0)|((unsigned char)(val)\ &0x0f))) /* This extends the naming convention of ncurses functions. */ #define mvclrtoeol(y,x) (move(y,x)==ERR?ERR:clrtoeol()); #define noutrefresh() wnoutrefresh(stdscr) #ifndef mvwhline #define mvwhline(w,y,x,z,n) (wmove(w,y,x)==ERR?ERR:whline(w,z,n)); #endif /* mvwhline */ #ifndef mvwvline #define mvwvline(w,y,x,z,n) (wmove(w,y,x)==ERR?ERR:wvline(w,z,n)); #endif /* mvwvline */ #ifndef mvgetnstr #define mvgetnstr(y, x, str, n) (wmove(stdscr, y, x)==ERR?ERR:wgetnstr(stdscr, str, n)); #endif /* mvgetnstr */ #ifndef ValidCoordinate #define ValidCoordinate(x,y) ( ( (x>=0) && (xWidth) && (y>=0) && (yHeight) ) ? 1 : 0 ) #endif /* These are all the structs used in freesweep */ /* This is the struct containing all the various drawing characters. */ typedef struct _DrawChars { chtype ULCorner; chtype URCorner; chtype LLCorner; chtype LRCorner; chtype HLine; chtype VLine; chtype UArrow; chtype DArrow; chtype LArrow; chtype RArrow; chtype Mine; chtype Space; chtype Mark; chtype FalseMark; chtype Bombed; } DrawChars; /* This is the struct containing all the relevant game information. */ typedef struct _GameStats { int Height; int Width; int Percent; unsigned int NumMines; unsigned int MarkedMines; unsigned int BadMarkedMines; int Color; int Fast; int Alert; int LineDraw; int CursorX, CursorY; int LargeBoardX, LargeBoardY; int Status; unsigned int FocusX, FocusY; unsigned int Time; unsigned char* Field; WINDOW* Border; WINDOW* Board; } GameStats; /* This is the struct for the clearing algo. */ struct Mark { int x, y; struct Mark *next; }; /* this is the _NEW_ format for the best times score */ struct BestEntry { unsigned int area; unsigned int mines; unsigned int time; char name[MAX_NAME]; char date[MAX_DATE]; char *attribs; }; struct BestFileDesc { /* the array of entries from the file, with one more in it. */ struct BestEntry *ents; /* the number of entries in the descriptor */ int numents; /* did I replace, or add? */ int replflag; }; typedef struct _CoordPair { int CoordX, CoordY; } CoordPair; /* stuff needed for the file gui */ /* this is not very well designed, but oh well */ struct FileBuf { char *fpath; char *path; int numents; struct FileBuf *next; struct FileBuf *prev; }; #ifdef DEBUG_LOG FILE* DebugLog; #endif /* DEBUG_LOG */ DrawChars CharSet; /* These are the functions defined in files.c */ int SourceHomeFile(GameStats* Game); int SourceGlobalFile(GameStats* Game); int SourceFile(GameStats* Game,FILE* PrefsFile); int WritePrefsFile(GameStats* Game); int OldPrefsFile(GameStats* Game); /* These are the functions defined in drawing.c */ void StartCurses(); void PrintInfo(); void AskPrefs(GameStats* Game); void Help(); void PrintBestTimes(char* FileName); int DrawBoard(GameStats* Game); void DrawCursor(GameStats* Game); void UndrawCursor(GameStats* Game); int Pan(GameStats* Game); int Center(GameStats* Game); int CenterY(GameStats* Game); int CenterX(GameStats* Game); /* These are the functions defined in game.c */ int CheckColor(int NewVal); int CheckFast(int NewVal); int CheckHeight(int NewVal); int CheckLineDraw(int NewVal); int CheckNumMines(int NewVal, int Height, int Width); int CheckPercent(int NewVal); int CheckWidth(int NewVal); int InitGame(GameStats* Game); int ReadyGame(GameStats* Game); void SwitchCharSet(GameStats* Game); int InitCharSet(GameStats* Game,int Value); void SetCharSet(int Value); int ParseArgs(GameStats* Game, int Argc, char** Argv); void DumpGame(GameStats* Game); int ReReadyGame(GameStats* Game); void Wipe(GameStats *Game); /* These are the functions defined in play.c */ int GetInput(GameStats* Game); void MoveLeft(GameStats* Game, int Num); void MoveRight(GameStats* Game, int Num); void MoveUp(GameStats* Game, int Num); void MoveDown(GameStats* Game, int Num); void Boom(void); void YouWin(void); int ClickSquare(GameStats* Game, int ThisX, int ThisY); int DoubleClickSquare(GameStats* Game, int ThisX, int ThisY); /* These are the functions defined in error.c */ void SweepError(char* format, ...); int InitErrorWin(GameStats* Game); void ClearError(); int RedrawErrorWin(); void SweepAlert(); void SweepMessage(char* format, ...); void ChangeSweepAlert(int NewAlert); /* These are the functions defined in stats.c */ void PrintStats(GameStats *Game); int InitStatsWin(void); int RedrawStatsWin(void); /* These are the functions described in utils.c */ void* xmalloc(size_t num); char* xgetcwd(char *buf, size_t size); DIR* xopendir(const char *buf); void StartTimer(void); void StopTimer(void); /* this is in pbests.c, which will eventually become bests.c */ void UpdateBestTimesFile(GameStats *Game, char *filename); char* FPTBTF(void); #if defined USE_GROUP_BEST_FILE char* FPTGBTF(void); #endif /* These are the functions defined in clear.c */ void InsertMark(struct Mark **ht, int x, int y); char DeleteRandomMark(struct Mark **ht, int *x, int *y); void Clear(GameStats *Game); void SuperClear(GameStats *Game); int FindNearest(GameStats *Game); int FindNearestBad(GameStats *Game); /* These are the functions in fgui.c */ char* FSGUI(void); /* macros to lookup crap in the look up table for the clearing algo */ #define LOOKUP(t, xx, yy) \ (unsigned char)((t)[(xx)/8 + yy * g_table_w]) & \ (((unsigned char)0x80)>>((xx)%8)) #define SET(t, xx, yy) \ ((t)[(xx)/8 + yy * g_table_w]) |= \ (((unsigned char)0x80)>>((xx)%8)) #define UNSET(t, xx, yy) \ ((t)[(xx)/8 + yy * g_table_w]) &= \ ~(((unsigned char)0x80)>>((xx)%8)) /* functions defined in sl.c for save/load games */ void SaveGame(GameStats* Game, char *fname); GameStats* LoadGame(char *fname); /* functions defined in gpl.c */ void PrintGPL(); /* functions defined in tick.c */ extern volatile unsigned int g_tick; RETSIGTYPE sighandler(int signo); /* functions in image.c */ void SaveGameImage(GameStats* Game, char *fname); #endif /* __SWEEP_H__ */ freesweep-0.90/defaults.h0100640002255600003100000000071406753654406015156 0ustar hartmannusers/********************************************************************* * $Id: defaults.h,v 1.9 1999/08/06 07:25:26 hartmann Exp $ *********************************************************************/ #ifndef __DEFAULTS_H__ #define __DEFAULTS_H__ #define DEFAULT_HEIGHT 15 #define DEFAULT_WIDTH 15 #define DEFAULT_PERCENT 20 #define DEFAULT_COLOR 1 #define DEFAULT_NUMMINES 0 #define DEFAULT_FASTSTART 0 #define DEFAULT_ALERT 0 #endif /* __DEFAULTS_H__ */ freesweep-0.90/acconfig.h0100640002255600003100000000201707603236461015106 0ustar hartmannusers/* acconfig.h This file is in the public domain. Descriptive text for the C preprocessor macros that the distributed Autoconf macros can define. No software package will use all of them; autoheader copies the ones your configure.in uses into your configuration header file templates. The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). Although this order can split up related entries, it makes it easier to check whether a given entry is in the file. Leave the following blank line there!! Autoheader needs it. */ /* Comment this out to have a debug log file. */ #undef DEBUG_LOG /* Set this blah blah blah. */ #undef SCORESDIR /* Comment this out to use a shared best times file. */ #undef USE_GROUP_BEST_FILE /* Leave that blank line there!! Autoheader needs it. If you're adding to this file, keep in mind: The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). */