/*
* $Log$
+ * Revision 1.4 2008/02/15 18:16:48 james
+ * *** empty log message ***
+ *
* Revision 1.3 2008/02/15 18:16:35 james
* *** empty log message ***
*
if (i >= FILE_LIST_MAX_LEN)
return;
- for (fle=fl->head;fle;fle=fle->next)
- if (!strcmp(fle->name,fn)) return;
+ for (fle = fl->head; fle; fle = fle->next)
+ if (!strcmp (fle->name, fn))
+ return;
fle = malloc (sizeof (Filelist_ent));
free (fl);
}
-void filelist_print(Filelist *fl,FILE *f)
+void
+filelist_print (Filelist * fl, FILE * f)
{
-Filelist_ent *fle;
-if (!fl) {
- fprintf(f,"(empty list)\n");
- return;
-}
- for (fle=fl->head;fle;fle=fle->next)
- fprintf(f,"%s\n",fle->name);
+ Filelist_ent *fle;
+ if (!fl)
+ {
+ fprintf (f, "(empty list)\n");
+ return;
+ }
+ for (fle = fl->head; fle; fle = fle->next)
+ fprintf (f, "%s\n", fle->name);
}
char *lock_dirs[] =
{ "/var/lock/uucp", "/var/spool/lock", "/var/spool/uucp", "/etc/locks",
"/usr/spool/uucp", "/var/spool/locks", "/usr/spool/lock",
- "/usr/spool/locks",
+ "/usr/spool/locks",
"/usr/spool/uucp/LCK"
};
int i;
d = opendir (dir);
- if (!d) return;
+ if (!d)
+ return;
- while ((de = readdir (d)))
+ while ((de = readdir (d)))
{
strcpy (buf, dir);
strcat (buf, de->d_name);
}
Filelist *
-lockfile_make_list(char *device)
+lockfile_make_list (char *device)
{
struct stat dev_stat;
Filelist *ret = NULL;
return ret;
}
-void lockfile_remove_stale(Filelist *fl)
+void
+lockfile_remove_stale (Filelist * fl)
{
}
-Filelist *lockfile_lock(Filelist *fl)
+Filelist *
+lockfile_lock (Filelist * fl)
{
-Filelist *ret;
-Filelist_ent *fle;
+ Filelist *ret;
+ Filelist_ent *fle;
-ret=filelist_new();
+ ret = filelist_new ();
-lockfile_remove_stale(fl);
+ lockfile_remove_stale (fl);
-for (fle=fl->head;fle;fle=fle->next) {
- if (lockfile_make(fle->name)) {
- fprintf(stderr,"Failed to get lockfile %s\n",fle->name);
- filelist_free(ret);
- return NULL;
- }
- filelist_add(ret,fle->name);
-}
+ for (fle = fl->head; fle; fle = fle->next)
+ {
+ if (lockfile_make (fle->name))
+ {
+ fprintf (stderr, "Failed to get lockfile %s\n", fle->name);
+ filelist_free (ret);
+ return NULL;
+ }
+ filelist_add (ret, fle->name);
+ }
-return ret;
+ return ret;
}
#if 1
-int main(int argc,char *argv[])
+int
+main (int argc, char *argv[])
{
-Filelist *fl=lockfile_make_list("/dev/ttyS0");
-Filelist *fll;
-Filelist_ent *fle;
+ Filelist *fl = lockfile_make_list ("/dev/ttyS0");
+ Filelist *fll;
+ Filelist_ent *fle;
-filelist_print(fl,stdout);
+ filelist_print (fl, stdout);
-fll=lockfile_lock(fl);
+ fll = lockfile_lock (fl);
-filelist_print(fll,stdout);
+ filelist_print (fll, stdout);
}
#endif
-