/* mhconfig.c - configure MH */
/* cc [-DSYS5] mhconfig.c -o mhconfig */
static char ident
[] = "@(#)$Id: mhconfig.c,v 2.67 1993/06/03 17:59:55 jromine Exp $";
static void insopt(), mkopts();
extern char *strcpy(), *malloc(), *index(), *rindex();
extern char *sprintf(); /* rely on stdio.h to declare this */
#define BANNER "This is %s, for generic UNIX (MH.6 configuration program)\n\n"
#define SEDOC "doc/config.sed"
#define MAKE "../%s/Makefile"
#define WARNING "This file is automatically generated. Do not edit!"
#define MHRELEASE "6.8" /* for version: "Maj.min.pat" */
#define MHCENTERFOOT "MH.6.8" /* for nroff page footers */
#define MHLEFTFOOT "[mh.6]" /* [mh.6] MH.6.6 page# */
#define MHSLIBVER "3.2" /* SunOS4 shared library version */
#define NULLCP ((char *) 0)
#define SVAL(s) (s ? s : "")
static char *myname
= "mhconfig";
static char *config
= NULL
;
static char *myopts
= NULL
;
static char *binpath
= "/usr/local";
static char *bbhome
= "/usr/spool/bboards";
static char *bboards
= "off";
static char *bbdelivery
= "off";
static char *ccoptions
= NULL
;
static char *chownpath
= "/etc/chown";
static char *compiler
= "/bin/cc";
static char *copy
= "cp";
static char *curses
= "-lcurses -ltermlib";
static char *debug
= "off";
static char *editor
= "prompter";
static char *etcpath
= "/usr/local/lib/mh";
static char *ldoptions
= NULL
;
static char *ldoptlibs
= NULL
;
static char *lex
= "lex -nt";
static char *mailgroup
= "off";
static char *mailpath
= "/usr/spool/mail";
static char *maildir
= NULL
;
static char *mailfile
= NULL
;
static char *mancat
= "man";
static char *mandir
= "/usr/man";
static char *manuals
= "standard";
static char *mts
= "sendmail";
static char *poppath
= "/usr/etc";
static char *removeit
= "mv -f";
static char *regtest
= "off";
static char *oldload
= "off";
static char *options
= NULL
;
static char *pop
= "off";
static char *ranlib
= "on";
static char *sharedlib
= "off";
static char *signl
= "int";
static char *slibdir
= "/usr/local/lib";
static char *slflags
= "-pic";
static char *sprntf
= NULL
;
static int mtsnum
= unknown
;
"mmdf", "MMDFMTS MMDFI", mmdf
, NOFLAGS
,
"mmdf/smtp", "SENDMTS SMTP", mmdf
, DOSMTP
,
"mmdf2", "MMDFMTS MMDFII", mmdf2
, NOFLAGS
,
"mmdf2/smtp", "SENDMTS MMDFII SMTP", mmdf2
, DOSMTP
,
"mh", "MHMTS", mh
, NOFLAGS
,
"sendmail", "SENDMTS", sendmail
, NOMF
,
"sendmail/smtp", "SENDMTS SMTP", sendmail
, NOMF
,
"zmailer", "ZMAILER SENDMTS", sendmail
, NOMF
,
"zmailer/smtp", "ZMAILER SENDMTS SMTP", sendmail
, NOMF
,
NULL
, NULL
, unknown
, NOFLAGS
/* other options which cause sed BEGIN/END configuration changes */
"APOP", 0, /* authenticated pop */
"BSD43", 0, /* sgid ttys */
"KPOP", 0, /* KERBEROS pop */
"MIME", 0, /* multi-media extensions */
"MPOP", 0, /* mobile pop */
"MSGID", 0, /* slocal dup surpression */
"NORUSERPASS", 0, /* no ruserpass(3) */
"TMA", 0, /* trusted mail */
"bbhome", &bbhome
, BD_NIL
,
"bboards", &bboards
, BD_NIL
,
"bbdelivery", &bbdelivery
, BD_NIL
,
"ccoptions", &ccoptions
, BD_ADD
,
"chown", &chownpath
, BD_NIL
,
"curses", &curses
, BD_NIL
,
"editor", &editor
, BD_NIL
,
"ldoptions", &ldoptions
, BD_ADD
,
"ldoptlibs", &ldoptlibs
, BD_ADD
,
"mail", &mailpath
, BD_NIL
,
"mailgroup", &mailgroup
, BD_NIL
,
"mandir", &mandir
, BD_NIL
,
"manuals", &manuals
, BD_NIL
,
"oldload", &oldload
, BD_NIL
,
"options", &options
, BD_ADD
,
"popdir", &poppath
, BD_NIL
,
"ranlib", &ranlib
, BD_NIL
,
"remove", &removeit
, BD_NIL
,
"regtest", ®test
, BD_NIL
,
"sharedlib", &sharedlib
, BD_NIL
,
"signal", &signl
, BD_NIL
,
"slflags", &slflags
, BD_NIL
,
"slibdir", &slibdir
, BD_NIL
,
"sprintf", &sprntf
, BD_NIL
,
"../support/bboards/bboards.daily",
"../support/bboards/bboards.weekly",
"../support/bboards/crontab",
"../support/bboards/MakeBBoards",
"../zotnet/mts/mtstailor",
"../support/general/MailAliases",
"../mts/sendmail/bboardsMH.m4",
"../mts/sendmail/popMH.m4",
"makefiles/MH-Makefile", ".",
"makefiles/config","config",
"makefiles/mts/mh","mts/mh",
"makefiles/mts/mmdf","mts/mmdf",
"makefiles/mts/sendmail","mts/sendmail",
"makefiles/papers","papers",
"makefiles/supportM","support",
"makefiles/support/bboards","support/bboards",
"makefiles/support/general","support/general",
"makefiles/support/pop","support/pop",
"makefiles/zotnetM","zotnet",
"makefiles/zotnet/bboards","zotnet/bboards",
"makefiles/zotnet/mf","zotnet/mf",
"makefiles/zotnet/mts","zotnet/mts",
"makefiles/zotnet/tws","zotnet/tws",
static do_sed(), do_sedfile(), do_files(), do_doc(), do_make();
static shell(), arginit(), add_option(), trim();
static char *stradd (), *strdup (), *tail ();
printf ("Don't forget to edit \"config/mtstailor\"\n");
printf ("Don't forget to run \"make clean\" in the top directory before compiling\n");
do_sedfile (SEDOC
, smtp
);
fprintf (fp
, "%s\n%s\n%s\n%s\n", /* turn @BEGIN: XX into #ifdef XX */
"s!^@BEGIN: \\(.*\\)$!.br\\", /* for MH wizard manual set */
fprintf (fp
, "%s\n%s\n%s\n%s\n",
"s!^@END: \\(.*\\)$!.br\\",
static do_sedfile (sed
, flag
)
if ((fp
= fopen (sed
, "w")) == NULL
)
adios (sed
, "unable to write");
printf ("generating %s\n", sed
);
printf ("...using special all-doc format.\n");
printf ("Be sure to reconfigure before compiling.\n");
do_alldoc(fp
); /* hack up doc/config.sed */
fprintf (fp
, "s%%@(MHCONFIGFILE)%%%s%%g\n", SVAL(config
));
fprintf (fp
, "s%%@(MHWARNING)%%%s%%g\n", WARNING
);
fprintf (fp
, "s%%@(MHRELEASE)%%%s%%g\n", MHRELEASE
);
fprintf (fp
, "s%%@(MHCENTERFOOT)%%%s%%g\n", MHCENTERFOOT
);
fprintf (fp
, "s%%@(MHLEFTFOOT)%%%s%%g\n", MHLEFTFOOT
);
fprintf (fp
, "s%%@(MHBINPATH)%%%s%%g\n", SVAL (binpath
));
fprintf (fp
, "s%%@(MHETCPATH)%%%s%%g\n", SVAL (etcpath
));
fprintf (fp
, "s%%@(MHPOPDPATH)%%%s%%g\n", SVAL (poppath
));
fprintf (fp
, "s%%@(MHCHOWNPATH)%%%s%%g\n", SVAL (chownpath
));
fprintf (fp
, "s%%@(MHDROPATH)%%%s%%g\n", SVAL (maildir
));
fprintf (fp
, "s%%@(MHDROPFIL)%%%s%%g\n", SVAL (mailfile
));
fprintf (fp
, "s%%@(MHDROPLOC)%%%s/$USER%%g\n", SVAL (maildir
));
fprintf (fp
, "s%%@(MHDROPLOC)%%$HOME/%s%%g\n", SVAL (mailfile
));
fprintf (fp
, "s%%@(MHDROPHAK)%%%s%%g\n",/* HACK */
maildir
? maildir
: "/usr/spool/mail");
fprintf (fp
, "s%%@(MHMANDIR)%%%s%%g\n", mandir
);
fprintf (fp
, "s%%@(MHCATMAN)%%%s%%g\n",
strcmp(mancat
, "cat") == 0 ? "| nroff -man" : "");
if (strcmp (manuals
, "standard") == 0 || strcmp (manuals
, "gen") == 0)
for (i
= 1; i
<= 8; i
++) {
fprintf (fp
, "s%%@(MHMANDIR%d)%%%s%d%%g\n", i
, mancat
, i
);
fprintf (fp
, "s%%@(MHMANEXT%d)%%%d%%g\n", i
, i
);
for (i
= 1; i
<= 8; i
++) {
fprintf (fp
, "s%%@(MHMANDIR%d)%%%s%c%%g\n", i
, mancat
,
strcmp (manuals
, "new") == 0 ? 'n'
: strcmp (manuals
, "old") == 0 ? 'o'
: strcmp (manuals
, "bsd44") == 0 ? i
+ '0'
fprintf (fp
, "s%%@(MHMANEXT%d)%%%c%%g\n", i
,
strcmp (manuals
, "new") == 0 ? 'n'
: strcmp (manuals
, "old") == 0 ? 'o'
: strcmp (manuals
, "bsd44") == 0 ? '0'
if (strcmp (regtest
, "on") == 0)
fprintf (fp
, "s%%@(MHHOSTVER)%%%s%%g\n", "-n");
fprintf (fp
, "s%%@(MHHOSTVER)%%%s%%g\n", "");
if (strcmp (manuals
, "gen") == 0 || strcmp (manuals
, "none") == 0)
fprintf (fp
, "s%%@(MHMANGEN)%%%s%%g\n", "#"); /* comment char */
fprintf (fp
, "s%%@(MHMANGEN)%%%s%%g\n", "");
fprintf (fp
, "s%%@(MHEDITOR)%%%s%%g\n", SVAL (editor
));
fprintf (fp
, "s%%@(MHCONFIG)%%%s%%g\n", SVAL (myopts
));
fprintf (fp
, "s%%@(MHCOMPILER)%%%s%%g\n", SVAL (compiler
));
fprintf (fp
, "s%%@(CP)%%%s%%g\n", SVAL (copy
));
fprintf (fp
, "s%%@(LN)%%%s%%g\n", SVAL (ln
));
fprintf (fp
, "s%%@(LEX)%%%s%%g\n", SVAL (lex
));
fprintf (fp
, "s%%@(MHOPTIONS)%%%s %s%%g\n",
SVAL (options
), SVAL (ccoptions
));
fprintf (fp
, "s%%@(MHOPTIONS)%%%s %s%%g\n",
fprintf (fp
, "s%%@(LDOPTIONS)%%%s%%g\n", SVAL (ldoptions
));
fprintf (fp
, "s%%@(LDOPTLIB)%%%s%%g\n", SVAL (ldoptlibs
));
fprintf (fp
, "s%%@(LDCURSES)%%%s%%g\n", SVAL (curses
));
if (strcmp (bboards
, "off") == 0)
fprintf (fp
, "/^@BEGIN: BBOARDS$/,/^@END: BBOARDS$/d\n");
fprintf (fp
, "/^@BEGIN: BBOARDS$/d\n/^@END: BBOARDS$/d\n");
fprintf (fp
, "s%%@(BBHOME)%%%s%%g\n", SVAL (bbhome
));
if (strcmp (bbdelivery
, "off") == 0)
fprintf (fp
, "/^@BEGIN: BBSERVER$/,/^@END: BBSERVER$/d\n");
fprintf (fp
, "/^@BEGIN: BBSERVER$/d\n/^@END: BBSERVER$/d\n");
if (strcmp (debug
, "on") == 0) {
fprintf (fp
, "/^@BEGIN: DEBUG$/d\n/^@END: DEBUG$/d\n");
fprintf (fp
, "/^@BEGIN: OPTIM$/,/^@END: OPTIM$/d\n");
fprintf (fp
, "/^@BEGIN: DEBUG$/,/^@END: DEBUG$/d\n");
fprintf (fp
, "/^@BEGIN: OPTIM$/d\n/^@END: OPTIM$/d\n");
if (strcmp (mailgroup
, "off")) { /* for SYS5 sgid-inc */
fprintf (fp
, "/^@BEGIN: MAILGROUP$/d\n/^@END: MAILGROUP$/d\n");
fprintf (fp
, "s%%@(MAILGROUP)%%%s%%g\n", SVAL (mailgroup
));
fprintf (fp
, "/^@BEGIN: MAILGROUP$/,/^@END: MAILGROUP$/d\n");
if (strcmp (oldload
, "on") == 0)
fprintf (fp
, "/^@BEGIN: OLDLOAD$/d\n/^@END: OLDLOAD$/d\n");
fprintf (fp
, "/^@BEGIN: OLDLOAD$/,/^@END: OLDLOAD$/d\n");
if (strcmp (oldload
, "off") == 0)
fprintf (fp
, "/^@BEGIN: NEWLOAD$/d\n/^@END: NEWLOAD$/d\n");
fprintf (fp
, "/^@BEGIN: NEWLOAD$/,/^@END: NEWLOAD$/d\n");
if (strcmp (ranlib
, "on") == 0) {
fprintf (fp
, "/^@BEGIN: RANLIB$/d\n/^@END: RANLIB$/d\n");
fprintf (fp
, "/^@BEGIN: LORDER$/,/^@END: LORDER$/d\n");
fprintf (fp
, "/^@BEGIN: LORDER$/d\n/^@END: LORDER$/d\n");
fprintf (fp
, "/^@BEGIN: RANLIB$/,/^@END: RANLIB$/d\n");
if (strcmp (sharedlib
, "off")) { /* if not off */
fprintf (fp
, "/^@BEGIN: SHAREDLIB$/d\n/^@END: SHAREDLIB$/d\n");
fprintf (fp
, "/^@BEGIN: STDLIB$/,/^@END: STDLIB$/d\n");
fprintf (fp
, "s%%@(SLIBDIR)%%%s%%g\n", slibdir
);
fprintf (fp
, "s%%@(SLIBVER)%%%s%%g\n", MHSLIBVER
);
fprintf (fp
, "s%%@(SLFLAGS)%%%s%%g\n", SVAL(slflags
));
if (strcmp (sharedlib
, "secure") == 0)
fprintf (fp
, "s%%@(SLDFLAG)%%-L%s%%g\n",slibdir
);
fprintf (fp
, "s%%@(SLDFLAG)%%%%g\n");
fprintf (fp
, "/^@BEGIN: STDLIB$/d\n/^@END: STDLIB$/d\n");
fprintf (fp
, "/^@BEGIN: SHAREDLIB$/,/^@END: SHAREDLIB$/d\n");
if (strcmp (sharedlib
, "sun4") == 0 || strcmp (sharedlib
, "on") == 0)
fprintf (fp
, "/^@BEGIN: SUN4SHLIB$/d\n/^@END: SUN4SHLIB$/d\n");
fprintf (fp
, "/^@BEGIN: SUN4SHLIB$/,/^@END: SUN4SHLIB$/d\n");
if (strcmp (sharedlib
, "sys5") == 0)
fprintf (fp
, "/^@BEGIN: SYS5SHLIB$/d\n/^@END: SYS5SHLIB$/d\n");
fprintf (fp
, "/^@BEGIN: SYS5SHLIB$/,/^@END: SYS5SHLIB$/d\n");
if (flag
|| ((mtsnum
== mmdf
|| mtsnum
== mmdf2
) && !smtp
)) {
fprintf (fp
, "/^@BEGIN: MMDFMTS$/d\n/^@END: MMDFMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MMDFIMTS$/d\n/^@END: MMDFIMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MMDFIMTS$/,/^@END: MMDFIMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MMDFIIMTS$/d\n/^@END: MMDFIIMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MMDFIIMTS$/,/^@END: MMDFIIMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MMDFMTS$/,/^@END: MMDFMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MMDFIMTS$/,/^@END: MMDFIMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MMDFIIMTS$/,/^@END: MMDFIIMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MHMTS$/d\n/^@END: MHMTS$/d\n");
fprintf (fp
, "/^@BEGIN: MHMTS$/,/^@END: MHMTS$/d\n");
if (!flag
&& (mtsnum
== sendmail
|| smtp
))
fprintf (fp
, "/^@BEGIN: SENDMTS$/d\n/^@END: SENDMTS$/d\n");
fprintf (fp
, "/^@BEGIN: SENDMTS$/,/^@END: SENDMTS$/d\n");
fprintf (fp
, "/^@BEGIN: SENDMTSHACK$/d\n/^@END: SENDMTSHACK$/d\n");
fprintf (fp
, "/^@BEGIN: SENDMTSHACK$/,/^@END: SENDMTSHACK$/d\n");
/* special hack for support/pop/popser.c */
fprintf (fp
, "s%%@(POPUUMBOX)%%%s%%g\n",
mtsnum
== sendmail
? "-DPOPUUMBOX" : "");
fprintf (fp
, "/^@BEGIN: SMTP$/d\n/^@END: SMTP$/d\n");
fprintf (fp
, "/^@BEGIN: SMTP$/,/^@END: SMTP$/d\n");
if (strcmp (pop
, "on") == 0)
fprintf (fp
, "/^@BEGIN: POP$/d\n/^@END: POP$/d\n");
fprintf (fp
, "/^@BEGIN: POP$/,/^@END: POP$/d\n");
if (strcmp (bboards
, "pop") == 0)
fprintf (fp
, "/^@BEGIN: BPOP$/d\n/^@END: BPOP$/d\n");
fprintf (fp
, "/^@BEGIN: BPOP$/,/^@END: BPOP$/d\n");
if (strcmp (bboards
, "nntp") == 0)
fprintf (fp
, "/^@BEGIN: NNTP$/d\n/^@END: NNTP$/d\n");
fprintf (fp
, "/^@BEGIN: NNTP$/,/^@END: NNTP$/d\n");
if (strcmp (mf
, "on") == 0)
fprintf (fp
, "/^@BEGIN: MF$/d\n/^@END: MF$/d\n");
fprintf (fp
, "/^@BEGIN: MF$/,/^@END: MF$/d\n");
fprintf (fp
, "s%%@(MHREMOVE)%%%s%%g\n", SVAL (removeit
));
for (op
= copts
; op
->c_name
; op
++) {
fprintf (fp
, op
->c_value
? "/^@BEGIN: %s$/d\n/^@END: %s$/d\n" :
"/^@BEGIN: %s$/,/^@END: %s$/d\n",
for (pp
= files
; *pp
; pp
++)
shell ("rm -f %s; sed -f %s < config/%s > %s",
*pp
, SED
, tail (*pp
), *pp
);
for (pp
= makefiles
; pp
-> infile
; pp
++) {
(void) sprintf (buffer
, MAKE
, pp
-> outfile
);
shell ("rm -f %s; sed -f %s < %s > %s",
buffer
, SED
, pp
-> infile
, buffer
);
static shell (fmt
, a
, b
, c
, d
)
(void) sprintf (buffer
, fmt
, a
, b
, c
, d
);
adios (NULLCP
, "failed");
for (vec
++; *vec
; vec
++) {
if (strcmp (*vec
, "-D") == 0) {
sedP
= 1; filesP
= makeP
= 0; docP
= 2;
if (strcmp (*vec
, "-s") == 0) {
if (strcmp (*vec
, "-f") == 0) {
if (strcmp (*vec
, "-d") == 0) {
if (strcmp (*vec
, "-m") == 0) {
if (strcmp (*vec
, "-help") == 0) {
printf ("usage: %s [opt] file\n", myname
);
printf ("%s\n%s\n%s\n%s\n",
" -s\tno sed files", " -f\tno config files",
" -d\tno doc files", " -m\tno makefiles");
if ((config
= *vec
) == NULL
|| vec
[1] != NULL
) /* no arg or too many */
adios (NULLCP
, "usage: %s file", myname
);
if ((fp
= fopen (config
, "r")) == NULL
)
adios (config
, "unable to read");
while (fgets (buffer
, sizeof buffer
, fp
)) {
if (ap
= index (buffer
, '\n'))
ap
= &buffer
[strlen (buffer
) - 1];
for (cp
= buffer
; isspace (*cp
); cp
++)
if (*cp
== '\0' || *cp
== '#')
if (isspace (*ap
) || *ap
== ':') {
for (bp
= binds
; bp
-> keyword
; bp
++)
if (strcmp (bp
-> keyword
, cp
) == 0)
if (bp
-> keyword
== NULL
)
adios (NULLCP
, "unknown option %s in %s", cp
, config
);
if (*(bp
-> value
) == NULL
|| !(bp
-> flags
& BD_ADD
))
*(bp
-> value
) = strdup (ap
);
*(bp
-> value
) = stradd (ap
, stradd (" ", *(bp
-> value
)));
adios (NULLCP
, "bin must be specified in %s", config
);
if (strcmp (bboards
, "on") && strcmp (bboards
, "off") &&
strcmp (bboards
, "pop") && strcmp (bboards
, "nntp"))
adios (NULLCP
, "bboards should be %s not %s",
"either \"on\", \"off\", \"pop\" or \"nntp\"", bboards
);
if (strcmp (bboards
, "off") == 0 && strcmp (bbdelivery
, "off"))
"you cannot have \"bbdelivery\" \"%s\" with \"bboards\" \"%s\"",
adios (NULLCP
, "bbhome must be specified in %s", config
);
if (strcmp (debug
, "on") && strcmp (debug
, "off"))
adios (NULLCP
, "debug should be either \"on\" or \"off\", not %s",
adios (NULLCP
, "etc must be specified in %s", config
);
if (strcmp (mailgroup
, "off")) /* if not "off" */
add_option ("MAILGROUP");
adios (NULLCP
, "mail must be specified in %s", config
);
if (cp
= index (manuals
, '/')) { /* "standard/cat" */
if (strcmp (mancat
, "cat"))
adios (NULLCP
,"invalid manuals setting: %s/%s",manuals
, mancat
);
if (strcmp (manuals
, "standard")
&& strcmp (manuals
, "bsd44")
&& strcmp (manuals
, "local")
&& strcmp (manuals
, "new")
&& strcmp (manuals
, "old")
&& strcmp (manuals
, "gen")
&& strcmp (manuals
, "none"))
adios (NULLCP
,"invalid manuals setting: %s",manuals
);
adios (NULLCP
, "mts must be specified in %s", config
);
for (i
= 0; mtsopts
[i
].mtskey
; i
++)
if (strcmp (mts
, mtsopts
[i
].mtskey
) == 0)
if ((mtsnum
= mtsopts
[i
].code
) == unknown
)
adios (NULLCP
, "invalid mts setting: %s", mts
);
add_option (mtsopts
[i
].optval
);
smtp
= mtsopts
[i
].mtsflags
& DOSMTP
;
if (mtsopts
[i
].mtsflags
& NOMF
)
mf
= "off"; /* hack... */
if (strcmp (pop
, "on") && strcmp (pop
, "off"))
adios (NULLCP
, "pop should be either \"on\" or \"off\", not %s", pop
);
if (strcmp (pop
, "on") == 0)
if (strcmp (bboards
, "pop") == 0) {
adios (NULLCP
, "bboards \"pop\" requires pop \"on\"");
else if (strcmp (bboards
, "nntp") == 0) {
add_option ("BPOP");/* used by msh.c & bbc.c, but see also pshsbr.c */
"bboards \"nntp\" is incompatible with \"options MPOP\"");
if (strcmp (mf
, "on") && strcmp (mf
, "off"))
adios (NULLCP
, "mf should be either \"on\" or \"off\", not %s", mf
);
if (strcmp (mf
, "on") == 0)
if (sprntf
&& strcmp (sprntf
, "char *")) {/* this defaults to "char *" */
if (strcmp (sprntf
, "int"))
"sprintf should be either \"int\" or \"char *\", not %s",
add_option ("SPRINTFTYPE=int");
if (strcmp (sharedlib
, "on") && strcmp (sharedlib
, "off")
&& strcmp (sharedlib
, "sun4") && strcmp (sharedlib
, "sys5")
&& strcmp (sharedlib
, "secure"))
"sharedlib should be either \"sun4\", \"sys5\", or \"off\", not %s",
(void) sprintf(buffer
, "TYPESIG=%s", signl
);
/* loop over options string and add -D ccoptions */
for (ap
= cp
; dp
= index (ap
, ' '); ap
= dp
) {
(void) sprintf (buffer
, "%s-D%s", options
? " " : "", ap
);
options
= stradd (ap
, options
);
(void) sprintf (buffer
, "%s-D%s", options
? " " : "", ap
);
options
= stradd (ap
, options
);
if (strcmp (bboards
, "nntp") == 0 && mpop
)
"bboards \"nntp\" is incompatible with \"options MPOP\"");
options
= options
? stradd (s
, stradd (" ", options
)) : strdup (s
);
myopts
= strdup ("char *options[] = {");
static int nameoutput
= 0;
static int outputlinelen
= 72;
for (op
= copts
; op
->c_name
; op
++)
if (!strncmp (op
->c_name
,s
,strlen(op
->c_name
))) {
if (strcmp (s
, "MPOP") == 0)
if (smtp
&& strcmp (s
, "BERK") == 0) {
fprintf (stderr
, "\"options BERK\" overriding smtp suffix...\n");
printf ("%s: ", bp
= "options");
linepos
+= (nameoutput
= strlen (bp
) + 2);
if (linepos
!= nameoutput
)
if (len
+ linepos
+ 3 > outputlinelen
)
printf ("\n%*s", linepos
= nameoutput
, "");
*bp
++ = QUOTE
, *bp
++ = QUOTE
;
(void) strcpy (bp
, "\", ");
myopts
= stradd ("NULL};", myopts
);
if (s
== NULL
|| (p
= rindex (s
, '/')) == NULL
)
return ((p
== NULL
|| *p
== '\0') ? s
: p
);
static char *stradd (s1
, s2
)
if (s1
== NULL
|| *s1
== '\0')
if ((p
= malloc ((unsigned) (strlen (s1
) + strlen (s2
) + 2))) == NULL
)
adios (NULLCP
, "insufficient memory");
(void) sprintf (p
, "%s%s", s2
, s1
);
if ((p
= malloc ((unsigned) (strlen (s
) + 1))) == NULL
)
adios (NULLCP
, "insufficient memory");
/* these used to be for SYS5 machines, but now this is compiled
* with -DSYS5 which redefines the SYS5 str[r]chr names to [r]index.
static char *index (s
, c
)
static char *rindex (s
, c
)
adios (what
, fmt
, a
, b
, c
)
fprintf (stderr
, "%s: ", myname
);
fprintf (stderr
, fmt
, a
, b
, c
);
(void) fputc (' ', stderr
);
(void) fputc ('\n', stderr
);
/* quick and dirty ordering of options for readability */
static struct opt
*optp
= (struct opt
*)NULL
;
char *s
; /* string for sorting */
*lp
= (struct opt
*)NULL
;
if ((np
= (struct opt
*) malloc ((unsigned) sizeof (struct opt
))) ==
adios (NULL
, "unable to malloc opt");
np
-> n
= (struct opt
*)NULL
;
for (p
= optp
; p
; lp
= p
, p
= p
-> n
) {
if (strcmp (p
->s
, s
) > 0)
for (p
= optp
; p
; p
= p
-> n
)
myopts
= stradd (p
->s
, myopts
);