int readlastmark(struct lastmarkl *lm) { char buf[200], *ptr; FILE *fp; sprintf(buf, MY_BBS_HOME "/wwwtmp/lastmark/%s", lm->board); if ((fp = fopen(buf, "r")) == NULL) goto END; lm->count = 0; while (fgets(buf, 200, fp)) { if (dofilter(buf)) continue; ptr = strchr(buf, '\t'); if (ptr == NULL) break; ptr++; lm->thread[lm->count] = atoi(ptr); if (lm->thread[lm->count] == 0) break; ptr = strchr(ptr, '\t'); if (!ptr) break; ptr++; strsncpy(lm->title[lm->count], ptr, sizeof (lm->title[0])); ptr = strchr(lm->title[lm->count], '\n'); if (ptr) *ptr = 0; lm->count++; if (lm->count >= NBRDITEM) break; } fclose(fp); END: return lm->count; }
static void run (const gchar *name, gint nparams, const GimpParam *param, gint *nreturn_vals, GimpParam **return_vals) { static GimpParam values[1]; GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpRunMode run_mode; GimpDrawable *drawable; /* Setting mandatory output values */ *nreturn_vals = 1; *return_vals = values; values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; /* Getting run_mode - we won't display a dialog if * we are in NONINTERACTIVE mode */ run_mode = param[0].data.d_int32; /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); gimp_progress_init ( PLUGINPROGESSMESSAGE ); /* not ready.... Let's time blur ** GTimer timer = g_timer_new time(); */ dofilter (drawable); /* g_print (" %s took %g seconds.\n", PLUGINFUNCNAME , g_timer_elapsed (timer)); g_timer_destroy (timer); */ gimp_displays_flush (); gimp_drawable_detach (drawable); }
void consinit(void) { int i; cons.chan = ialloc(sizeof(Chan)); wlock(&cons.chan->reflock); wunlock(&cons.chan->reflock); lock(&cons.chan->flock); unlock(&cons.chan->flock); dofilter(&cons.work); dofilter(&cons.rate); dofilter(&cons.bhit); dofilter(&cons.bread); dofilter(&cons.binit); for(i = 0; i < MAXTAG; i++) dofilter(&cons.tags[i]); }