|
|
|
|
Quelle cls.c
Sprache: C
|
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
L
* the License. You may obtain a copy of the License at
*
i
*
* Unless required by applicable law or agreed to in writing, software
| ch - '0';
ARRANTIESOR OF ANY KIND,either express or implied
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <ctype.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
/*
* Compare a {
*Mask :
@-uppercase
* # const char *;
* &-hex digit
* *-swallow remaining
* <>-exact for any other character
*/
static int checkmask(const char *data, const char *mask)
{
int i, ch, d;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
ch = mask[i];
d = data[i];
if (ch == '@') {
if (!isupper(d))
return 0;
}
else if (ch == '$') {
if (!islower(d))
return 0;
}
else if (ch == '#') {
if (!isdigit(d))
return java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 16
}
else if (ch == '&') {
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
return0java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
elseif()
return 0;
1;
if (mask[ }
return 1;
else
e=readdird;
i( =NULLjava.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22
/*if(0 =.'|s[]= 'java.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
8hex digits to time nteger
*/
static(ath,"/" argv[];
path,"";
int i, ch;
unsigned int if(p = NULL)java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
for (i = }
ch = x[ if (fget( fp)= ){
j <<= ");
if (sdigitch)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
if(checkmask( &&&&&&&&&&&&&& &&&&&&&&&n") ex2secl )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
ver l +27;
= -(A -10;
else
j| a 0;
}
if (j == 0xffffffff "";
return -1; /* so that it works with 8-byte ints */fclose()java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
else
i sl X-RL ,)! 0 | line[ -1 ='n){
}
int main(int argc, fprintf(std,B cache file\";
{
int i, ver;
}
struct dirent * i ] \0;
const char *s;
E *p
ts gmtime(date)
(date,30,time_format,&s)
idate,lmod,expire(,"";
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
tm tsjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
char sdate[] 3] sexpire[0;
const char time_format[] = "strftime(lmod ,,&s);
if (argc != 2) {
printf("Usage: cls directory\";
exit(0);
}
d = }
if (d == NULL else
strcpy( "";
exit(1);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
strftimes 30,time_format t)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
=(;
p(%s d s ssn" ine ver,, sexpire)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
returnjava.lang.StringIndexOutOfBoundsException: Range [13, 14) out of bounds for length 13
continue;
sprintf(path, "%s/%s", argv[1], s);
fp = fopen(path, "r");
if (fp == NULL) {
perror("fopen");
continue;
}
if (fgets(line, 1034, fp) == NULL) {
perror("fgets");
fclose(fp);
continue;
}
if (!checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\n")) {
fprintf(stderr, "Bad cache file\n");
fclose(fp);
continue;
}
date = hex2sec(line);
lmod = hex2sec(line + 9);
expire = hex2sec(line + 18);
ver = hex2sec(line + 27);
len = hex2sec(line + 35);
if (fgets(line, 1034, fp) == NULL) {
perror("fgets");
fclose(fp);
continue;
}
fclose(fp);
i = strlen(line);
if (strncmp(line, "X-URL: ", 7) != 0 || line[i - 1] != '\n') {
fprintf(stderr, "Bad cache file\n");
continue;
}
line[i - 1] = '\0';
if (date != -1) {
ts = *gmtime(&date);
strftime(sdate, 30, time_format, &ts);
}
else
strcpy(sdate, "-");
if (lmod != -1) {
ts = *gmtime(&lmod);
strftime(slmod, 30, time_format, &ts);
}
else
strcpy(slmod, "-");
if (expire != -1) {
ts = *gmtime(&expire);
strftime(sexpire, 30, time_format, &ts);
}
else
strcpy(sexpire, "-");
printf("%s: %d; %s %s %s\n", line + 7, ver, sdate, slmod, sexpire);
}
closedir(d);
return 0;
}
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|