Пример #1
0
void show_area_tots(char *areap) {
    int i,idx;
    unsigned int  bullcnt, holdcnt, trafcnt;
    long bullsz, holdsz, trafsz, totsz;
    struct indexhdr hdr;
    struct mailindex ind;
    char buf[FILE_PATH_SIZE], *cp;
#define BM_HOLD 8
  
    sprintf(buf,"%s/%s", Mailspool, areap);
    if ((cp=strrchr(areap,'.')) != NULL) *cp='\0';
    if((idx = open(buf,READBINARY)) != -1) {
        if(read_header(idx,&hdr) == -1)
            hdr.msgs = 0;

        memset(&ind,0,sizeof(ind));

        bullcnt = holdcnt = trafcnt = 0U;
        bullsz = holdsz = trafsz = totsz = 0L;
	for(i=1;i<=hdr.msgs;i++) {
            default_index("",&ind);
            if(read_index(idx,&ind) == -1) {
                puts("* index read err *");
                break;
            }
            totsz += ind.size;
            if (ind.type == 'B') {bullsz += ind.size; bullcnt++;}
            if (ind.type == 'T') {trafsz += ind.size; trafcnt++;}
            if (ind.status & BM_HOLD) {holdsz += ind.size; holdcnt++;}
	}
        printf("%-27s%6u %5ldK ",areap,hdr.msgs, (totsz+1023)/1024);
        allsz += totsz;
        
        if (hdr.msgs) {
            allmsgcnt += hdr.msgs;
            if (bullcnt) printf("%6u %5ldK", bullcnt, (bullsz+1023)/1024);
            else printf("%12s", " ");
            if (trafcnt) printf("%6u %5ldK", trafcnt, (trafsz+1023)/1024);
            else printf("%12s", " ");
            if (holdcnt) printf("%6u %5ldK", holdcnt, (holdsz+1023)/1024);
            /*else printf("%12s", " ");*/
        }
        printf("\n");
        default_index("",&ind);
        close(idx);
    }
}
Пример #2
0
int LookForBid(char *file) {
/* scan index associated with <file> for a msg containing bid Bid2Find */

    struct indexhdr hdr;
    struct mailindex ind;
    char buf[FILE_PATH_SIZE], *cp;
    int idx,i,bidlen, serr = 0;

    dirformat(file);
    sprintf(buf,"%s/%s.ind",Mailspool,file);
    if((idx = open(buf,READBINARY)) == -1) {
        printf("Can not read index file %s\n",buf);
        return -1;
    }
  
    memset(&ind,0,sizeof(ind));
    default_index("",&ind);
    bidlen=strlen(Bid2Find);
  
    /* Read the index file header */
    if (read_header(idx,&hdr) == 0)
	{
		for(i=1;i<=hdr.msgs;i++)
		{
        	if (read_index(idx,&ind) == -1)
			{
        		serr = 1;
				break;
			}
        	if(strnicmp(ind.messageid,Bid2Find,bidlen) == 0) {
            	if (*(ind.messageid+bidlen) == '@')
                	printf("Bid %s found in msg #%d of area %s\n", Bid2Find, i, file);
        	}
        	/* Done with this index, clear it */
        	default_index("",&ind);
    	}
	}
    else serr = 1;

	if (serr)
		printf("Error reading index of %s\n", file);

    close(idx);
    return 0;
}
Пример #3
0
void show_index(char *name, int msgidflag) {
    int i,idx;
    char *cp;
    struct indexhdr hdr;
    struct mailindex ind;
    char buf[129];
  
    if((cp=strchr(name,'.')) != NULL)
        *cp = '\0';
    sprintf(buf,"%s/%s.ind",Mailspool,name);
    if((idx = open(buf,READBINARY)) == -1) {
        printf("Index file '%s' not found!\n",buf);
        return;
    }
  
    if(read_header(idx,&hdr) == -1){
        printf("Can not read header from index file '%s'\n",buf);
        close(idx);
        return;
    }
  
    if (!msgidflag)
        printf("%s has %d message%s:\n\n",buf,hdr.msgs,(hdr.msgs == 1 ? "" : "s"));
  
    memset(&ind,0,sizeof(ind));
  
    for(i=1;i<=hdr.msgs;i++) {
        if (!msgidflag) printf("Message %d\n",i);
        default_index("",&ind);
        if(read_index(idx,&ind) == -1) {
            puts("Can not read index!");
            break;
        }
        if (msgidflag) {
            if (ind.msgid > highest_msgid) highest_msgid = ind.msgid;
        }
        else print_index(&ind);
    }
    default_index("",&ind);
    close(idx);
  
}
Пример #4
0
void UnionTypeCode::write_params
(TIDorb::core::cdr::CDROutputStream& output)
{
  ComplexTypeCode::write_params(output);

  output.write_TypeCode(m_discriminator_type);
  output.write_long(default_index());

  CORBA::ULong length = m_members->length();

  output.write_ulong(length);

  for(CORBA::ULong i = 0; i < length; i++) {
  output.write_any(((*m_members)[i]).label);
  output.write_string(((*m_members)[i]).name);
  output.write_TypeCode(((*m_members)[i]).type);
  }

}