14632Seric # include "sendmail.h" 24632Seric # include <sys/stat.h> 38348Seric # include <dir.h> 44634Seric # include <signal.h> 54632Seric # include <errno.h> 64632Seric 75182Seric # ifndef QUEUE 8*10096Seric SCCSID(@(#)queue.c 3.64 01/03/83 (no queueing)); 95182Seric # else QUEUE 104632Seric 11*10096Seric SCCSID(@(#)queue.c 3.64 01/03/83); 125182Seric 134632Seric /* 149377Seric ** Work queue. 159377Seric */ 169377Seric 179377Seric struct work 189377Seric { 199377Seric char *w_name; /* name of control file */ 209377Seric long w_pri; /* priority of message, see below */ 219377Seric struct work *w_next; /* next in queue */ 229377Seric }; 239377Seric 249377Seric typedef struct work WORK; 259377Seric 269377Seric WORK *WorkQ; /* queue of things to be done */ 279377Seric /* 284632Seric ** QUEUEUP -- queue a message up for future transmission. 294632Seric ** 304632Seric ** Parameters: 316980Seric ** e -- the envelope to queue up. 326999Seric ** queueall -- if TRUE, queue all addresses, rather than 336999Seric ** just those with the QQUEUEUP flag set. 349377Seric ** announce -- if TRUE, tell when you are queueing up. 354632Seric ** 364632Seric ** Returns: 374632Seric ** none. 384632Seric ** 394632Seric ** Side Effects: 409377Seric ** The current request are saved in a control file. 414632Seric */ 424632Seric 439377Seric queueup(e, queueall, announce) 446980Seric register ENVELOPE *e; 456999Seric bool queueall; 469377Seric bool announce; 474632Seric { 487812Seric char *tf; 497812Seric char *qf; 507763Seric char buf[MAXLINE]; 517812Seric register FILE *tfp; 524632Seric register HDR *h; 535007Seric register ADDRESS *q; 544632Seric 555037Seric /* 565037Seric ** Create control file. 575037Seric */ 584632Seric 597812Seric tf = newstr(queuename(e, 't')); 607812Seric tfp = fopen(tf, "w"); 617812Seric if (tfp == NULL) 624632Seric { 637812Seric syserr("queueup: cannot create temp file %s", tf); 644632Seric return; 654632Seric } 669048Seric (void) chmod(tf, FileMode); 674632Seric 684632Seric # ifdef DEBUG 697677Seric if (tTd(40, 1)) 707812Seric printf("queueing in %s\n", tf); 714632Seric # endif DEBUG 724632Seric 734632Seric /* 746980Seric ** If there is no data file yet, create one. 756980Seric */ 766980Seric 776980Seric if (e->e_df == NULL) 786980Seric { 796980Seric register FILE *dfp; 809389Seric extern putbody(); 816980Seric 827812Seric e->e_df = newstr(queuename(e, 'd')); 836980Seric dfp = fopen(e->e_df, "w"); 846980Seric if (dfp == NULL) 856980Seric { 866980Seric syserr("queueup: cannot create %s", e->e_df); 877812Seric (void) fclose(tfp); 886980Seric return; 896980Seric } 909048Seric (void) chmod(e->e_df, FileMode); 9110066Seric (*e->e_putbody)(dfp, ProgMailer, FALSE, e, FALSE); 927009Seric (void) fclose(dfp); 939389Seric e->e_putbody = putbody; 946980Seric } 956980Seric 966980Seric /* 974632Seric ** Output future work requests. 989377Seric ** Priority should be first, since it is read by orderq. 994632Seric */ 1004632Seric 1019377Seric /* output message priority */ 1029377Seric fprintf(tfp, "P%ld\n", e->e_msgpriority); 1039377Seric 1049630Seric /* output creation time */ 1059630Seric fprintf(tfp, "T%ld\n", e->e_ctime); 1069630Seric 1074632Seric /* output name of data file */ 1087812Seric fprintf(tfp, "D%s\n", e->e_df); 1094632Seric 1104632Seric /* output name of sender */ 1117812Seric fprintf(tfp, "S%s\n", e->e_from.q_paddr); 1124632Seric 1134632Seric /* output list of recipient addresses */ 1146980Seric for (q = e->e_sendqueue; q != NULL; q = q->q_next) 1154632Seric { 1167763Seric if (queueall ? !bitset(QDONTSEND, q->q_flags) : 1177763Seric bitset(QQUEUEUP, q->q_flags)) 1188245Seric { 1197812Seric fprintf(tfp, "R%s\n", q->q_paddr); 1209377Seric if (announce) 1219377Seric { 1229377Seric e->e_to = q->q_paddr; 1239377Seric message(Arpa_Info, "queued"); 1249377Seric if (LogLevel > 4) 1259377Seric logdelivery("queued"); 1269377Seric e->e_to = NULL; 1279377Seric } 1289387Seric #ifdef DEBUG 1299387Seric if (tTd(40, 1)) 1309387Seric { 1319387Seric printf("queueing "); 1329387Seric printaddr(q, FALSE); 1339387Seric } 1349387Seric #endif DEBUG 1358245Seric } 1364632Seric } 1374632Seric 1389377Seric /* 1399377Seric ** Output headers for this message. 1409377Seric ** Expand macros completely here. Queue run will deal with 1419377Seric ** everything as absolute headers. 1429377Seric ** All headers that must be relative to the recipient 1439377Seric ** can be cracked later. 1449377Seric */ 1459377Seric 1469377Seric define('g', "$f", e); 1476980Seric for (h = e->e_header; h != NULL; h = h->h_link) 1484632Seric { 1494632Seric if (h->h_value == NULL || h->h_value[0] == '\0') 1504632Seric continue; 1517812Seric fprintf(tfp, "H"); 1524632Seric if (h->h_mflags != 0 && bitset(H_CHECK|H_ACHECK, h->h_flags)) 1537812Seric mfdecode(h->h_mflags, tfp); 1547763Seric if (bitset(H_DEFAULT, h->h_flags)) 1557763Seric { 1567763Seric (void) expand(h->h_value, buf, &buf[sizeof buf], e); 1578236Seric fprintf(tfp, "%s: %s\n", h->h_field, buf); 1587763Seric } 1598245Seric else if (bitset(H_FROM|H_RCPT, h->h_flags)) 1609348Seric { 1619348Seric commaize(h, h->h_value, tfp, bitset(EF_OLDSTYLE, e->e_flags), 16210066Seric (MAILER *) NULL, FALSE); 1639348Seric } 1647763Seric else 1658245Seric fprintf(tfp, "%s: %s\n", h->h_field, h->h_value); 1664632Seric } 1674632Seric 1684632Seric /* 1694632Seric ** Clean up. 1704632Seric */ 1714632Seric 1727812Seric (void) fclose(tfp); 1737812Seric qf = queuename(e, 'q'); 1749377Seric holdsigs(); 1757812Seric (void) unlink(qf); 1767812Seric if (link(tf, qf) < 0) 1777812Seric syserr("cannot link(%s, %s), df=%s", tf, qf, e->e_df); 1786980Seric else 1797812Seric (void) unlink(tf); 1809377Seric rlsesigs(); 1817391Seric 1827677Seric # ifdef LOG 1837677Seric /* save log info */ 1847878Seric if (LogLevel > 15) 1857878Seric syslog(LOG_DEBUG, "%s: queueup, qf=%s, df=%s\n", e->e_id, qf, e->e_df); 1867677Seric # endif LOG 1874632Seric } 1884632Seric /* 1894632Seric ** RUNQUEUE -- run the jobs in the queue. 1904632Seric ** 1914632Seric ** Gets the stuff out of the queue in some presumably logical 1924632Seric ** order and processes them. 1934632Seric ** 1944632Seric ** Parameters: 1954632Seric ** none. 1964632Seric ** 1974632Seric ** Returns: 1984632Seric ** none. 1994632Seric ** 2004632Seric ** Side Effects: 2014632Seric ** runs things in the mail queue. 2024632Seric */ 2034632Seric 2044639Seric runqueue(forkflag) 2054639Seric bool forkflag; 2064632Seric { 2077466Seric /* 2087466Seric ** See if we want to go off and do other useful work. 2097466Seric */ 2104639Seric 2114639Seric if (forkflag) 2124639Seric { 2137943Seric int pid; 2147943Seric 2157943Seric pid = dofork(); 2167943Seric if (pid != 0) 2174639Seric { 2187943Seric /* parent -- pick up intermediate zombie */ 2199377Seric (void) waitfor(pid); 2207690Seric if (QueueIntvl != 0) 2219348Seric (void) setevent(QueueIntvl, runqueue, TRUE); 2224639Seric return; 2234639Seric } 2247943Seric /* child -- double fork */ 2257943Seric if (fork() != 0) 2267943Seric exit(EX_OK); 2274639Seric } 2287876Seric # ifdef LOG 2297876Seric if (LogLevel > 11) 2307943Seric syslog(LOG_DEBUG, "runqueue %s, pid=%d", QueueDir, getpid()); 2317876Seric # endif LOG 2324639Seric 2337466Seric /* 2347466Seric ** Start making passes through the queue. 2357466Seric ** First, read and sort the entire queue. 2367466Seric ** Then, process the work in that order. 2377466Seric ** But if you take too long, start over. 2387466Seric */ 2397466Seric 2407943Seric /* order the existing work requests */ 24110070Seric (void) orderq(); 2427690Seric 2437943Seric /* process them once at a time */ 2447943Seric while (WorkQ != NULL) 2454639Seric { 2467943Seric WORK *w = WorkQ; 2477881Seric 2487943Seric WorkQ = WorkQ->w_next; 2497943Seric dowork(w); 2507943Seric free(w->w_name); 2517943Seric free((char *) w); 2524639Seric } 2537943Seric finis(); 2544634Seric } 2554634Seric /* 2564632Seric ** ORDERQ -- order the work queue. 2574632Seric ** 2584632Seric ** Parameters: 2594632Seric ** none. 2604632Seric ** 2614632Seric ** Returns: 2624632Seric ** none. 2634632Seric ** 2644632Seric ** Side Effects: 2654632Seric ** Sets WorkQ to the queue of available work, in order. 2664632Seric */ 2674632Seric 2684632Seric # define WLSIZE 120 /* max size of worklist per sort */ 2694632Seric 2704632Seric orderq() 2714632Seric { 2726625Sglickman register struct direct *d; 2734632Seric register WORK *w; 2744632Seric register WORK **wp; /* parent of w */ 2756625Sglickman DIR *f; 2764632Seric register int i; 2774632Seric WORK wlist[WLSIZE]; 27810070Seric int wn = -1; 2794632Seric extern workcmpf(); 2804632Seric 2814632Seric /* clear out old WorkQ */ 2824632Seric for (w = WorkQ; w != NULL; ) 2834632Seric { 2844632Seric register WORK *nw = w->w_next; 2854632Seric 2864632Seric WorkQ = nw; 2874632Seric free(w->w_name); 2884632Seric free((char *) w); 2894632Seric w = nw; 2904632Seric } 2914632Seric 2924632Seric /* open the queue directory */ 2938148Seric f = opendir("."); 2944632Seric if (f == NULL) 2954632Seric { 2968148Seric syserr("orderq: cannot open \"%s\" as \".\"", QueueDir); 29710070Seric return (0); 2984632Seric } 2994632Seric 3004632Seric /* 3014632Seric ** Read the work directory. 3024632Seric */ 3034632Seric 30410070Seric while ((d = readdir(f)) != NULL) 3054632Seric { 3069377Seric FILE *cf; 3074632Seric char lbuf[MAXNAME]; 3084632Seric 3094632Seric /* is this an interesting entry? */ 3107812Seric if (d->d_name[0] != 'q' || d->d_name[1] != 'f') 3114632Seric continue; 3124632Seric 31310070Seric /* yes -- open control file (if not too many files) */ 31410070Seric if (++wn >= WLSIZE) 31510070Seric continue; 3168148Seric cf = fopen(d->d_name, "r"); 3174632Seric if (cf == NULL) 3184632Seric { 3197055Seric /* this may be some random person sending hir msgs */ 3207055Seric /* syserr("orderq: cannot open %s", cbuf); */ 32110090Seric #ifdef DEBUG 32210090Seric if (tTd(41, 2)) 32310090Seric printf("orderq: cannot open %s (%d)\n", 32410090Seric d->d_name, errno); 32510090Seric #endif DEBUG 3267055Seric errno = 0; 32710090Seric wn--; 3284632Seric continue; 3294632Seric } 3308148Seric wlist[wn].w_name = newstr(d->d_name); 3314632Seric 3324632Seric /* extract useful information */ 3334632Seric while (fgets(lbuf, sizeof lbuf, cf) != NULL) 3344632Seric { 3359377Seric if (lbuf[0] == 'P') 3364632Seric { 3375037Seric (void) sscanf(&lbuf[1], "%ld", &wlist[wn].w_pri); 3384632Seric break; 3394632Seric } 3404632Seric } 3414632Seric (void) fclose(cf); 3424632Seric } 3436625Sglickman (void) closedir(f); 34410090Seric wn++; 3454632Seric 3464632Seric /* 3474632Seric ** Sort the work directory. 3484632Seric */ 3494632Seric 3504632Seric qsort(wlist, wn, sizeof *wlist, workcmpf); 3514632Seric 3524632Seric /* 3534632Seric ** Convert the work list into canonical form. 3549377Seric ** Should be turning it into a list of envelopes here perhaps. 3554632Seric */ 3564632Seric 3574632Seric wp = &WorkQ; 3584632Seric for (i = 0; i < wn; i++) 3594632Seric { 3604632Seric w = (WORK *) xalloc(sizeof *w); 3614632Seric w->w_name = wlist[i].w_name; 3624632Seric w->w_pri = wlist[i].w_pri; 3634632Seric w->w_next = NULL; 3644632Seric *wp = w; 3654632Seric wp = &w->w_next; 3664632Seric } 3674632Seric 3684632Seric # ifdef DEBUG 3697677Seric if (tTd(40, 1)) 3704632Seric { 3714632Seric for (w = WorkQ; w != NULL; w = w->w_next) 3725037Seric printf("%32s: pri=%ld\n", w->w_name, w->w_pri); 3734632Seric } 3744632Seric # endif DEBUG 37510070Seric 37610090Seric return (wn); 3774632Seric } 3784632Seric /* 3797677Seric ** WORKCMPF -- compare function for ordering work. 3804632Seric ** 3814632Seric ** Parameters: 3824632Seric ** a -- the first argument. 3834632Seric ** b -- the second argument. 3844632Seric ** 3854632Seric ** Returns: 3864632Seric ** -1 if a < b 3874632Seric ** 0 if a == b 3884632Seric ** 1 if a > b 3894632Seric ** 3904632Seric ** Side Effects: 3914632Seric ** none. 3924632Seric */ 3934632Seric 3944632Seric # define PRIFACT 1800 /* bytes each priority point is worth */ 3954632Seric 3964632Seric workcmpf(a, b) 3975037Seric register WORK *a; 3985037Seric register WORK *b; 3994632Seric { 4005037Seric if (a->w_pri == b->w_pri) 4014632Seric return (0); 4025037Seric else if (a->w_pri > b->w_pri) 4034632Seric return (1); 4044632Seric else 4054632Seric return (-1); 4064632Seric } 4074632Seric /* 4084632Seric ** DOWORK -- do a work request. 4094632Seric ** 4104632Seric ** Parameters: 4114632Seric ** w -- the work request to be satisfied. 4124632Seric ** 4134632Seric ** Returns: 4144632Seric ** none. 4154632Seric ** 4164632Seric ** Side Effects: 4174632Seric ** The work request is satisfied if possible. 4184632Seric */ 4194632Seric 4204632Seric dowork(w) 4214632Seric register WORK *w; 4224632Seric { 4234632Seric register int i; 4244632Seric 4254632Seric # ifdef DEBUG 4267677Seric if (tTd(40, 1)) 4275037Seric printf("dowork: %s pri %ld\n", w->w_name, w->w_pri); 4284632Seric # endif DEBUG 4294632Seric 4304632Seric /* 4314632Seric ** Fork for work. 4324632Seric */ 4334632Seric 4344632Seric i = fork(); 4354632Seric if (i < 0) 4364632Seric { 4374632Seric syserr("dowork: cannot fork"); 4384632Seric return; 4394632Seric } 4404632Seric 4414632Seric if (i == 0) 4424632Seric { 4434632Seric /* 4444632Seric ** CHILD 4458148Seric ** Lock the control file to avoid duplicate deliveries. 4468148Seric ** Then run the file as though we had just read it. 4477350Seric ** We save an idea of the temporary name so we 4487350Seric ** can recover on interrupt. 4494632Seric */ 4504632Seric 4517763Seric /* set basic modes, etc. */ 4527356Seric (void) alarm(0); 4539338Seric CurEnv->e_flags &= ~EF_FATALERRS; 4544632Seric QueueRun = TRUE; 4559377Seric ErrorMode = EM_MAIL; 4568148Seric CurEnv->e_id = &w->w_name[2]; 4577876Seric # ifdef LOG 4587876Seric if (LogLevel > 11) 4597881Seric syslog(LOG_DEBUG, "%s: dowork, pid=%d", CurEnv->e_id, 4607881Seric getpid()); 4617876Seric # endif LOG 4627763Seric 4637763Seric /* don't use the headers from sendmail.cf... */ 4647763Seric CurEnv->e_header = NULL; 4659348Seric (void) chompheader("from: $q", TRUE); 4667763Seric 4677763Seric /* create the link to the control file during processing */ 4687812Seric if (link(w->w_name, queuename(CurEnv, 'l')) < 0) 4696980Seric { 4707812Seric /* being processed by another queuer */ 4717881Seric # ifdef LOG 4727881Seric if (LogLevel > 4) 4737881Seric syslog(LOG_DEBUG, "%s: locked", CurEnv->e_id); 4747881Seric # endif LOG 4756980Seric exit(EX_OK); 4766980Seric } 4776980Seric 4786980Seric /* do basic system initialization */ 4794632Seric initsys(); 4806980Seric 4816980Seric /* read the queue control file */ 4829630Seric readqf(CurEnv, TRUE); 4839338Seric CurEnv->e_flags |= EF_INQUEUE; 4849377Seric eatheader(CurEnv); 4856980Seric 4866980Seric /* do the delivery */ 4879338Seric if (!bitset(EF_FATALERRS, CurEnv->e_flags)) 4889282Seric sendall(CurEnv, SM_DELIVER); 4896980Seric 4906980Seric /* finish up and exit */ 4914632Seric finis(); 4924632Seric } 4934632Seric 4944632Seric /* 4954632Seric ** Parent -- pick up results. 4964632Seric */ 4974632Seric 4984632Seric errno = 0; 4999377Seric (void) waitfor(i); 5004632Seric } 5014632Seric /* 5024632Seric ** READQF -- read queue file and set up environment. 5034632Seric ** 5044632Seric ** Parameters: 5059377Seric ** e -- the envelope of the job to run. 5069630Seric ** full -- if set, read in all information. Otherwise just 5079630Seric ** read in info needed for a queue print. 5084632Seric ** 5094632Seric ** Returns: 5104632Seric ** none. 5114632Seric ** 5124632Seric ** Side Effects: 5134632Seric ** cf is read and created as the current job, as though 5144632Seric ** we had been invoked by argument. 5154632Seric */ 5164632Seric 5179630Seric readqf(e, full) 5189377Seric register ENVELOPE *e; 5199630Seric bool full; 5204632Seric { 5214632Seric register FILE *f; 5227785Seric char buf[MAXFIELD]; 5239348Seric extern char *fgetfolded(); 5249377Seric register char *p; 5254632Seric 5264632Seric /* 5274632Seric ** Open the file created by queueup. 5284632Seric */ 5294632Seric 5309377Seric p = queuename(e, 'q'); 5319377Seric f = fopen(p, "r"); 5324632Seric if (f == NULL) 5334632Seric { 5349377Seric syserr("readqf: no control file %s", p); 5354632Seric return; 5364632Seric } 5379377Seric FileName = p; 5389377Seric LineNumber = 0; 5394632Seric 5404632Seric /* 5414632Seric ** Read and process the file. 5424632Seric */ 5434632Seric 5449630Seric if (Verbose && full) 5459377Seric printf("\nRunning %s\n", e->e_id); 5467785Seric while (fgetfolded(buf, sizeof buf, f) != NULL) 5474632Seric { 5484632Seric switch (buf[0]) 5494632Seric { 5504632Seric case 'R': /* specify recipient */ 5519618Seric sendtolist(&buf[1], (ADDRESS *) NULL, &e->e_sendqueue); 5524632Seric break; 5534632Seric 5544632Seric case 'H': /* header */ 5559630Seric if (full) 5569630Seric (void) chompheader(&buf[1], FALSE); 5574632Seric break; 5584632Seric 5594632Seric case 'S': /* sender */ 5604634Seric setsender(newstr(&buf[1])); 5614632Seric break; 5624632Seric 5634632Seric case 'D': /* data file name */ 5649630Seric if (!full) 5659630Seric break; 5669377Seric e->e_df = newstr(&buf[1]); 5679544Seric e->e_dfp = fopen(e->e_df, "r"); 5689544Seric if (e->e_dfp == NULL) 5699377Seric syserr("readqf: cannot open %s", e->e_df); 5704632Seric break; 5714632Seric 5727860Seric case 'T': /* init time */ 5739377Seric (void) sscanf(&buf[1], "%ld", &e->e_ctime); 5744632Seric break; 5754632Seric 5764634Seric case 'P': /* message priority */ 5779377Seric (void) sscanf(&buf[1], "%ld", &e->e_msgpriority); 5785037Seric 5795037Seric /* make sure that big things get sent eventually */ 5809377Seric e->e_msgpriority -= WKTIMEFACT; 5814634Seric break; 5824634Seric 5835902Seric case 'M': /* define macro */ 5849630Seric if (full) 5859630Seric define(buf[1], newstr(&buf[2]), e); 5865902Seric break; 5875902Seric 5884632Seric default: 5899377Seric syserr("readqf(%s): bad line \"%s\"", e->e_id, buf); 5904632Seric break; 5914632Seric } 5924632Seric } 5939377Seric 5949377Seric FileName = NULL; 5954632Seric } 5964632Seric /* 5979630Seric ** PRINTQUEUE -- print out a representation of the mail queue 5989630Seric ** 5999630Seric ** Parameters: 6009630Seric ** none. 6019630Seric ** 6029630Seric ** Returns: 6039630Seric ** none. 6049630Seric ** 6059630Seric ** Side Effects: 6069630Seric ** Prints a listing of the mail queue on the standard output. 6079630Seric */ 6085182Seric 6099630Seric printqueue() 6109630Seric { 6119630Seric register WORK *w; 6129630Seric FILE *f; 61310070Seric int nrequests; 6149630Seric char buf[MAXLINE]; 6159630Seric 6169630Seric /* 6179630Seric ** Read and order the queue. 6189630Seric */ 6199630Seric 62010070Seric nrequests = orderq(); 6219630Seric 6229630Seric /* 6239630Seric ** Print the work list that we have read. 6249630Seric */ 6259630Seric 6269630Seric /* first see if there is anything */ 62710070Seric if (nrequests <= 0) 6289630Seric { 62910070Seric printf("Mail queue is empty\n"); 6309630Seric return; 6319630Seric } 6329630Seric 633*10096Seric printf("\t\tMail Queue (%d request%s", nrequests, nrequests == 1 ? "" : "s"); 63410070Seric if (nrequests > WLSIZE) 63510070Seric printf(", only %d printed", WLSIZE); 63610070Seric printf(")\n--QID-- --Size-- -----Q-Time----- ------------Sender/Recipient------------\n"); 6379630Seric for (w = WorkQ; w != NULL; w = w->w_next) 6389630Seric { 6399630Seric struct stat st; 64010070Seric char lf[20]; 64110070Seric auto time_t submittime = 0; 64210070Seric long dfsize = -1; 6439630Seric 6449630Seric printf("%7s", w->w_name + 2); 64510070Seric strcpy(lf, w->w_name); 64610070Seric lf[0] = 'l'; 64710070Seric if (stat(lf, &st) >= 0) 64810070Seric printf("*"); 64910070Seric else 65010070Seric printf(" "); 65110070Seric errno = 0; 6529630Seric f = fopen(w->w_name, "r"); 6539630Seric if (f == NULL) 6549630Seric { 6559630Seric printf(" (finished)\n"); 65610070Seric errno = 0; 6579630Seric continue; 6589630Seric } 6599630Seric while (fgets(buf, sizeof buf, f) != NULL) 6609630Seric { 6619630Seric fixcrlf(buf, TRUE); 6629630Seric switch (buf[0]) 6639630Seric { 6649630Seric case 'S': /* sender name */ 66510070Seric printf("%8d %.16s %.40s", dfsize, 66610070Seric ctime(&submittime), &buf[1]); 6679630Seric break; 6689630Seric 6699630Seric case 'R': /* recipient name */ 67010070Seric printf("\n\t\t\t\t %.40s", &buf[1]); 6719630Seric break; 6729630Seric 6739630Seric case 'T': /* creation time */ 67410070Seric sscanf(&buf[1], "%ld", &submittime); 6759630Seric break; 67610070Seric 67710070Seric case 'D': /* data file name */ 67810070Seric if (stat(&buf[1], &st) >= 0) 67910070Seric dfsize = st.st_size; 68010070Seric break; 6819630Seric } 6829630Seric } 68310070Seric if (submittime == (time_t) 0) 68410070Seric printf(" (no control file)"); 6859630Seric printf("\n"); 6869630Seric fclose(f); 6879630Seric } 6889630Seric } 6899630Seric 6905182Seric # endif QUEUE 691