diff -ruN cfengine-2.0.5-old/src/cfagent.c cfengine-2.0.5/src/cfagent.c --- cfengine-2.0.5-old/src/cfagent.c 2003-02-27 10:34:49.000000000 +0000 +++ cfengine-2.0.5/src/cfagent.c 2003-02-27 10:34:49.000000000 +0000 @@ -151,6 +151,16 @@ printf("%s\n",VFQNAME); printf("%s\n",VIPADDRESS); + if (GetMacroValue("EmailMaxLines")) + { + printf("%s\n", GetMacroValue("EmailMaxLines")); + } + else + { + /* User has not expressed a preference -- let cfexecd decide */ + printf("%s", "-1\n"); + } + for (ip = SCHEDULE; ip != NULL; ip=ip->next) { printf("[%s]\n",ip->name); diff -ruN cfengine-2.0.5-old/src/cfexecd.c cfengine-2.0.5/src/cfexecd.c --- cfengine-2.0.5-old/src/cfexecd.c 2003-02-27 10:34:49.000000000 +0000 +++ cfengine-2.0.5/src/cfexecd.c 2003-02-27 13:06:07.000000000 +0000 @@ -77,6 +77,8 @@ }; char MAILTO[bufsize]; +int MAXLINES = -1; +const int INF_LINES = -2; /*******************************************************************/ /* Functions internal to cfservd.c */ @@ -419,7 +421,7 @@ fgets(line,bufsize,pp); Chop(line); strcpy(VFQNAME,line); -Debug("Got full qualified name (%s)\n",VFQNAME); +Debug("Got fully qualified name (%s)\n",VFQNAME); line[0] = '\0'; fgets(line,bufsize,pp); @@ -427,6 +429,28 @@ strcpy(VIPADDRESS,line); Debug("Got IP (%s)\n",VIPADDRESS); +if ((ungetc(fgetc(pp), pp)) != '[') + { + line[0] = '\0'; + fgets(line,bufsize,pp); + Chop(line); + if (sscanf(line, "%d", &MAXLINES) == 1) + { + Debug("Got max lines (%d)\n", MAXLINES); + } + else if (strcmp(line, "inf") == 0) + { + Debug("Infinite lines\n"); + MAXLINES = INF_LINES; + } + } + +if (MAXLINES == -1) + { + MAXLINES = 100; + Debug("Defaulting to max lines (%d)\n", MAXLINES); + } + /* Now get scheduling constraints */ DeleteItemList(SCHEDULE); @@ -774,10 +798,16 @@ */ if ( CompareResult(file,prev_file) == 0 ) { - Verbose("Previous output is the same as current so do not mail it\n"); - return; + Verbose("Previous output is the same as current so do not mail it\n"); + return; } +if (MAXLINES == 0) + { + Debug("Not mailing: EmailMaxLines was zero\n"); + return; + } + Debug("Mailing results of (%s) to (%s)\n",file,to); if (strlen(to) == 0) @@ -855,7 +885,7 @@ count++; sent=send(sd,VBUFF,strlen(VBUFF),0); } - if (count > 100) + if ((MAXLINES != INF_LINES) && (count > MAXLINES)) { sprintf(VBUFF,"\r\n[Mail truncated by cfengine. File is at %s on %s]\r\n",file,VFQNAME); sent=send(sd,VBUFF,strlen(VBUFF),0);