Displaying 11 results from an estimated 11 matches for "upscli_splitname".
2007 Jan 14
1
upscli_splitname() for upsc_list (was: Re: Default NUT PORT)
On 1/13/07, Peter Selinger <selinger@mathstat.dal.ca> wrote:
> > The question is when exactly this should be converted to a number.
> > Should this be done in upscli_splitname() or in upscli_connect()? The
> > latter would require a change in the prototypes of upscli_splitname()
> > and upscli_connect(), and an attendant change in all the existing
> > clients. When changing the "port" argument to a string, the API should
> > also define...
2007 Jan 19
1
Re: [nut-commits] svn commit r755 - in trunk: . clients
...guest
> Date: Thu Jan 18 22:07:08 2007
> New Revision: 755
>
> Modified:
> trunk/ChangeLog
> trunk/clients/upsclient.c
> trunk/clients/upsclient.h
> Log:
> This one is for you, Peter... :-)
>
> * clients/upsclient.c:
> - hostname is now optional in upscli_splitname(), defaults to "localhost"
> - added upscli_splitaddr() to split a hostname[:port] into separate
> components
> - [domain literals] are now allowed as valid hostnames
>
> Maybe we should make the default hostname for upscli_splitname configurable?
>
> Mod...
2007 Jan 13
3
Default NUT PORT
In my latest patch, I hardcoded the port NUT uses for TCP communication
(3493). The reason is, that I can't figure out a way how to change the
numeric value of the #define'd PORT into a character string. Using
snprintf() and a temporary buffer just seems wrong, since this should be
handled by the preprocessor, rather than at runtime.
The following files are affected:
- server/conf.c (line
2007 Jan 23
2
Re: [nut-commits] svn commit r731
...> + }
> +
> + return 0;
> }
> -
> /* map upsd error strings back to upsclient internal numbers */
> static struct {
> int errnum;
> @@ -921,106 +912,60 @@
> return 0;
> }
>
> -/* split [upsname@]hostname[:port] into separate components */
> -int upscli_splitname(const char *buf, char **upsname, char **hostname,
> - int *port)
> +/* split upsname@hostname[:port] into separate components */
> +int upscli_splitname(const char *buf, char **upsname, char **hostname, int *port)
> {
> - char tmp[SMALLBUF], *ptr, *ap, *cp;
> + char tmp[SMALLBU...
2007 Jan 06
3
Re: [nut-commits] svn commit r708 - in trunk: . clients server
...48 @@
>
> ptr = ap;
>
> - cp = strchr(ptr, ':');
> + if (*ptr != '[') {
> + cp = strchr(ptr, ':');
> + if (cp) {
> + *cp++ = '\0';
> + *hostname = strdup(ptr);
> +
> + if (!*hostname) {
> + fprintf(stderr, "upscli_splitname: strdup failed\n");
> + return -1;
> + }
>
> - if (cp) {
> - *cp++ = '\0';
> - *hostname = strdup(ptr);
> + ptr = cp;
> +
> + *port = strtol(ptr, (char **) NULL, 10);
>
> - if (!*hostname) {
> - fprintf(stderr, "upscli_split...
2014 Jun 03
2
Tripp Lite SMART3000RM2U (protocol 3003) running time and charge?
...iidoc' was not found.
Using existing upscli_readline.3 manual page, since 'asciidoc' was not found.
Using existing upscli_sendline.3 manual page, since 'asciidoc' was not found.
Using existing upscli_splitaddr.3 manual page, since 'asciidoc' was not found.
Using existing upscli_splitname.3 manual page, since 'asciidoc' was not found.
Using existing upscli_ssl.3 manual page, since 'asciidoc' was not found.
Using existing upscli_strerror.3 manual page, since 'asciidoc' was not found.
Using existing upscli_upserror.3 manual page, since 'asciidoc' was no...
2014 Jun 03
0
Tripp Lite SMART3000RM2U (protocol 3003) running time and charge?
...ound.
> Using existing upscli_readline.3 manual page, since 'asciidoc' was not found.
> Using existing upscli_sendline.3 manual page, since 'asciidoc' was not found.
> Using existing upscli_splitaddr.3 manual page, since 'asciidoc' was not found.
> Using existing upscli_splitname.3 manual page, since 'asciidoc' was not found.
> Using existing upscli_ssl.3 manual page, since 'asciidoc' was not found.
> Using existing upscli_strerror.3 manual page, since 'asciidoc' was not found.
> Using existing upscli_upserror.3 manual page, since 'ascii...
2007 Jan 19
0
Re: [nut-commits] svn commit r755 - in trunk: . clients
...err, ...) in a library?
> This doesn't seem like a good idea to me. Wouldn't it be more
> consistent to extend upscli_errlist[] ?
Errorcodes are passed in 'ups->upserror' (and 'ups->syserrno'). Uh oh, we
don't have a connection to an UPS yet when we call upscli_splitname() or
upscli_splitaddr(). The upscli_strerror() function that is used to return
the message in upscli_errlist[] needs a pointer to a UPSCONN structure
also. The upscli_errlist[] is static, so there is no way to get to the
messages without calling upscli_strerror().
The reality is, that this is how...
2007 Jan 06
1
Re: [nut-commits] svn commit r710 - in trunk: . clients server
...upsclient internal numbers */
> @@ -872,6 +949,34 @@
>
> ptr = ap;
>
> +#ifndef HAVE_IPV6
> + cp = strchr(ptr, ':');
> +
> + if (cp) {
> + *cp++ = '\0';
> + *hostname = strdup(ptr);
> +
> + if (!*hostname) {
> + fprintf(stderr, "upscli_splitname: strdup failed\n");
> + return -1;
> + }
> +
> + ptr = cp;
> +
> + *port = strtol(ptr, (char **) NULL, 10);
> +
> + } else {
> +
> + *hostname = strdup(ptr);
> +
> + if (!*hostname) {
> + fprintf(stderr, "upscli_splitname: strdup failed\n&qu...
2014 Jun 01
0
Tripp Lite SMART3000RM2U (protocol 3003) running time and charge?
On May 24, 2014, at 5:49 PM, Stefan Bruda wrote:
>> Don't worry about the battery physical properties for now - the
>> problem there is that we don't have enough information from the UPS
>> to do a proper calculation. With the V_interval[] settings, you can
>> tweak the new state-of-charge calculation to match what you see via
>> upsc when the battery is
2014 May 24
3
Tripp Lite SMART3000RM2U (protocol 3003) running time and charge?
Hello,
At 09:24 -0400 on 2014-5-23 Charles Lepple wrote:
>
> See attached. Still doesn't have the writable V_interval values,
> but I probably won't have time to test that until later.
Thank you for the patch.
> Don't worry about the battery physical properties for now - the
> problem there is that we don't have enough information from the UPS
> to do a