68 #include <sys/types.h>
79 if( getenv(
"TDEHOME" ))
80 strlcpy( tdehome, getenv(
"TDEHOME" ), 1024 );
81 else if( getenv(
"HOME" ))
83 strlcpy( tdehome, getenv(
"HOME" ), 1024 );
84 strlcat( tdehome,
"/.trinity", 1024 );
88 char filename[ 1024 ];
89 strlcpy( filename, tdehome, 1024 );
90 strlcat( filename,
"/share/config/startupconfig", 1024 );
91 if( access( filename, R_OK ) != 0 )
93 int ret = system(
"tdedostartupconfig" );
94 return WEXITSTATUS( ret );
96 strlcpy( filename, tdehome, 1024 );
97 strlcat( filename,
"/share/config/startupconfigfiles", 1024 );
99 if( stat( filename, &st ) != 0 )
101 int ret = system(
"tdedostartupconfig" );
102 return WEXITSTATUS( ret );
104 time_t config_time = st.st_mtime;
105 FILE* config = fopen( filename,
"r" );
108 int ret = system(
"tdedostartupconfig" );
109 return WEXITSTATUS( ret );
111 strlcpy( filename, tdehome, 1024 );
112 strlcat( filename,
"/share/config/startupconfigkeys", 1024 );
113 FILE* keys = fopen( filename,
"r" );
119 bool need_update =
true;
122 char keyline[ 1024 ];
123 if( fgets( keyline, 1023, keys ) == NULL )
128 if(
char* nl = strchr( keyline,
'\n' ))
131 if( fgets( line, 1023, config ) == NULL )
133 if(
char* nl = strchr( line,
'\n' ))
135 if( strcmp( keyline, line ) != 0 )
140 if( fgets( line, 1023, config ) == NULL )
142 if(
char* nl = strchr( line,
'\n' ))
153 if( access( line + 1, R_OK ) == 0 )
159 if( stat( line, &st ) != 0 )
161 if( st.st_mtime > config_time )
172 int ret = system(
"tdedostartupconfig" );
173 return WEXITSTATUS( ret );