~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/third_party/gsm/tls/taste.c

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
3
 
 * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
4
 
 * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
5
 
 */
6
 
 
7
 
/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/taste.c,v 1.1 1992/10/28 00:28:39 jutta Exp $*/
8
 
 
9
 
#include        <stdio.h>
10
 
#include        <string.h>
11
 
#include        <memory.h>
12
 
 
13
 
#include        "config.h"
14
 
 
15
 
#ifdef  HAS_STDLIB_H
16
 
#       include <stdlib.h>
17
 
#else
18
 
#include "proto.h"
19
 
#       ifdef   HAS_MALLOC_H
20
 
#       include <malloc.h>
21
 
#       else
22
 
                extern char     * malloc P((char *)), * realloc P((char *,int));
23
 
#       endif
24
 
        extern int exit P((int));
25
 
#endif
26
 
 
27
 
#include "proto.h"
28
 
 
29
 
/*
30
 
 * common code to sweet.c and bitter.c: read the name:#bits description.
31
 
 */
32
 
 
33
 
#include        "taste.h"
34
 
 
35
 
static struct spex  * s_spex;
36
 
static int n_spex, m_spex;
37
 
 
38
 
extern void     write_code P((struct spex *, int));
39
 
 
40
 
char * strsave P1((str), char * str)            /* strdup() + errors */
41
 
{
42
 
        int    n = strlen(str) + 1;
43
 
        char * s = malloc(n);
44
 
        if (!s) {
45
 
                fprintf(stderr, "Failed to malloc %d bytes, abort\n",
46
 
                        strlen(str) + 1);
47
 
                exit(1);
48
 
        }
49
 
        return memcpy(s, str, n);
50
 
}
51
 
 
52
 
struct spex * new_spex P0()
53
 
{
54
 
        if (n_spex >= m_spex) {
55
 
                m_spex += 500;
56
 
                if (!(s_spex = (struct spex *)(n_spex
57
 
                        ? realloc((char *)s_spex, m_spex * sizeof(*s_spex))
58
 
                        : malloc( m_spex * sizeof(*s_spex))))) {
59
 
                        fprintf(stderr, "Failed to malloc %d bytes, abort\n",
60
 
                                m_spex * sizeof(*s_spex));
61
 
                        exit(1);
62
 
                }
63
 
        }
64
 
        return s_spex + n_spex;
65
 
}
66
 
 
67
 
char * strtek P2((str, sep), char * str, char * sep) {
68
 
 
69
 
        static char     * S = (char *)0;
70
 
        char            * c, * base;
71
 
 
72
 
        if (str) S = str;
73
 
 
74
 
        if (!S || !*S) return (char *)0;
75
 
 
76
 
        /*  Skip delimiters.
77
 
         */
78
 
        while (*S) {
79
 
                for (c = sep; *c && *c != *S; c++) ;
80
 
                if (*c) *S++ = 0;
81
 
                else break;
82
 
        }
83
 
 
84
 
        base = S;
85
 
 
86
 
        /*   Skip non-delimiters.
87
 
         */
88
 
        for (base = S; *S; S++) {
89
 
 
90
 
                for (c = sep; *c; c++)
91
 
                        if (*c == *S) {
92
 
                                *S++ = 0;
93
 
                                return base;
94
 
                        }
95
 
        }
96
 
 
97
 
        return base == S ? (char *)0 : base;
98
 
}
99
 
 
100
 
int read_spex P0()
101
 
{
102
 
        char buf[200];
103
 
        char * s, *t;
104
 
        struct spex     * sp = s_spex;
105
 
 
106
 
        while (fgets(buf, sizeof buf, stdin)) {
107
 
 
108
 
                char    * nl;
109
 
 
110
 
                if (nl = strchr(buf, '\n'))
111
 
                        *nl = '\0';
112
 
 
113
 
                if (!*buf || *buf == ';') continue;
114
 
                s = strtek(buf, " \t");
115
 
                if (!s) {
116
 
                        fprintf(stderr, "? %s\n", buf);
117
 
                        continue;
118
 
                }
119
 
                sp = new_spex();
120
 
                sp->var = strsave(s);
121
 
                s = strtek((char*)0, " \t");
122
 
                if (!s) {
123
 
                        fprintf(stderr, "varsize?\n");
124
 
                        continue;
125
 
                }
126
 
                sp->varsize = strtol(s, (char **)0, 0);
127
 
                n_spex++;
128
 
        }
129
 
 
130
 
        return sp - s_spex;
131
 
}
132
 
 
133
 
int main P0()
134
 
{
135
 
        read_spex();
136
 
        write_code(s_spex, n_spex);
137
 
 
138
 
        exit(0);
139
 
}