1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
Description: Replace local getline func with local_getline.
--- a/cdown.c
+++ b/cdown.c
@@ -325,7 +325,7 @@
}
/************************************************************************/
-/* Procedure: getline
+/* Procedure: local_getline
* Purpose: read a line of text from the CDDB server
*
* Inputs:
@@ -333,14 +333,14 @@
* Returns: The line of text
* Notes:
* 1. The CDDB databases use \r\n to end lines. All lines returned
- * by getline() have the \r and \n stripped.
+ * by local_getline() have the \r and \n stripped.
* 2. Non-reentrant: the memory buffer returned previously is
* recycled
* 3. Do NOT modify the contents of the returned buffer past the
* NULL - data from the network is stored there
*/
/************************************************************************/
-char *getline(void) {
+char *local_getline(void) {
static char *buffer = NULL;
static char *lastline = NULL;
static int buffered = 0;
@@ -451,7 +451,7 @@
char *cdtitle;
netprintf(sock, "cddb read %s %s\n", categ, discid);
- message = getline();
+ message = local_getline();
switch (atoi(message)) {
case 401: fprintf(stderr, "error: entry not found\n"); return;
case 402: fprintf(stderr, "error: server error\n"); return;
@@ -461,13 +461,13 @@
default: fprintf(stderr, "error: bad message: %s\n", message); return;
}
while (iRawMode) { /* infinite loop, or skip if !iRawMode */
- message = getline();
+ message = local_getline();
if (!strcmp (message, "."))
return;
printf ("%s\r\n", message);
}
do {
- message = getline();
+ message = local_getline();
firstword = strchr(message, '=');
if (firstword != NULL) {
*firstword = '\0';
@@ -511,7 +511,7 @@
int input = 0;
int exact = 1;
- message = getline();
+ message = local_getline();
switch (atoi(message)) {
case 403: fprintf(stderr, "error: database entry is corrupt\n"); return;
case 409: fprintf(stderr, "error: no handshake\n"); return;
@@ -523,7 +523,7 @@
if (!exact) {
fprintf(stderr, "CD has no exact match\n 0: None\n");
do {
- message = getline();
+ message = local_getline();
if (strcmp(message, ".") != 0) {
matches = realloc(matches, sizeof(char*) * (++count));
fprintf(stderr, " %d: ", count); printcd(message);
@@ -628,15 +628,15 @@
void parsesites(void) {
char *buffer;
- buffer = getline();
+ buffer = local_getline();
switch (atoi(buffer)) {
case 210: break; /* OK */
case 401: fprintf(stderr, "error: no site list available\n"); return;
}
- buffer = getline();
+ buffer = local_getline();
do {
printf("%s\n", buffer);
- } while (strcmp(buffer = getline(), ".") != 0);
+ } while (strcmp(buffer = local_getline(), ".") != 0);
}
/************************************************************************/
@@ -755,7 +755,7 @@
exit(3);
}
- bleh = getline();
+ bleh = local_getline();
if (!signon(bleh)) {
errormsg("%s: signon error on host %s", progname, pszHost);
close(sock);
@@ -773,7 +773,7 @@
getuname(), gethname(), progname, VERSIONSTRING);
/* get welcome message */
- bleh = getline();
+ bleh = local_getline();
if (!welcome(bleh)) {
errormsg("%s: bad welcome message [%s]", progname, bleh);
close(sock);
|