summaryrefslogtreecommitdiff
path: root/noncore/todayplugins/stockticker/libstocks/currency.c
Unidiff
Diffstat (limited to 'noncore/todayplugins/stockticker/libstocks/currency.c') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/libstocks/currency.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/todayplugins/stockticker/libstocks/currency.c b/noncore/todayplugins/stockticker/libstocks/currency.c
index 9a08a9d..e0090e2 100644
--- a/noncore/todayplugins/stockticker/libstocks/currency.c
+++ b/noncore/todayplugins/stockticker/libstocks/currency.c
@@ -31,36 +31,37 @@
31/*****************************************************************************/ 31/*****************************************************************************/
32/* returns the currency exchange rate of "from" currency into */ 32/* returns the currency exchange rate of "from" currency into */
33/* "into" currency. */ 33/* "into" currency. */
34/*****************************************************************************/ 34/*****************************************************************************/
35libstocks_return_code get_currency_exchange(char *from, 35libstocks_return_code get_currency_exchange(char *from,
36 char *into, 36 char *into,
37 float *exchange) 37 float *exchange)
38{ 38{
39 char *symbol; 39 char *symbol;
40 stock *data; 40 stock *data;
41 libstocks_return_code error; 41 libstocks_return_code error;
42 42
43 if((symbol = (char *)malloc(strlen(from)+strlen(into)+3))==NULL) 43 if((symbol = (char *)malloc(strlen(from)+strlen(into)+3))==NULL)
44 { 44 {
45 fprintf(stderr,"Memory allocating error (%s line %d)\n" 45 fprintf(stderr,"Memory allocating error (%s line %d)\n"
46 ,__FILE__, __LINE__); 46 ,__FILE__, __LINE__);
47 exit(1); 47 exit(1);
48 } 48 }
49 49
50 strcpy(symbol, from); 50 strcpy(symbol, from);
51 strcat(symbol, into); 51 strcat(symbol, into);
52 strcat(symbol, "=X"); 52 strcat(symbol, "=X");
53 53
54 error = get_stocks(symbol, &data); 54 error = get_stocks(symbol, &data);
55 free(symbol);
55 if (error) 56 if (error)
56 { 57 {
57 *exchange = 0; 58 *exchange = 0;
58 return(error); 59 return(error);
59 } 60 }
60 61
61 free_stocks(data); 62 free_stocks(data);
62 63
63 *exchange = data->CurrentPrice; 64 *exchange = data->CurrentPrice;
64 return(error); 65 return(error);
65 66
66} 67}