ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/idar/idar.c
(Generate patch)

Comparing projects/cms/source/idar/idar.c (file contents):
Revision 1.8 by pajs, Sun Mar 30 23:21:55 2003 UTC vs.
Revision 1.13 by pajs, Wed Apr 9 20:13:53 2003 UTC

# Line 29 | Line 29
29   #include <unistd.h>
30   #include <stdlib.h>
31   #include <ukcprog.h>
32 + #include <netinet/in.h>
33 + #include <netdb.h>
34 + #include <sys/termios.h>
35  
36   #include <libxml/xmlmemory.h>
37   #include <libxml/parser.h>
# Line 235 | Line 238 | int cmp_cpu(machine_data_list_t *a, machine_data_list_
238          }
239   }
240   */
241 +
242 + #ifndef HAVE_ATOLL
243 + long long int atoll (const char *nptr){
244 +  return strtoll (nptr, (char **) NULL, 10);
245 + }
246 + #endif
247 +
248 + #ifndef HAVE_STRLCPY
249 + /*
250 + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
251 + * All rights reserved.
252 + *
253 + * Redistribution and use in source and binary forms, with or without
254 + * modification, are permitted provided that the following conditions
255 + * are met:
256 + * 1. Redistributions of source code must retain the above copyright
257 + *    notice, this list of conditions and the following disclaimer.
258 + * 2. Redistributions in binary form must reproduce the above copyright
259 + *    notice, this list of conditions and the following disclaimer in the
260 + *    documentation and/or other materials provided with the distribution.
261 + * 3. The name of the author may not be used to endorse or promote products
262 + *    derived from this software without specific prior written permission.
263 + *
264 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
265 + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
266 + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
267 + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
268 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
269 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
270 + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
271 + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
272 + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
273 + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
274 + */
275 +
276 + /*
277 + * Copy src to string dst of size siz.  At most siz-1 characters
278 + * will be copied.  Always NUL terminates (unless siz == 0).
279 + * Returns strlen(src); if retval >= siz, truncation occurred.
280 + */
281 + size_t
282 + strlcpy(dst, src, siz)
283 +        char *dst;
284 +        const char *src;
285 +        size_t siz;
286 + {
287 +        register char *d = dst;
288 +        register const char *s = src;
289 +        register size_t n = siz;
290 +
291 +        /* Copy as many bytes as will fit */
292 +        if (n != 0 && --n != 0) {
293 +                do {
294 +                        if ((*d++ = *s++) == 0)
295 +                                break;
296 +                } while (--n != 0);
297 +        }
298 +
299 +        /* Not enough room in dst, add NUL and traverse rest of src */
300 +        if (n == 0) {
301 +                if (siz != 0)
302 +                        *d = '\0';              /* NUL-terminate dst */
303 +                while (*s++)
304 +                        ;
305 +        }
306 +
307 +        return(s - src - 1);    /* count does not include NUL */
308 + }
309 +
310 + #endif
311 +
312          
313   FILE *create_tcp_connection(char *hostname, int port){
314          int sock;
# Line 718 | Line 792 | int main(int argc, char **argv){
792          WINDOW *window;
793          fd_set infds;
794          int maxx, maxy;
795 +        struct winsize size;
796  
797          FILE *control;
798          FILE *data;
# Line 834 | Line 909 | int main(int argc, char **argv){
909          control=create_tcp_connection(servername, server_control_port);
910          if(control==NULL){
911                  errf("Failed to connect (%m)");
912 +                exit(1);
913          }
914  
915          if(argc==4){
# Line 877 | Line 953 | int main(int argc, char **argv){
953          data=create_tcp_connection(servername, server_data_port);
954          if(data==NULL){
955                  errf("Failed to connect to host %s on port %d (%m)",servername, server_data_port);
956 +                exit(1);
957          }
958  
959          /*      
# Line 900 | Line 977 | int main(int argc, char **argv){
977                  FD_ZERO(&infds);
978                  FD_SET(stdin_fileno, &infds);
979                  FD_SET(data_fileno, &infds);
980 <                select(biggest_fileno, &infds, NULL, NULL, NULL);
980 >                if((select(biggest_fileno, &infds, NULL, NULL, NULL))==-1){
981 >                        if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) {
982 >                                resizeterm(size.ws_row, size.ws_col);
983 >                                wrefresh(curscr);
984 >                        }
985 >                        getmaxyx(window, maxy, maxx);
986 >                        title=1;
987 >                        display(machine_data_list, &display_config, maxy, &title);
988 >                        refresh();
989 >                        continue;
990 >                }
991                  
992                  if(FD_ISSET(stdin_fileno, &infds)){
993                  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines