Sun, 10 Nov 2019 05:20:10 -0500
zephyr: Modernize K&R function prototypes.
| 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 | * Copyright (c) 1987 by the Massachusetts Institute of Technology. | |
| 7 | * For copying and distribution information, see the file | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
8 | * "mit-copyright.h". |
| 2086 | 9 | */ |
| 10 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
11 | #include "internal.h" |
| 2086 | 12 | |
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
13 | int |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
14 | ZGetWGPort(void) |
| 2086 | 15 | { |
| 16 | char *envptr, name[128]; | |
| 17 | FILE *fp; | |
| 18 | int wgport; | |
| 10867 | 19 | #ifdef WIN32 |
| 20 | long int buffsize= 128; | |
| 21 | char tempdir[buffsize]; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
22 | #endif |
| 2086 | 23 | envptr = getenv("WGFILE"); |
| 24 | if (!envptr) { | |
| 10867 | 25 | #ifdef WIN32 |
| 26 | GetTempPath(buffsize,tempdir); | |
| 27 | GetTempFileName(tempdir,"wg.",0,name); | |
| 28 | #else | |
| 2086 | 29 | (void) sprintf(name, "/tmp/wg.%d", getuid()); |
| 10867 | 30 | #endif |
| 2086 | 31 | envptr = name; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
32 | } |
|
10592
cd4c3a7d7bdf
[gaim-migrate @ 11998]
Daniel Atallah <datallah@pidgin.im>
parents:
10589
diff
changeset
|
33 | if (!(fp = fopen(envptr, "r"))) |
| 2086 | 34 | return (-1); |
| 35 | ||
| 36 | /* if fscanf fails, return -1 via wgport */ | |
| 37 | if (fscanf(fp, "%d", &wgport) != 1) | |
| 38 | wgport = -1; | |
| 39 | ||
| 40 | (void) fclose(fp); | |
| 41 | ||
| 42 | return (wgport); | |
| 43 | } |