~ubuntu-branches/ubuntu/natty/iptraf/natty-proposed

« back to all changes in this revision

Viewing changes to src/cfconv.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2006-10-15 13:34:14 UTC
  • mfrom: (1.1.2 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061015133414-77itbhydih1z3amr
* Sync with Ubuntu fixes (by Oliver Grawert and Michael Vogt)
  * added fix for /var/run detection (since it is a tmpfs by default on
    Ubuntu) [and fixed ubuntu fix]
  * added support for ath devices
  * fixed FTBFS by changing linux/if_tr.h to netinet/if_tr.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include <sys/types.h>
3
 
#include <dirent.h>
4
 
#include <string.h>
5
 
#include "dirs.h"
6
 
 
7
 
int main(void)
8
 
{
9
 
    DIR *dir;
10
 
    char dirname[80];
11
 
    struct dirent *direntry;
12
 
    char fullpath1[80];
13
 
    char fullpath2[80];
14
 
    char *cptr;
15
 
 
16
 
    printf("Rearranging filter data files...\n");
17
 
 
18
 
    sprintf(dirname, "%s/%s", WORKDIR, "..");   /* parent of the workdir */
19
 
    dir = opendir(dirname);
20
 
 
21
 
    do {
22
 
        direntry = readdir(dir);
23
 
        if (direntry != NULL) {
24
 
            if (((strlen(direntry->d_name) > 6)
25
 
                 && (strncmp(direntry->d_name, "iptraf", 6) == 0))) {
26
 
                cptr = direntry->d_name + 6;
27
 
                strcpy(fullpath1, WORKDIR);
28
 
                strcpy(fullpath2, WORKDIR);
29
 
                strcat(fullpath1, "/../");
30
 
                strcat(fullpath2, "/");
31
 
                strcat(fullpath1, direntry->d_name);
32
 
                strcat(fullpath2, cptr);
33
 
                rename(fullpath1, fullpath2);
34
 
            }
35
 
        }
36
 
    } while (direntry != NULL);
37
 
 
38
 
    closedir(dir);
39
 
    return 0;
40
 
}