Changeset 17965


Ignore:
Timestamp:
09/19/12 17:15:47 (12 years ago)
Author:
obi
Message:

[titan] show only last 500 lines in changelog

Location:
titan/titan
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/global.h

    r17963 r17965  
    11#ifndef GLOBAL_H
    22#define GLOBAL_H
     3
     4char* readfromlinetoline(char* str, int start, int end, int flag)
     5{
     6        if(str == NULL) return str;
     7
     8        char* tmpstr = NULL;
     9        int count = 0;
     10        int i = 0;
     11        struct splitstr* ret = NULL;
     12        ret = strsplit(str, "\n", &count);
     13
     14        for(i = 0; i < count; i++)
     15        {
     16                if(i >= start && i <= end)
     17                {
     18                        tmpstr = ostrcat(tmpstr, (&ret[i])->part, 1, 0);
     19                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
     20                }
     21        }
     22        free(ret), ret = NULL;
     23
     24        if(flag == 1)
     25        {
     26                free(str), str = NULL;
     27        }
     28        return tmpstr; 
     29}
    330
    431char* ltostr(char* str, long val, unsigned base)
  • titan/titan/header.h

    r17945 r17965  
    88#ifndef HEADER_H
    99#define HEADER_H
     10
     11char* gethttpreal(char* host, char* page, int port, char* filename, char* auth, struct download* dnode, int redirect, char* header, long* clen);
     12int sockreceive(int *fd, unsigned char* data, int count, int timeout);
    1013
    1114//rc4.h
     
    641644void htmldecode3(char* to, char* from);
    642645char* string_deltags(char* str);
     646char* readfromlinetoline(char* str, int start, int end, int flag);
    643647
    644648//rcconfig.h
  • titan/titan/info.h

    r17951 r17965  
    6565                char* boxversion = string_tolower(readsys("/etc/model", 1));
    6666                char* path = NULL;
     67                char* out = NULL;
    6768                path = ostrcat(path, "/svn/image-beta/changelog.", 1, 0);
    6869                path = ostrcat(path, boxversion, 1, 0);
     
    7172                free(path), path = NULL;
    7273                free(boxversion), boxversion = NULL;
    73                 changetext(info, tmpstr);
     74                out = readfromlinetoline(tmpstr, 37, 537, 1);
     75                changetext(info, out);
    7476        }
    7577        else if(mode == 2)
    7678        {       
    7779                char* path = NULL;
     80                char* out = NULL;
    7881                path = ostrcat(path, "/svn/image-beta/changelog.git", 1, 0);
    7982                tmpstr = gethttp("atemio.dyndns.tv", path, 80, NULL, HTTPAUTH, NULL, 0);
    8083                free(path), path = NULL;
    81                 changetext(info, tmpstr);
     84                out = readfromlinetoline(tmpstr, 0, 500, 1);
     85                changetext(info, out);
    8286        }
    8387
Note: See TracChangeset for help on using the changeset viewer.