Sat, 25 Jun 2005 17:58:42 +0000
[gaim-migrate @ 12905]
I use
CFLAGS="-g3 -D_FORTIFY_SOURCE=2 -Werror-implicit-function-declaration -Wno-pointer-sign -Wdeclaration-after-statement"
... shouldn't I be using Gentoo ?
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZGetWGPort function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * $Source$ | |
| 10867 | 7 | * $Author: thekingant $ |
| 2086 | 8 | * |
| 9 | * Copyright (c) 1987 by the Massachusetts Institute of Technology. | |
| 10 | * For copying and distribution information, see the file | |
| 11 | * "mit-copyright.h". | |
| 12 | */ | |
| 13 | /* $Header$ */ | |
| 14 | ||
| 15 | #ifndef lint | |
| 16 | static char rcsid_ZGetWGPort_c[] = "$Header$"; | |
| 17 | #endif | |
| 18 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
19 | #include "internal.h" |
| 2086 | 20 | |
| 21 | int ZGetWGPort() | |
| 22 | { | |
| 23 | char *envptr, name[128]; | |
| 24 | FILE *fp; | |
| 25 | int wgport; | |
| 10867 | 26 | #ifdef WIN32 |
| 27 | long int buffsize= 128; | |
| 28 | char tempdir[buffsize]; | |
| 29 | #endif | |
| 2086 | 30 | envptr = getenv("WGFILE"); |
| 31 | if (!envptr) { | |
| 10867 | 32 | #ifdef WIN32 |
| 33 | GetTempPath(buffsize,tempdir); | |
| 34 | GetTempFileName(tempdir,"wg.",0,name); | |
| 35 | #else | |
| 2086 | 36 | (void) sprintf(name, "/tmp/wg.%d", getuid()); |
| 10867 | 37 | #endif |
| 2086 | 38 | envptr = name; |
| 39 | } | |
|
10592
cd4c3a7d7bdf
[gaim-migrate @ 11998]
Daniel Atallah <datallah@pidgin.im>
parents:
10589
diff
changeset
|
40 | if (!(fp = fopen(envptr, "r"))) |
| 2086 | 41 | return (-1); |
| 42 | ||
| 43 | /* if fscanf fails, return -1 via wgport */ | |
| 44 | if (fscanf(fp, "%d", &wgport) != 1) | |
| 45 | wgport = -1; | |
| 46 | ||
| 47 | (void) fclose(fp); | |
| 48 | ||
| 49 | return (wgport); | |
| 50 | } |