MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / adfEntBlock2Entry

Function adfEntBlock2Entry

dep/adflib/src/adf_dir.c:555–615  ·  view source on GitHub ↗

* adfEntBlock2Entry * */

Source from the content-addressed store, hash-verified

553 *
554 */
555RETCODE adfEntBlock2Entry(struct bEntryBlock *entryBlk, struct Entry *entry)
556{
557 char buf[MAXCMMTLEN+1];
558 int len;
559
560 entry->type = entryBlk->secType;
561 entry->parent = entryBlk->parent;
562
563 len = min(entryBlk->nameLen, MAXNAMELEN);
564 strncpy(buf, entryBlk->name, len);
565 buf[len] = '\0';
566 entry->name = strdup(buf);
567 if (entry->name==NULL)
568 return RC_MALLOC;
569/*printf("len=%d name=%s parent=%ld\n",entryBlk->nameLen, entry->name,entry->parent );*/
570 adfDays2Date( entryBlk->days, &(entry->year), &(entry->month), &(entry->days));
571 entry->hour = entryBlk->mins/60;
572 entry->mins = entryBlk->mins%60;
573 entry->secs = entryBlk->ticks/50;
574
575 entry->access = -1;
576 entry->size = 0L;
577 entry->comment = NULL;
578 entry->real = 0L;
579 switch(entryBlk->secType) {
580 case ST_ROOT:
581 break;
582 case ST_DIR:
583 entry->access = entryBlk->access;
584 len = min(entryBlk->commLen, MAXCMMTLEN);
585 strncpy(buf, entryBlk->comment, len);
586 buf[len] = '\0';
587 entry->comment = strdup(buf);
588 if (entry->comment==NULL) {
589 free(entry->name);
590 return RC_MALLOC;
591 }
592 break;
593 case ST_FILE:
594 entry->access = entryBlk->access;
595 entry->size = entryBlk->byteSize;
596 len = min(entryBlk->commLen, MAXCMMTLEN);
597 strncpy(buf, entryBlk->comment, len);
598 buf[len] = '\0';
599 entry->comment = strdup(buf);
600 if (entry->comment==NULL) {
601 free(entry->name);
602 return RC_MALLOC;
603 }
604 break;
605 case ST_LFILE:
606 case ST_LDIR:
607 entry->real = entryBlk->realEntry;
608 case ST_LSOFT:
609 break;
610 default:
611 (*adfEnv.wFct)("unknown entry type");
612 }

Callers 3

adfBlockPtr2EntryNameFunction · 0.85
adfFindEntryFunction · 0.85
adfGetRDirEntFunction · 0.85

Calls 1

adfDays2DateFunction · 0.85

Tested by

no test coverage detected