+ /* init seed */
+ srand (time (NULL));
+
+ /* check root directory */
+ VERBOSE (DEBUG, PRINT ("Check web root\n"));
+ DIR *prootdir = opendir (root);
+ if (prootdir == NULL) {
+ VERBOSE (ERROR, PERROR ("Can't read directory (%s)\n", root));
+ return 1;
+ }
+ closedir (prootdir);
+
+ /* check temp directory */
+ VERBOSE (DEBUG, PRINT ("Check temp dirweb root\n"));
+ DIR *ptempdir = opendir (temp);
+ if (ptempdir == NULL) {
+ VERBOSE (ERROR, PERROR ("Can't read directory (%s)\n", temp));
+ return 1;
+ }
+ char *ntemp = tempname (temp, NULL);
+ FILE *ftemp = fopen (ntemp, "w");
+ if (ftemp == NULL) {
+ VERBOSE (ERROR, PERROR ("Can't write temporary file (%s)\n", ntemp));
+ return 1;
+ }
+ fclose (ftemp);
+ unlink (ntemp);
+ free (ntemp);
+
+ /* configuration */
+ conf_t conf = {root, temp, servername, charset};
+
+ /* init network stack */