~ubuntu-branches/ubuntu/vivid/xmountains/vivid

« back to all changes in this revision

Viewing changes to xmountains.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2008-06-11 19:35:06 UTC
  • mfrom: (3.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080611193506-f9w3mgbd3zejd4oq
Tags: 2.7-8
Change Build-Depends: xutils-dev. (Closes: #485719)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
#include <stdio.h>
3
 
#include <stdlib.h>
4
3
#include <signal.h>
5
 
#include <sys/types.h>
6
 
#include <unistd.h>
7
4
#include "crinkle.h"
8
5
#include "paint.h"
9
6
#include "patchlevel.h"
18
15
char *display;
19
16
extern char *geom;
20
17
 
21
 
extern int swosh;
22
 
 
23
18
/* {{{ my version on getopt*/
24
19
int optind=1;
25
20
char *optarg;
82
77
 
83
78
double atof();
84
79
#ifdef ANSI
85
 
void init_graphics (int, Window, int,int, Graph *, Gun *, Gun *, Gun *);
 
80
void init_graphics (int, unsigned long, int, int *, int *, int, Gun *, Gun *, Gun *);
86
81
void clear_col( int );
87
82
void finish_graphics();
88
83
void plot_pixel (int, int, unsigned char);
135
130
  return id;
136
131
}
137
132
 
138
 
void init_parameters();
139
 
void print_algorithm();
140
 
void seed_uni(int ijkl);
141
 
void plot_column(Graph *g);
142
 
 
143
 
int main (argc,argv)
 
133
main (argc,argv)
144
134
int argc;
145
135
char **argv;
146
136
{
147
 
  int i;
 
137
  int i,p;
148
138
  int e_events=FALSE;
149
139
  int request_clear=FALSE;
150
 
  int smooth = 0;
 
140
  int smooth;
151
141
  int snooze=10;
152
142
  int root= 0;
153
143
  unsigned long window_id = 0;
159
149
  char *mesg[2];
160
150
  Gun *clut[3];
161
151
  FILE *pidfile;
162
 
  swosh = 0;          /* default is ! -w */
163
152
 
164
153
  init_parameters();
165
154
  /* {{{ handle command line flags*/
168
157
 
169
158
  mesg[0]="false";
170
159
  mesg[1]="true";
171
 
  while((c = my_getopt(argc,argv,"wbxmqMEHl:r:f:t:I:A:S:T:W:C:a:p:B:n:R:g:d:c:e:v:Z:s:X:Y:P:F:G:"))!= -1)
 
160
  while((c = my_getopt(argc,argv,"bxmqMEHl:r:f:t:I:A:S:T:W:C:a:p:B:n:R:g:d:c:e:v:Z:s:X:Y:P:F:G:"))!= -1)
172
161
  {
173
162
    switch(c){
174
 
      case 'w':
175
 
        swosh = TRUE;               /* update window only when pixmap is complete */
176
 
        break;
177
 
 
178
163
      case 'b':
179
164
        root = 1- root;
180
165
        break;                      /* run on root window */
369
354
  if( errflg )
370
355
  {
371
356
    fprintf(stderr,"%s: version %d.%d\n",argv[0],VERSION,PATCHLEVEL);
372
 
    fprintf(stderr,"usage: %s -[wbqgdPEmMrBZIASFTCapcevfRltxsXYH]\n",argv[0]);
373
 
    fprintf(stderr," -w       [%s] update window with complete images only\n",mesg[swosh]);
 
357
    fprintf(stderr,"usage: %s -[bqgdPEmMrBZIASFTCapcevfRltxsXYH]\n",argv[0]);
374
358
    fprintf(stderr," -b       [%s] use root window \n",mesg[root]);
375
359
    fprintf(stderr," -q       [%s] reset root window on exit\n",mesg[request_clear]);
376
360
    fprintf(stderr," -g string     window geometry\n");
421
405
    }
422
406
  }
423
407
  set_clut(g.n_col,clut[0], clut[1], clut[2]);
424
 
 init_graphics(root,window_id, !e_events, request_clear, &g, clut[0], clut[1], clut[2]);
425
 
 
 
408
  init_graphics(root, window_id, (! e_events),request_clear,&g.graph_width,&g.graph_height,g.n_col,clut[0],clut[1],clut[2]);
426
409
  for(i=0;i<3;i++)
427
410
  {
428
411
    free(clut[i]);
432
415
  seed_uni(seed);
433
416
 
434
417
  init_artist_variables();
435
 
  if( SIG_ERR == signal(SIGINT, finish_prog ))
436
 
  {
437
 
    perror(argv[0]);
438
 
    exit(1);
439
 
  }
440
 
  if( SIG_ERR == signal(SIGTERM, finish_prog ))
441
 
  {
442
 
    perror(argv[0]);
443
 
    exit(1);
444
 
  }
445
 
  if( SIG_ERR == signal(SIGHUP, finish_prog ))
446
 
  {
447
 
    perror(argv[0]);
448
 
    exit(1);
449
 
  }
450
 
  if( SIG_ERR == signal(SIGQUIT, finish_prog ))
 
418
  if( -1 == (int) signal(SIGINT, finish_prog ))
 
419
  {
 
420
    perror(argv[0]);
 
421
    exit(1);
 
422
  }
 
423
  if( -1 == (int) signal(SIGTERM, finish_prog ))
 
424
  {
 
425
    perror(argv[0]);
 
426
    exit(1);
 
427
  }
 
428
  if( -1 == (int) signal(SIGHUP, finish_prog ))
 
429
  {
 
430
    perror(argv[0]);
 
431
    exit(1);
 
432
  }
 
433
  if( -1 == (int) signal(SIGQUIT, finish_prog ))
451
434
  {
452
435
    perror(argv[0]);
453
436
    exit(1);