1 diff -ur cdtool-2.1.8.orig/cdown.c cdtool-2.1.8/cdown.c
2 --- cdtool-2.1.8.orig/cdown.c 2005-10-17 22:11:59.000000000 +0300
3 +++ cdtool-2.1.8/cdown.c 2009-06-19 20:15:57.000000000 +0300
7 /************************************************************************/
9 +/* Procedure: get_line
10 * Purpose: read a line of text from the CDDB server
14 * Returns: The line of text
16 * 1. The CDDB databases use \r\n to end lines. All lines returned
17 - * by getline() have the \r and \n stripped.
18 + * by get_line() have the \r and \n stripped.
19 * 2. Non-reentrant: the memory buffer returned previously is
21 * 3. Do NOT modify the contents of the returned buffer past the
22 * NULL - data from the network is stored there
24 /************************************************************************/
25 -char *getline(void) {
26 +char *get_line(void) {
27 static char *buffer = NULL;
28 static char *lastline = NULL;
29 static int buffered = 0;
33 netprintf(sock, "cddb read %s %s\n", categ, discid);
34 - message = getline();
35 + message = get_line();
36 switch (atoi(message)) {
37 case 401: fprintf(stderr, "error: entry not found\n"); return;
38 case 402: fprintf(stderr, "error: server error\n"); return;
40 default: fprintf(stderr, "error: bad message: %s\n", message); return;
42 while (iRawMode) { /* infinite loop, or skip if !iRawMode */
43 - message = getline();
44 + message = get_line();
45 if (!strcmp (message, "."))
47 printf ("%s\r\n", message);
50 - message = getline();
51 + message = get_line();
52 firstword = strchr(message, '=');
53 if (firstword != NULL) {
59 - message = getline();
60 + message = get_line();
61 switch (atoi(message)) {
62 case 403: fprintf(stderr, "error: database entry is corrupt\n"); return;
63 case 409: fprintf(stderr, "error: no handshake\n"); return;
66 fprintf(stderr, "CD has no exact match\n 0: None\n");
68 - message = getline();
69 + message = get_line();
70 if (strcmp(message, ".") != 0) {
71 matches = realloc(matches, sizeof(char*) * (++count));
72 fprintf(stderr, " %d: ", count); printcd(message);
74 void parsesites(void) {
78 + buffer = get_line();
79 switch (atoi(buffer)) {
80 case 210: break; /* OK */
81 case 401: fprintf(stderr, "error: no site list available\n"); return;
84 + buffer = get_line();
86 printf("%s\n", buffer);
87 - } while (strcmp(buffer = getline(), ".") != 0);
88 + } while (strcmp(buffer = get_line(), ".") != 0);
91 /************************************************************************/
99 errormsg("%s: signon error on host %s", progname, pszHost);
102 getuname(), gethname(), progname, VERSIONSTRING);
104 /* get welcome message */
107 if (!welcome(bleh)) {
108 errormsg("%s: bad welcome message [%s]", progname, bleh);