Пример #1
0
/**
 * puz_rusrstr_get - get the binary form of the rusr
 * 
 * @puz: a pointer to the struct puzzle_t
 *
 * returns a malloced string if possible, and otherwise NULL
 */
unsigned char* puz_rusrstr_get(struct puzzle_t *puz) {
  if (NULL == puz || NULL == puz->rusr)
    return NULL;

  int board_sz = puz->header.width * puz->header.height;

  unsigned char* rusrstr = malloc( (puz->rusr_sz) * sizeof(unsigned char) );

  int j,i = 0;
  for(j = 0; j < board_sz; j++) {
    if(NULL == puz->rusr[j]) {
      rusrstr[i] = 0;
    } else {
      // here we are allowed to not check length, because we did
      // that when we made the rusr board we're outputting
      Sstrcpy(rusrstr+i, (puz->rusr)[j]);
      i += Sstrlen((puz->rusr)[j]);
      rusrstr[i] = (unsigned char) 0;
    }
    i++;
  }
  return rusrstr;

}
Пример #2
0
void ComI(list_ref list, char *inputline, char *stdinline) {
  inputline = Sstrcpy(inputline, stdinline);
  insert_listi(list, inputline);
  viewcurr_list(list);
}