~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to clients/cgilib.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-07-20 19:48:50 UTC
  • mto: (16.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050720194850-oo61wjr33rrx2mre
Tags: upstream-2.0.2
ImportĀ upstreamĀ versionĀ 2.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
static char *unescape(char *buf)
27
27
{
28
 
        int     i, buflen;
 
28
        size_t  i, buflen;
29
29
        char    ch, *newbuf, hex[8];
30
30
 
31
31
        buflen = strlen(buf) + 2;
42
42
                if (ch == '%') {
43
43
                        if (i + 2 > buflen)
44
44
                                fatalx("string too short for escaped char");
45
 
                        hex[0] = buf[++i];
46
 
                        hex[1] = buf[++i];
 
45
                        hex[0] = buf[++i];
 
46
                        hex[1] = buf[++i];
47
47
                        hex[2] = '\0';
48
48
                        if (!isxdigit((unsigned char) hex[0])
49
 
                            || !isxdigit((unsigned char) hex[0]))
 
49
                                || !isxdigit((unsigned char) hex[0]))
50
50
                                fatalx("bad escape char");
51
 
                        ch = strtol(hex, NULL, 16);
 
51
                        ch = strtol(hex, NULL, 16);
52
52
 
53
53
                        if ((ch == 10) || (ch == 13))
54
54
                                ch = ' ';
55
 
                }
 
55
                }
56
56
 
57
57
                snprintfcat(newbuf, buflen, "%c", ch);
58
58
        }
149
149
}
150
150
 
151
151
/* called for fatal errors in parseconf like malloc failures */
152
 
void cgilib_err(const char *errmsg)
 
152
static void cgilib_err(const char *errmsg)
153
153
{
154
154
        upslogx(LOG_ERR, "Fatal error in parseconf(ups.conf): %s", errmsg);
155
155
}