File: getprotoenv.c

package info (click to toggle)
mailfront 2.12-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,072 kB
  • sloc: sh: 5,549; ansic: 5,083; makefile: 35
file content (23 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bglibs/systime.h>
#include <stdlib.h>
#include <bglibs/msg.h>
#include <bglibs/wrap.h>
#include "mailfront.h"

static const char* proto;

const char* getprotoenv(const char* name)
{
  static str fullname;
  const char* env;
  if (proto == 0)
    if ((proto = getenv("PROTO")) == 0)
      proto = "TCP";
  if (name == 0 || *name == 0)
    return proto;
  wrap_str(str_copy2s(&fullname, proto, name));
  if ((env = getenv(fullname.s)) != 0
      && env[0] == 0)
    env = 0;
  return env;
}