Exemplo n.º 1
0
Pic *pic_load(char *name1, char *name2)
{
    Pic *p, *q;

    p = pic_open(name1, "r");
    if (!p) {
	fprintf(stderr, "pic_load: can't open %s\n", name1);
	return 0;
    }
    q = pic_open(name2, "w");
    if (!q) {
	fprintf(stderr, "pic_load: can't open %s\n", name2);
	pic_close(p);
	return 0;
    }
    pic_copy(p, q);
    pic_close(p);
    return q;
}
Exemplo n.º 2
0
void pic_save(Pic *p, char *name)
{
    Pic *q;

    q = pic_open(name, "w");
    if (!q) {
	fprintf(stderr, "pic_save: can't create %s\n", name);
	return;
    }
    pic_copy(p, q);
    pic_close(q);
}
Exemplo n.º 3
0
Arquivo: system.c Projeto: KeenS/benz
static pic_value
pic_system_exit(pic_state *pic)
{
  pic_value v;
  int argc, status = EXIT_SUCCESS;

  argc = pic_get_args(pic, "|o", &v);
  if (argc == 1) {
    switch (pic_type(v)) {
    case PIC_TT_FLOAT:
      status = (int)pic_float(v);
      break;
    case PIC_TT_INT:
      status = pic_int(v);
      break;
    default:
      break;
    }
  }

  pic_close(pic);

  exit(status);
}