25 if (stat(fname, &status) == -1)
39 if (stat(dirname, &status) == -1)
80 size_t *r_max_nlntokens,
size_t *r_nbytes)
82 size_t nlines=0, ntokens=0, max_nlntokens=0, nbytes=0, oldntokens=0, nread;
87 fpin =
gk_fopen(fname,
"r",
"gk_GetFileStats");
90 nread = fread(
buffer,
sizeof(
char), 2048, fpin);
94 for (cptr=
buffer; *cptr!=
'\0'; cptr++) {
99 if (max_nlntokens < ntokens-oldntokens)
100 max_nlntokens = ntokens-oldntokens;
101 oldntokens = ntokens;
103 else if (*cptr ==
' ' || *cptr ==
'\t') {
113 if (max_nlntokens < ntokens-oldntokens)
114 max_nlntokens = ntokens-oldntokens;
118 if (r_nlines !=
NULL)
120 if (r_ntokens !=
NULL)
121 *r_ntokens = ntokens;
122 if (r_max_nlntokens !=
NULL)
123 *r_max_nlntokens = max_nlntokens;
124 if (r_nbytes !=
NULL)
137 char *startptr, *endptr;
140 if ((startptr = strrchr(
path,
'/')) ==
NULL)
143 startptr = startptr+1;
147 if ((endptr = strrchr(basename,
'.')) !=
NULL)
163 if ((startptr = strrchr(
path,
'.')) ==
NULL)
177 if ((startptr = strrchr(
path,
'/')) ==
NULL)
192 if ((endptr = strrchr(
path,
'/')) ==
NULL) {
197 *(strrchr(tmp,
'/')) =
'\0';
211 sprintf(tmp,
"mkdir -p %s", pathname);
223 sprintf(tmp,
"rm -r %s", pathname);