]>
cygwin.com Git - cygwin-apps/setup.git/blob - ConnectionSetting.cc
2 * Copyright (c) 2003, Robert Collins <rbtcollins@hotmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins.
17 static const char *cvsid
=
21 #include "ConnectionSetting.h"
22 #include "UserSettings.h"
23 #include "io_stream.h"
29 ConnectionSetting::load()
31 static int inited
= 0;
34 io_stream
*f
= UserSettings::Instance().settingFileForLoad("last-connection");
38 char *fg_ret
= f
->gets (localdir
, 1000);
40 net_method
= typeFromString(fg_ret
);
41 fg_ret
= f
->gets (localdir
, 1000);
43 net_proxy_host
= strdup(fg_ret
);
44 fg_ret
= f
->gets (localdir
, 1000);
46 net_proxy_port
= atoi(fg_ret
);
53 ConnectionSetting::save()
57 io_stream
*f
= UserSettings::Instance().settingFileForSave("last-connection");
62 f
->write("Direct\n",7);
68 f
->write("Proxy\n",6);
69 f
->write(net_proxy_host
,strlen(net_proxy_host
));
70 sprintf(port_str
, "\n%d\n", net_proxy_port
);
71 f
->write(port_str
,strlen(port_str
));
81 ConnectionSetting::typeFromString(String
const & aType
)
83 if (!aType
.casecompare("Direct"))
84 return IDC_NET_DIRECT
;
85 if (!aType
.casecompare("IE"))
87 if (!aType
.casecompare("Proxy"))
90 /* A sanish default */
This page took 0.038339 seconds and 5 git commands to generate.