Beispiel #1
0
/*
 *  SDL_IOCCMRESET
 *  -----------------------------------
 */
STATIC int
sdl_ioccmreset(queue_t *q, mblk_t *mp)
{
	spm_t *s = PRIV(q);
	void *arg = mp->b_cont ? mp->b_cont->b_rptr : NULL;

	(void) s;
	(void) arg;
	fixme(("Master reset\n"));
	return (-EOPNOTSUPP);
}
Beispiel #2
0
/*
 *  SDL_IOCCCONFIG
 *  -----------------------------------
 */
STATIC int
sdl_ioccconfig(queue_t *q, mblk_t *mp)
{
	spm_t *s = PRIV(q);
	void *arg = mp->b_cont ? mp->b_cont->b_rptr : NULL;

	(void) s;
	(void) arg;
	fixme(("Commit the configuration\n"));
	return (-EOPNOTSUPP);
}
Beispiel #3
0
int main(int argc, char **argv) {
    FILE *changes;
    FILE *tochange;
    struct diff diff;
    char line[128];
    char ch[1]={'a'};
    int message = 0;
    char c;
    int reverse=0;
    int pid;
    int count = 0;
    int status;
    
    while (1) {
      c = getopt (argc, argv, "rmh");
      if (c == -1) {
	  break;
      }
      switch (c) {
      case 'r':
	  printf ("User has invoked with -r.\n");
	  reverse = 1;
	  break;
      case 'h':
	  printf ("OPTIONS\n   -h  print a summary of options and exit\n   -r  reverse the differences\n   -m  print a message each time a change is applied\n");
	  
	  break;
      case 'm':
	  printf ("User has invoked with -m.\n");
	  message = 1;
	  break;
      case '?':
      default:
	  printf ("Usage: %s [-a] [-b <something>].\n", argv[0]);
	  break;
	} 
    }
   if(argc != optind+2)
     printf("illigel input\n%d %d",argc,optind);
   else{

    tochange = fopen(argv[optind], "rb+");    
    changes = fopen(argv[optind+1], "r");
   
    
    while ( fgets ( line, 128, changes ) != NULL )
      {
	parsediff(line, &diff);
	fseek(tochange, diff.offset, SEEK_SET );
	ch[0] = (char)getc(tochange);
	if (!reverse){
	  if (ch[0] == diff.old){
		    
	    count++;
	    pid = fork();
	    if(pid == 0){
	        printf("%d\n",count);
	      fixme(tochange,diff);
	      exit(0);
	      }
	    }
	  }
	
     }
    fclose(tochange);
    fclose(changes);
   }
   	    if (pid != 0){

	      while (count > 0){
		wait(&status);
		printf("exit with status %ld\n",(long)status);
		count--;
	      }
	    }
    return 0;
}
Beispiel #4
0
int main(int argc, char **argv)
{
    int i;
    char buf[12];
    const char *arg, *orders = 0, *cfgfile = 0;

    rnd_seed((unsigned int) time(0));

    puts("Atlantis v1.0 " __DATE__ "\n"
         "Copyright 1993 by Russell Wallace.\n"
         "Type ? for list of commands.");

    turn = -1;
    for (i = 1; i != argc; ++i) {
        if (argv[i][0] == '-') {
            switch (argv[i][1]) {
            case 'c':
                cfgfile = (argv[i][2]) ? (argv[i] + 2) : argv[++i];
                break;
            case 'i':
                ignore_password = 1;
                break;
            case 'p': /* process */
                orders = (argv[i][2]) ? (argv[i] + 2) : argv[++i];
                break;
            case 't': /* turn */
                arg = (argv[i][2]) ? (argv[i] + 2) : argv[++i];
                turn = atoi(arg);
                break;
            default:
                fprintf(stderr, "invalid argument %d: '%s'\n", i, argv[i]);
                return -1;
            }
        }
    }

    if (cfgfile) {
        FILE * F = fopen(cfgfile, "r");
        if (F) {
            cJSON *json;
            char *data;
            size_t len;
            fseek(F, 0,SEEK_END);
            len = ftell(F);
            fseek(F,0,SEEK_SET);
            data = (char *)malloc(len+1);
            if (data) {
                fread(data,1,len,F);
            }
            json = cJSON_Parse(data);
            if (json) {
                read_config_json(json);
                cJSON_Delete(json);
            } else {
                fprintf(stderr, "could not parse configuration file '%s'\n", cfgfile);
            }
            free(data);
        } else {
            fprintf(stderr, "could not open configuration file '%s'\n", cfgfile);
            return errno ? errno : -1;
        }
    }
    initgame();
    if (orders) {
        return processturn(orders);
    }

    for (;;) {
        printf("> ");
        fgets(buf, sizeof(buf), stdin);

        switch (tolower(buf[0])) {
        case 'm':
            writemap(stdout);
            break;

        case 'g':
            turn = 0;
            cleargame(false);
            autoworld("players");
            writemap(stdout);
            break;

        case 'r':
            reports();
            break;
        case 'f':
            fixme();
            break;

        case 'w':
            writesummary();
            writegame();
            break;

        case 'p':
            printf("Name of orders file? ");
            fgets(buf, sizeof(buf), stdin);
            if (!buf[0]) return -1;
            return processturn(buf);

        case 'q':
            return 0;

        default:
            puts("C - Create New Continent.\n"
                 "A - Add New Players.\n"
                 "M - Draw Map.\n"
                 "P - Process Game Turn.\n"
                 "R - Write Reports.\n"
                 "G - Generate New World.\n"
                 "Q - Quit.\n"
                 "W - Write Game.\n");
        }
    }
}