int main(int argc, char *argv[]) { char *me, *fileS; FILE *file; unsigned int llen; NrrdIoState *io; me = argv[0]; if (2 != argc) { /* 0 1 (2) */ fprintf(stderr, "usage: %s <file>\n", me); exit(1); } fileS = argv[1]; if (!( file = myopen(fileS) )) { fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, fileS); exit(1); } io = nrrdIoStateNew(); do { if (_nrrdOneLine(&llen, io, file)) { fprintf(stderr, "%s: trouble:\n%s", me, biffGet(NRRD)); exit(1); } if (llen) { printf("%2u |%s|\n", llen, io->line); } } while(llen > 0); nrrdIoStateNix(io); myclose(file); exit(0); }
void loadconfig() { FILE *cfg; cfg = myopen("settings.dat", "rb"); if (!cfg) { settings.dif_enemies = 0; settings.dif_nebula = 0; settings.dif_ship = 0; settings.random_names = 7; settings.opt_mucrontext = 1; settings.opt_timerwarnings = 1; settings.opt_mousemode = 0; settings.opt_timeremaining = 0; settings.opt_lensflares = 1; settings.opt_smoketrails = 1; settings.opt_volume = 8; s_volume = 80; return; } fread(&settings, sizeof(t_gamesettings), 1, cfg); fclose(cfg); s_volume = settings.opt_volume * 10; settings.opt_mousemode &= 1; }
int main () { int fd, cnt; char buf[12]; fd = myopen ("/tmp/demo/1.txt", O_CREAT | O_RDWR); if (fd == -1) { perror ("open: "); return -1; } cnt = myread (fd, buf, 10); if (cnt > 0) { mywrite (STDIN_FILENO, buf, cnt); } else { perror ("write: "); } printf ("\nexiting...\n"); sleep (1); return 0; }
int main(void) { char *buf = malloc(sizeof(char)*6), *buf2 = malloc(sizeof(char)*6); struct itimerval* itval = malloc(sizeof(struct itimerval) - 1); int diff = buf2 - buf; buf[0] = 'h'; buf[1] = 'e'; buf[2] = 'l'; buf[3] = 'l'; buf[4] = 'o'; buf[5] = 'x'; // error (read) (will fail due to -1, as we want -- don't want any // unpredictable output to foul up the test) mywrite(buf+3, 5); // error (read) mywrite(buf-1, 5); // error (read) mywrite(buf+1, diff); // error (read) myopen(buf+3, 0x0); // error (read_asciiz) mygetitimer(0, itval); // error (write) //---- free(buf); mywrite(buf, 5); // error mywrite(buf+3, 5); // error mywrite(buf+1, diff); // error (read) return 0; }
// -------------------------------------------------------------------- // main // -------------------------------------------------------------------- int main(int argc, char**argv){ if (!myopen()) { printf("Cannot open port %s\n", DEV); return -1; } Byte buf[10]; unsigned int l=0; // write l=1; buf[0]=0xAA; if (!mywrite(buf, l)) { printf("Cannot write on port\n"); } // read l=1; if (!myread(buf, l, 10)) { printf("Cannot read on port\n"); } else { printf("read:0x%02x\n", buf[0]); } myclose(); return 0; }
int main (int argc, char** argv) { FILE* fsrc = NULL; unsigned char** buf = NULL; char fname[10][256]; int* fsize; int ret, nr_srcfiles, i; char key; FILE* r,*w; /* check arguments */ if (argc != 3) { printf ("usage: mysplit src key\n"); exit (-1); } myopen(&r, argv[1]); key = (char)atoi(argv[2]); w=fopen("tmp.dat", "wa"); // decode(r, w, key); split("tmp.dat"); printf("split is done\n"); return 0; }
int open_null(void) { int fd = myopen("/dev/null", O_RDWR); if (fd == -1) error_exit(TRUE, FALSE, "Failed to open file /dev/null.\n"); return fd; }
void CopyFileAndCheck(char *from, char *to) { int fromfid, tofid, n; char buf[512]; fromfid = myopen(from, O_RDONLY, 0666); tofid = myopen(to, O_WRONLY | O_TRUNC | O_CREAT, 0666); if (fromfid < 0 || tofid < 0) { perror(progName); (void)sprintf(buf, "CopyFileAndCheck(%s->%s) failed!", from, to); Punt(buf); } do { n = read(fromfid, buf, 512); if (n) (void) write(tofid, buf, n); } while (n); myclose(fromfid); myclose(tofid); }
int vpopen(char *path, int oflag) { char buf[MAXPATH + 1]; int returncode; int i; if ((returncode = myopen(path, oflag, 0666)) == -1 && path[0] != '/' && oflag == OPENFLAG_READ) { vpinit(NULL); for (i = 1; i < vpndirs; i++) { (void) snprintf(buf, sizeof(buf), "%s/%s", vpdirs[i], path); if ((returncode = myopen(buf, oflag, 0666)) != -1) { break; } } } return(returncode); }
void saveconfig() { FILE *cfg; cfg = myopen("settings.dat", "wb"); if (!cfg) return; fwrite(&settings, sizeof(t_gamesettings), 1, cfg); fclose(cfg); }
void initraces(void) { FILE* ini; char s1[64], s2[256]; char end; int num; int flag; int n, com; ini = myopen("gamedata/races.ini", "rb"); if (!ini) return; end = 0; num = 0; flag = 0; while (!end) { end = read_line(ini, s1, s2); com = -1; for (n = 0; n < rckMax; n++) if (!strcmp(s1, race_keywords[n])) com = n; if (flag == 0) { if (com == rckBegin) { races[num].fleet=-1; flag = 1; } } else switch(com) { case rckName: strcpy(races[num].name, s2); break; case rckText: strcpy(races[num].text, s2); break; case rckText2: strcpy(races[num].text2, s2); break; case rckEnd: num++; flag = 0; break; default: ; } } num_races = num; fclose(ini); }
void restraint_fetch_http (SoupURI *url, const gchar *base_path, ArchiveEntryCallback archive_entry_callback, FetchFinishCallback finish_callback, gpointer user_data) { g_return_if_fail(url != NULL); g_return_if_fail(base_path != NULL); FetchData *fetch_data = g_slice_new0(FetchData); fetch_data->archive_entry_callback = archive_entry_callback; fetch_data->finish_callback = finish_callback; fetch_data->user_data = user_data; fetch_data->url = url; fetch_data->base_path = base_path; GError *tmp_error = NULL; gint r; session = soup_session_new(); fetch_data->a = archive_read_new(); if (fetch_data->a == NULL) { g_set_error(&fetch_data->error, RESTRAINT_FETCH_LIBARCHIVE_ERROR, 0, "archive_read_new failed"); g_idle_add (archive_finish_callback, fetch_data); return; } fetch_data->ext = archive_write_disk_new(); if (fetch_data->ext == NULL) { g_set_error(&fetch_data->error, RESTRAINT_FETCH_LIBARCHIVE_ERROR, 0, "archive_write_disk_new failed"); g_idle_add (archive_finish_callback, fetch_data); return; } archive_read_support_filter_all(fetch_data->a); archive_read_support_format_all(fetch_data->a); gboolean open_succeeded = myopen(fetch_data, &tmp_error); if (!open_succeeded) { g_propagate_error(&fetch_data->error, tmp_error); g_idle_add (archive_finish_callback, fetch_data); return; } r = archive_read_open(fetch_data->a, fetch_data, NULL, myread, myclose); if (r != ARCHIVE_OK) { g_set_error(&fetch_data->error, RESTRAINT_FETCH_LIBARCHIVE_ERROR, r, "archive_read_open failed: %s", archive_error_string(fetch_data->a)); g_idle_add (archive_finish_callback, fetch_data); return; } g_idle_add (http_archive_read_callback, fetch_data); }
FILE *do_include(char *include_string) { /* Skip over whitespace: Is first character a quote or double quote, if so, interpret string a filename. Else interpret string as a variable and evaluate it. If it is not of string type, assume it is a filename. */ char *fstring,*fname; char *s; char quotechar; int len; FILE *fd; s = include_string; while(*s && isspace(*s)) s++; /* Skip whitespace */ quotechar = 0; if(*s == QUOTECHAR1 || *s == QUOTECHAR2) { quotechar = *s++; } fstring = s; while(*s && *s != quotechar && !isspace(*s) && (quotechar || *s != COMCHAR)){ s++; } len = s-fstring; fname = (char *) malloc(len+1); strncpy(fname,fstring,len); fname[len] = '\0'; if(quotechar) { fd = myopen(fname); } else { /* TODO: Interpret as CTP variable */ fd = myopen(fname); } if(!fd) { fprintf(STDERR,"(thLoad) Failed to open '%s'\n",fname); if(thFdListP) fd = thFdListP->fd; fd = 0; } free(fname); return(fd); }
int mygetchar () { char filename[200]; int i; int c; FILE *f; struct myfcb fcb; int status; debut: c = mygetchar2 (); if (c == '"') { for (i=0; ; i++) { c = mygetchar2 (); if (c == '"') { filename[i] = 0; break; } filename[i] = c; } /* f = fopen (filename, "r"); if (f == NULL) { perror (filename); } else { file_level++; files[file_level] = f; } */ file_level++; /* files[file_level].taille_enreg = 1; movename (filename, files[file_level].nom); */ status = myopen (files+file_level, filename); if (status) { perror (filename); file_level--; } goto debut; } return c; }
int main () { char buf[255]; int n; int fd = myopen("test.c", O_RDONLY); while( ( n = read(fd, buf, 254) ) > 0 ) { buf[n] = 0; printf("%s", buf); } return 0; }
static unsigned null_CAN_TRANSMIT(const char *devicename) { #if WIN32 struct DeviceCapabilities { unsigned AdapterId; /* An Id that identifies the adapter model.*/ char AdapterModelName; /* String containing a printable adapter model.*/ unsigned AdapterBus; /* The type of bus the adapter is plugged to. */ unsigned CanTransmit; /* TRUE if the adapter is able to perform frame injection.*/ unsigned CanSetTransmitPower; /* TRUE if the adapter's transmit power is can be specified by the user application.*/ unsigned ExternalAntennaPlug; /* TRUE if the adapter supports plugging one or more external antennas.*/ unsigned SupportedMedia; unsigned SupportedBands; } caps; void * (*myopen)(const char *devicename, char *errbuf); void (*myclose)(void *h); unsigned (*mycapabilities)(void *h, struct DeviceCapabilities *caps); unsigned result = 0; void *hAirpcap; hAirpcap = LoadLibraryA("airpcap.dll"); if (hAirpcap == NULL) return 0; myopen = (void * (*)(const char *, char*))GetProcAddress(hAirpcap, "AirpcapOpen"); myclose = (void (*)(void*))GetProcAddress(hAirpcap, "AirpcapClose"); mycapabilities = (unsigned (*)(void*, struct DeviceCapabilities *))GetProcAddress(hAirpcap, "AirpcapGetDeviceCapabilities"); if (myopen && mycapabilities && myclose ) { void *h = myopen(devicename, NULL); if (h) { if (mycapabilities(h, &caps)) { result = caps.CanTransmit; } myclose(h); } } FreeLibrary(hAirpcap); return result; #elif defined(__linux__) return 1; #elif defined(__APPLE__) || defined(__FreeBSD__) return 1; #else #error unknown os #endif }
static bhandle PipeOpen( char *name ) { char buff[ MAX_PIPE_NAME+1 ]; char *end; end = buff; if( MachBuff[0] != '\0' ) { buff[0] = '\\'; buff[1] = '\\'; strcpy( buff+2, MachBuff ); end = buff + strlen( buff ); } strcpy( end, name ); return( myopen( buff ) ); }
int main (int argc, char** argv) { char* buf = NULL; int fsize, ret; char key; FILE *r, *w; /* check arguments */ if (argc != 4) { printf ("usage: mydecode src dst key\n"); exit (-1); } myopen(&r, argv[1], &w, argv[2]); fsize=decode(r, w, atoi(argv[3])); printf("%s is decodded to %s (%d bytes)\n",argv[1],argv[2],fsize); return 0; }
int bb_mknod(const char *path, mode_t mode, dev_t dev) { int retstat = 0; char * mode_str; log_msg("\nbb_mknod(path=\"%s\", mode=0%3o, dev=%lld)\n", path, mode, dev); if (mode & O_RDONLY) { mode_str = "r"; } else { mode_str = "w"; } int fd = myopen(path, mode_str); myclose(fd); return retstat; }
int main (int argc, char** argv) { int arq; char buf[TAM]; ssize_t lidos; if (argc != 2) { fprintf(stderr,"forma correta: %s <nomearquivo>\n", argv[0]); return 1; } arq = myopen (argv[1], O_RDONLY, TAM); if (arq<0) { perror("abertura de arquivo"); return 1;} while ((lidos = myread (arq, buf)) > 0) if ((mywrite (STDOUT_FILENO, buf, lidos) != lidos)) { perror("escrita:"); return 1;} myclose (arq); return 0; }
char * logdir(char *name) { char *p; int i, j; int pwf; /* attempt to open the password file */ if ((pwf = myopen("/etc/passwd", 0, 0)) == -1) return(0); /* find the matching password entry */ do { /* get the next line in the password file */ i = read(pwf, line, OURBUFSIZ); for (j = 0; j < i; j++) if (line[j] == '\n') break; /* return a null pointer if the whole file has been read */ if (j >= i) return(0); line[++j] = 0; /* terminate the line */ (void) lseek(pwf, (long) (j - i), 1); /* point at the next line */ p = nextfield(line); /* get the logname */ } while (*name != *line || /* fast pretest */ strcmp(name, line) != 0); (void) close(pwf); /* skip the intervening fields */ p = nextfield(p); p = nextfield(p); p = nextfield(p); p = nextfield(p); /* return the login directory */ (void) nextfield(p); return(p); }
int main(void) { MYFILE *fp; char path[1024]; char input[1024]; char output[1024]; size_t ret; int len; printf("bufsize: %d\n", BUFSIZ); printf("pls input a path: "); my_fgets(path, 1024); printf("pls input a str: "); my_fgets(input, 1024); len = strlen(input); printf("len: %d\n", len); fp = myopen(path, "w+"); ret = mywrite(input, 1, len, fp); printf("write ret: %d\n", ret); myrewind(fp); myread(output, 1, len, fp); output[len] = '\0'; printf("read ret: %d\n", ret); printf("%s\n", output); myclose(fp); return 0; }
int bb_open(const char *path, struct fuse_file_info *fi) { int retstat = 0; int fd; log_msg("\nbb_open(path\"%s\", fi=0x%08x)\n", path, fi); char * mode_str; mode_t mode = fi->flags; if (mode & O_RDONLY) { mode_str = "r"; } else { mode_str = "w"; } fd = myopen(path, mode_str); fi->fh = fd; log_fi(fi); return retstat; }
int main(int argc, char **argv) { FILE *map; int proFd; char *mapFile, *proFile, *mult = 0; size_t len = 0, indx = 1; unsigned long long add0 = 0; unsigned int step; unsigned int *buf, total, fn_len; unsigned long long fn_add, next_add; /* current and next address */ char fn_name[S_LEN], next_name[S_LEN]; /* current and next name */ char mode[8]; int c; ssize_t rc; int optAll = 0, optInfo = 0, optReset = 0, optVerbose = 0, optNative = 0; int optBins = 0, optSub = 0; char mapline[S_LEN]; int maplineno = 1; int popenMap; /* flag to tell if popen() has been used */ int header_printed; static const struct option longopts[] = { {"mapfile", required_argument, NULL, 'm'}, {"profile", required_argument, NULL, 'p'}, {"multiplier", required_argument, NULL, 'M'}, {"info", no_argument, NULL, 'i'}, {"verbose", no_argument, NULL, 'v'}, {"all", no_argument, NULL, 'a'}, {"histbin", no_argument, NULL, 'b'}, {"counters", no_argument, NULL, 's'}, {"reset", no_argument, NULL, 'r'}, {"no-auto", no_argument, NULL, 'n'}, {"version", no_argument, NULL, 'V'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, 0, 0} }; #define next (current^1) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); atexit(close_stdout); proFile = defaultpro; mapFile = defaultmap; while ((c = getopt_long(argc, argv, "m:p:M:ivabsrnVh", longopts, NULL)) != -1) { switch (c) { case 'm': mapFile = optarg; break; case 'n': optNative++; break; case 'p': proFile = optarg; break; case 'a': optAll++; break; case 'b': optBins++; break; case 's': optSub++; break; case 'i': optInfo++; break; case 'M': mult = optarg; break; case 'r': optReset++; break; case 'v': optVerbose++; break; case 'V': printf(UTIL_LINUX_VERSION); return EXIT_SUCCESS; case 'h': usage(stdout); default: usage(stderr); } } if (optReset || mult) { int multiplier, fd, to_write; /* When writing the multiplier, if the length of the * write is not sizeof(int), the multiplier is not * changed. */ if (mult) { multiplier = strtoul(mult, 0, 10); to_write = sizeof(int); } else { multiplier = 0; /* sth different from sizeof(int) */ to_write = 1; } /* try to become root, just in case */ ignore_result( setuid(0) ); fd = open(defaultpro, O_WRONLY); if (fd < 0) err(EXIT_FAILURE, "%s", defaultpro); if (write(fd, &multiplier, to_write) != to_write) err(EXIT_FAILURE, _("error writing %s"), defaultpro); close(fd); exit(EXIT_SUCCESS); } /* Use an fd for the profiling buffer, to skip stdio overhead */ if (((proFd = open(proFile, O_RDONLY)) < 0) || ((int)(len = lseek(proFd, 0, SEEK_END)) < 0) || (lseek(proFd, 0, SEEK_SET) < 0)) err(EXIT_FAILURE, "%s", proFile); buf = xmalloc(len); rc = read(proFd, buf, len); if (rc < 0 || (size_t) rc != len) err(EXIT_FAILURE, "%s", proFile); close(proFd); if (!optNative) { int entries = len / sizeof(*buf); int big = 0, small = 0; unsigned *p; size_t i; for (p = buf + 1; p < buf + entries; p++) { if (*p & ~0U << (sizeof(*buf) * 4)) big++; if (*p & ((1 << (sizeof(*buf) * 4)) - 1)) small++; } if (big > small) { warnx(_("Assuming reversed byte order. " "Use -n to force native byte order.")); for (p = buf; p < buf + entries; p++) for (i = 0; i < sizeof(*buf) / 2; i++) { unsigned char *b = (unsigned char *)p; unsigned char tmp; tmp = b[i]; b[i] = b[sizeof(*buf) - i - 1]; b[sizeof(*buf) - i - 1] = tmp; } } } step = buf[0]; if (optInfo) { printf(_("Sampling_step: %u\n"), step); exit(EXIT_SUCCESS); } total = 0; map = myopen(mapFile, "r", &popenMap); if (map == NULL && mapFile == defaultmap) { mapFile = boot_uname_r_str(); map = myopen(mapFile, "r", &popenMap); } if (map == NULL) err(EXIT_FAILURE, "%s", mapFile); while (fgets(mapline, S_LEN, map)) { if (sscanf(mapline, "%llx %7[^\n ] %127[^\n ]", &fn_add, mode, fn_name) != 3) errx(EXIT_FAILURE, _("%s(%i): wrong map line"), mapFile, maplineno); /* only elf works like this */ if (!strcmp(fn_name, "_stext") || !strcmp(fn_name, "__stext")) { add0 = fn_add; break; } maplineno++; } if (!add0) errx(EXIT_FAILURE, _("can't find \"_stext\" in %s"), mapFile); /* * Main loop. */ while (fgets(mapline, S_LEN, map)) { unsigned int this = 0; int done = 0; if (sscanf(mapline, "%llx %7[^\n ] %127[^\n ]", &next_add, mode, next_name) != 3) errx(EXIT_FAILURE, _("%s(%i): wrong map line"), mapFile, maplineno); header_printed = 0; /* the kernel only profiles up to _etext */ if (!strcmp(next_name, "_etext") || !strcmp(next_name, "__etext")) done = 1; else { /* ignore any LEADING (before a '[tT]' symbol * is found) Absolute symbols and __init_end * because some architectures place it before * .text section */ if ((*mode == 'A' || *mode == '?') && (total == 0 || !strcmp(next_name, "__init_end"))) continue; if (*mode != 'T' && *mode != 't' && *mode != 'W' && *mode != 'w') break; /* only text is profiled */ } if (indx >= len / sizeof(*buf)) errx(EXIT_FAILURE, _("profile address out of range. Wrong map file?")); while (indx < (next_add - add0) / step) { if (optBins && (buf[indx] || optAll)) { if (!header_printed) { printf("%s:\n", fn_name); header_printed = 1; } printf("\t%llx\t%u\n", (indx - 1) * step + add0, buf[indx]); } this += buf[indx++]; } total += this; if (optBins) { if (optVerbose || this > 0) printf(" total\t\t\t\t%u\n", this); } else if ((this || optAll) && (fn_len = next_add - fn_add) != 0) { if (optVerbose) printf("%016llx %-40s %6u %8.4f\n", fn_add, fn_name, this, this / (double)fn_len); else printf("%6u %-40s %8.4f\n", this, fn_name, this / (double)fn_len); if (optSub) { unsigned long long scan; for (scan = (fn_add - add0) / step + 1; scan < (next_add - add0) / step; scan++) { unsigned long long addr; addr = (scan - 1) * step + add0; printf("\t%#llx\t%s+%#llx\t%u\n", addr, fn_name, addr - fn_add, buf[scan]); } } } fn_add = next_add; strcpy(fn_name, next_name); maplineno++; if (done) break; } /* clock ticks, out of kernel text - probably modules */ printf("%6u %s\n", buf[len / sizeof(*buf) - 1], "*unknown*"); /* trailer */ if (optVerbose) printf("%016x %-40s %6u %8.4f\n", 0, "total", total, total / (double)(fn_add - add0)); else printf("%6u %-40s %8.4f\n", total, _("total"), total / (double)(fn_add - add0)); popenMap ? pclose(map) : fclose(map); exit(EXIT_SUCCESS); }
static void h_xstor(struct context *ctx, char *arg, int flags) { char *t; int f = -1; struct stat st; int stou = 0; char tbuf[PATH_MAX + 1]; DebugIn(DEBUG_COMMAND); if (ctx->transfer_in_progress) { reply(ctx, MSG_501_Transfer_in_progress); DebugOut(DEBUG_COMMAND); return; } ctx->outgoing_data = 0; if (ctx->dfn > -1 && io_get_cb_i(ctx->io, ctx->dfn) == (void *) accept_data) { io_set_i(ctx->io, ctx->dfn); io_clr_o(ctx->io, ctx->dfn); io_set_cb_e(ctx->io, ctx->dfn, (void *) cleanup_data); io_set_cb_h(ctx->io, ctx->dfn, (void *) cleanup_data); } quota_add(ctx, 0); if (ctx->quota_path && (ctx->quota_ondisk >= ctx->quota_limit)) { reply(ctx, MSG_451_quota_exceeded); logmsg("%s: quota limit reached", ctx->user); DebugOut(DEBUG_COMMAND); return; } if (!arg) { stou = -1; snprintf(tbuf, sizeof(tbuf), "%s/stou.XXXXXX", ctx->cwd); arg = tbuf; t = buildpath(ctx, arg); } else if (acl_binary_only(ctx, arg, (t = buildpath(ctx, arg)))) { reply(ctx, MSG_504_no_ascii); cleanup_data_reuse(ctx, ctx->dfn); DebugOut(DEBUG_COMMAND); return; } st.st_size = 0; if (t) acl_set_umask(ctx, arg, t); if (ctx->anonymous || stou) flags |= O_EXCL; if (t && (!ctx->anonymous || check_incoming(ctx, t, 077)) && !pickystat_path(ctx, &st, t) && (stat(t, &st), (f = myopen(t, O_RDWR | O_CREAT | O_LARGEFILE | O_NOFOLLOW | flags, ctx->chmod_filemask | (0644 & ~ctx->umask), stou)) > -1)) { fcntl(f, F_SETFD, FD_CLOEXEC); ctx->quota_filesize_before_stor = st.st_size; ctx->quota_update_on_close = 1; if (ctx->dfn < 0) connect_port(ctx); if (ctx->dfn < 0) { reply(ctx, MSG_431_Opening_datacon_failed); close(f); ctx->dbuf = buffer_free_all(ctx->dbuf); DebugOut(DEBUG_COMMAND); return; } ctx->ffn = f; if (strlen(t) >= sizeof(ctx->filename)) { logerr("buffer too small in %s:%d (%s/%s)", __FILE__, __LINE__, ctx->user, t); reply(ctx, MSG_551_Internal_error); close(f); cleanup(ctx, ctx->dfn); ctx->dbuf = buffer_free_all(ctx->dbuf); DebugOut(DEBUG_COMMAND); return; } strcpy(ctx->filename, t); ctx->filesize = 0; ctx->bytecount = 0; if (io_get_cb_i(ctx->io, ctx->dfn) == (void *) socket2buffer || is_connected(ctx->dfn)) { if (stou) replyf(ctx, "125 FILE: %s\r\n", ctx->filename + ctx->rootlen); else replyf(ctx, MSG_125_Starting_dc, ctx->use_ascii ? "ASCII" : "BINARY", ctx->use_tls_d ? "TLS " : ""); } else { if (stou) replyf(ctx, "150 FILE: %s\r\n", ctx->filename + ctx->rootlen); else replyf(ctx, MSG_150_Opening_dc, ctx->use_ascii ? "ASCII" : "BINARY", ctx->use_tls_d ? "TLS " : ""); } ctx->transfer_in_progress = 1; if (ctx->io_offset) { if (ctx->use_ascii) { ctx->offset = 0; ctx->remaining = st.st_size; io_sched_add(ctx->io, ctx, (void *) skipbytes, 0, 0); #ifdef WITH_MMAP if (use_mmap) ctx->iomode = IOMODE_mmap; else #endif ctx->iomode = IOMODE_read, ctx->iomode_fixed = 1; } else { lseek(f, ctx->io_offset, SEEK_SET); ctx->io_offset = 0; } } if (io_get_cb_i(ctx->io, ctx->dfn) == (void *) socket2buffer) { /* already connected */ io_clr_o(ctx->io, ctx->dfn); io_set_i(ctx->io, ctx->dfn); } ctx->transferstart = io_now.tv_sec; ctx->count_files++; } else { if (stou && errno == EEXIST) reply(ctx, MSG_451_unique_file_failure); else reply(ctx, MSG_550_Permission_denied); cleanup_data_reuse(ctx, ctx->dfn); } DebugOut(DEBUG_COMMAND); }
int main (int argc, char **argv) { FILE *pro; FILE *map; int proFd; char *mapFile, *proFile; unsigned int len, add0=0, step, index, totalticks, percent, totalpercent; unsigned int *buf, total, fn_len; unsigned int fn_add, next_add; /* current and next address */ char fn_name[S_LEN], next_name[S_LEN]; /* current and next name */ char mode[8]; int c; int optAll=0, optInfo=0, optReset=0, optVerbose=0; char mapline[S_LEN]; int maplineno=1; int popenMap; /* flag to tell if popen() has been used */ #define next (current^1) prgname=argv[0]; proFile=defaultpro; mapFile=defaultmap; while ((c=getopt(argc,argv,optstring))!=-1) { switch(c) { case 'm': mapFile=optarg; break; case 'p': proFile=optarg; break; case 'a': optAll++; break; case 'i': optInfo++; break; case 'r': optReset++; break; case 'v': optVerbose++; break; case 'V': printf("%s Version %s\n",prgname,RELEASE); exit(0); default: usage(); } } if (optReset) { /* try to become root, just in case */ setuid(0); pro=fopen(defaultpro,"a"); if (!pro) {perror(proFile); exit(1);} fprintf(pro,"anything\n"); fclose(pro); exit(0); } /* * Use an fd for the profiling buffer, to skip stdio overhead */ if ( ((proFd=open(proFile,O_RDONLY)) < 0) || ((len=lseek(proFd,0,SEEK_END)) < 0) || (lseek(proFd,0,SEEK_SET)<0) ) { fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno)); exit(1); } if ( !(buf=malloc(len)) ) { fprintf(stderr,"%s: malloc(): %s\n",prgname, strerror(errno)); exit(1); } if (read(proFd,buf,len) != len) { fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno)); exit(1); } close(proFd); for (index = 0, totalticks = 0; (index < len/sizeof(int)); index++) totalticks += buf[index]; index = 0; step=buf[0]; if (optInfo) { printf("Sampling_step: %i\n",step); exit(0); } total=0; totalpercent = 0; if (!(map=myopen(mapFile,"r",&popenMap))) {fprintf(stderr,"%s: ",prgname);perror(mapFile);exit(1);} while(fgets(mapline,S_LEN,map)) { if (sscanf(mapline,"%x %s %s",&fn_add,mode,fn_name)!=3) { fprintf(stderr,"%s: %s(%i): wrong map line\n", prgname,mapFile, maplineno); exit(1); } if (strcmp(fn_name,"__stext") == 0) /* only elf works like this */ { add0=fn_add; break; } } if (!add0) { fprintf(stderr,"%s: can't find \"__stext\" in %s\n",prgname, mapFile); exit(1); } /* * Main loop. */ while(fgets(mapline,S_LEN,map)) { unsigned int this=0; if (sscanf(mapline,"%x %s %s",&next_add,mode,next_name)!=3) { fprintf(stderr,"%s: %s(%i): wrong map line\n", prgname,mapFile, maplineno); exit(1); } /* only text is profiled */ if (*mode!='T' && *mode!='t' && *mode!='W' && *mode!='w') break; while (index < (next_add-add0)/step) this += buf[index++]; total += this; fn_len = next_add-fn_add; percent = (this * 100) / totalticks; totalpercent += percent; if (percent && (this || optAll)) { if (optVerbose) printf("%3d%% %08x %-36s %6i %8d.%04d\n", percent, fn_add,fn_name,this, (this / fn_len), ((this*10000)/fn_len)%10000 ); else printf("%3d%% %6i %-36s %8d.%04d\n", percent, this,fn_name, (this / fn_len), ((this*10000)/fn_len)%10000 ); } fn_add=next_add; strcpy(fn_name,next_name); } /* trailer */ printf("---------------------------------------------------------------------------\n"); if (optVerbose) printf("%3d%% %08x %-36s %6i %8d.%04d\n", totalpercent, 0,"total",total, (total / (fn_add-add0)), ((total*10000)/(fn_add-add0))%10000 ); else printf("%3d%% %6i %-36s %8d.%04d\n", totalpercent, total,"total", (total / (fn_add-add0)), ((total*10000)/(fn_add-add0))%10000 ); popenMap ? pclose(map) : fclose(map); exit(0); }
void combat_initshipweapons() { FILE* ini; char s1[64], s2[256]; char end; int num; int flag; int n, com; char ts1[64]; char ts[4][64]; int tv1, tv2; ini = myopen("gamedata/weapons.ini", "rb"); if (!ini) return; end = 0; num = 0; while (!end) { end = read_line(ini, s1, s2); if (!strcmp(s1, shipweapon_keywords[wpkBegin])) num++; } fclose(ini); shipweapons = (t_shipweapon*)calloc(num, sizeof(t_shipweapon)); if (!shipweapons) return; num_shipweapons = num; ini = myopen("gamedata/weapons.ini", "rb"); end = 0; num = 0; flag = 0; while (!end) { end = read_line(ini, s1, s2); com = -1; for (n = 0; n < wpkMax; n++) if (!strcmp(s1, shipweapon_keywords[n])) com = n; if (flag == 0) { if (com == wpkBegin) { flag = 1; shipweapons[num].item = -1; } } else switch(com) { case wpkName: strcpy(shipweapons[num].name, s2); shipweapons[num].flags = 0; break; case wpkStage: for (n = 0; n < num; n++) if (!strcmp(shipweapons[n].name, s2)) shipweapons[num].stage = n; break; case wpkType: sscanf(s2, "%d", &tv1); shipweapons[num].type = tv1; break; case wpkFlag: for (n = 0; n < 4; n++) strcpy(ts[n], ""); sscanf(s2, "%s %s %s %s", ts[0], ts[1], ts[2], ts[3]); for (n = 0; n < 4; n++) for (tv1 = 0; tv1 < wpfMax; tv1++) if (!strcmp(shipweapon_flagwords[tv1], ts[n])) shipweapons[num].flags |= (1<<tv1); break; case wpkSprite: sscanf(s2, "%s %d", ts1, &tv2); shipweapons[num].sprite = spr_weapons->spr[tv2]; break; case wpkSize: sscanf(s2, "%d", &tv1); shipweapons[num].size = tv1; break; case wpkSound1: sscanf(s2, "%d", &tv1); if (shipweapons[num].type==1) tv1+=SND_PROJS; else tv1+=SND_BEAMS; shipweapons[num].sound1 = tv1; break; case wpkSound2: sscanf(s2, "%d", &tv1); tv1+=SND_HITS; shipweapons[num].sound2 = tv1; break; case wpkRate: sscanf(s2, "%d", &tv1); shipweapons[num].rate = tv1; break; case wpkSpeed: sscanf(s2, "%d", &tv1); shipweapons[num].speed = tv1; break; case wpkDamage: sscanf(s2, "%d", &tv1); shipweapons[num].damage = tv1; break; case wpkRange: sscanf(s2, "%d", &tv1); shipweapons[num].range = tv1; break; case wpkEnd: num++; flag = 0; break; default: ; } } fclose(ini); }
void combat_initshipsystems() { FILE* ini; char s1[64], s2[256]; char end; int num; int flag; int n, com; int tv1; char systype[16][32]; int32 num_systypes; ini = myopen("gamedata/systems.ini", "rb"); if (!ini) return; end = 0; num = 0; flag = 0; num_systypes = 0; while (!end) { end = read_line(ini, s1, s2); if (!strcmp(s1, shipsystem_keywords[sykBegin])) num++; if (!strcmp(s1, "SYSTEMTYPES")) { flag = 1; n=0; } else if (flag>0 && strcmp(s1, "END")==0) flag = 0; else if (flag == 1) { strcpy(systype[n], s1); num_systypes++; n++; } } fclose(ini); shipsystems = (t_shipsystem*)calloc(num, sizeof(t_shipsystem)); if (!shipsystems) return; num_shipsystems = num; ini = myopen("gamedata/systems.ini", "rb"); end = 0; num = 0; flag = 0; while (!end) { end = read_line(ini, s1, s2); com = -1; for (n = 0; n < sykMax; n++) if (!strcmp(s1, shipsystem_keywords[n])) com = n; if (flag == 0) { if (com == sykBegin) { flag = 1; shipsystems[num].item = -1; } } else switch(com) { case sykName: strcpy(shipsystems[num].name, s2); break; case sykType: for (n = 0; n < num_systypes; n++) if (!strcmp(s2, systype[n])) shipsystems[num].type = n; if (shipsystems[num].type == sys_weapon) { shipsystems[num].par[0] = -1; for (n = 0; n < num_shipweapons; n++) if (!strcmp(shipsystems[num].name, shipweapons[n].name)) shipsystems[num].par[0] = n; } break; case sykSize: sscanf(s2, "%d", &tv1); shipsystems[num].size = tv1; break; case sykParam1: case sykParam2: case sykParam3: case sykParam4: sscanf(s2, "%d", &tv1); shipsystems[num].par[com-sykParam1] = tv1; break; case sykEnd: num++; flag = 0; break; default: ; } } fclose(ini); }
int main (int argc, char *argv[]) { int i,j,nb_files,nb_files_orig; myFH *log_file[argc-1]; char *log_buffer[argc-1]; char *log_scan[argc-1]; char *log_month[argc-1]; char ref_date_buf[DATE_SIZE+1]; char *tmp_date_buf[argc-1]; char *log_date; int year,day,hour,minut,second; char month[3]; struct tm *date; time_t start=0; time_t start_new; char *trans_digits[60]; char *trans_year[200]; char months[24]="anebarprayunulugepctovec"; /* print usage if necessary */ if (argc == 1) { fprintf(stderr,"usage: %s logfile1 logfile2 ...\nmergelog %s Copyright (C) 2000-2001 Bertrand Demiddelaer\n",argv[0],VERSION); exit(1); } #ifdef USE_ZLIB /* check if there are enough gunzip buffers */ if(argc>MAX_FILES) { fputs("too many gzipped log files, aborting\n",stderr); exit(1); } #endif /* open log files */ for (i=1;i<argc;i++) { log_file[i-1]=myopen(argv[i],"r"); if (log_file[i-1] == NULL) { fprintf(stderr,"can't open %s, aborting\n",argv[i]); exit(1); } } /* feed arrays which will be used to translate dates */ for(i=0;i<60;i++) { trans_digits[i]=malloc(3); if (trans_digits[i] == NULL) { perror("malloc"); exit(1); } sprintf(trans_digits[i],"%.2d",i); } for (i=70;i<200;i++) { trans_year[i]=malloc(5); if (trans_year[i] == NULL) { perror("malloc"); exit(1); } sprintf(trans_year[i],"%.4d",1900+i); } /* malloc for the 'tm' structure */ date=malloc(sizeof(struct tm)); if (date == NULL) { perror("malloc"); exit(1); } /* init things for each log file and get the older date to start with */ nb_files=argc-1; for (i=0;i<argc-1;i++) { #ifdef USE_ZLIB /* init the gzip buffer */ f_buf[i]=malloc(GZBUFFER_SIZE); if (f_buf[i] == NULL) { perror("malloc"); exit(1); } f_cp[i]=f_buf[i]+GZBUFFER_SIZE; #endif /* init log_month buffers the first 2 digits will be used for the number of the month the last 2 digits will be used for the two letters of the month */ log_month[i]=calloc(4,1); if (log_month[i] == NULL) { perror("calloc"); exit(1); } /* get the first line of the log file and init log_scan */ log_buffer[i]=malloc(BUFFER_SIZE); log_scan[i]=log_buffer[i]+SCAN_OFFSET; if (log_buffer[i] == NULL) { perror("malloc"); exit(1); } /* init the tmp_date_buf */ tmp_date_buf[i]=malloc(DATE_SIZE+1); if (tmp_date_buf[i] == NULL) { perror("malloc"); exit(1); } memset(tmp_date_buf[i]+DATE_SIZE,'0',1); /* is it an empty file ? */ if (mygets(log_buffer[i],BUFFER_SIZE,log_file[i],i) != NULL ) { /* get the date pointers */ log_date=memchr(log_scan[i],'[',SCAN_SIZE); if (log_date == NULL) { fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); exit(1); } /* put the date in the tmp_date_buf */ for (j=0;((j == 12)&&(memcmp(months+2*j,log_date+5,2) != 0));j++); if (j == 12) { fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); exit(1); } memcpy(log_month[i],trans_digits[j],2); memcpy(log_month[i]+2,months+2*j,2); memcpy(tmp_date_buf[i],log_date+8,4); memcpy(tmp_date_buf[i]+4,trans_digits[j],2); memcpy(tmp_date_buf[i]+6,log_date+1,2); memcpy(tmp_date_buf[i]+8,log_date+13,2); memcpy(tmp_date_buf[i]+10,log_date+16,2); memcpy(tmp_date_buf[i]+12,log_date+19,2); /* extract the date of this first line */ if (sscanf(log_date+1,"%d/%3c/%d:%d:%d:%d",&day,month,&year,&hour,&minut,&second) < 6) { fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); exit(1); } /* put this date in a 'tm' structure */ date->tm_sec=second; date->tm_min=minut; date->tm_hour=hour; date->tm_mday=day; date->tm_year=year-1900; date->tm_isdst=-1; for (j=0;((j<12)&&(memcmp(months+2*j,month+1,2) != 0));j++); if (j == 12) { fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); exit(1); } date->tm_mon=j; memcpy(log_month[i],trans_digits[j],2); memcpy(log_month[i]+2,months+2*j,2); memcpy(tmp_date_buf[i]+4,trans_digits[j],2); /* convert it in the 'seconds since 00:00:00, Jan 1, 1970' format */ start_new=mktime(date); /* keep the older date */ if ((start_new < start)||(start == 0)) { start=start_new; } } else { /* this is an empty file */ nb_files--; *(tmp_date_buf[i])='9'; } } /* exit if we have only empty files */ if (nb_files == 0) { exit(0); } /* init 'start', 'date' and 'ref_date_buf' */ free(date); start--; date=localtime(&start); memcpy(ref_date_buf,trans_year[date->tm_year],4); memcpy(ref_date_buf+4,trans_digits[date->tm_mon],2); memcpy(ref_date_buf+6,trans_digits[date->tm_mday],2); memcpy(ref_date_buf+8,trans_digits[date->tm_hour],2); memcpy(ref_date_buf+10,trans_digits[date->tm_min],2); memcpy(ref_date_buf+12,trans_digits[date->tm_sec],2); memset(ref_date_buf+DATE_SIZE,'0',1); /* start to compute since this date */ nb_files_orig=argc-1; for(;;) { /* update 'start' 'date' and 'ref_date_buf' */ start++; if (date->tm_sec < 59) { date->tm_sec++; memcpy(ref_date_buf+12,trans_digits[date->tm_sec],2); } else { date->tm_sec=0; memset(ref_date_buf+12,'0',2); if (date->tm_min < 59) { date->tm_min++; memcpy(ref_date_buf+10,trans_digits[date->tm_min],2); } else { date->tm_min=0; memset(ref_date_buf+10,'0',2); if (date->tm_hour < 23) { date->tm_hour++; memcpy(ref_date_buf+8,trans_digits[date->tm_hour],2); } else { memset(ref_date_buf+8,'0',2); date=localtime(&start); memcpy(ref_date_buf,trans_year[date->tm_year],4); memcpy(ref_date_buf+4,trans_digits[date->tm_mon],2); memcpy(ref_date_buf+6,trans_digits[date->tm_mday],2); } } } /* scan this date for each log file */ for(i=0;i<nb_files_orig;i++) { /* write the log lines until the reference date is older than the log line */ for(;;) { /* if the reference date is older than the log line then go to next file we use here a faster implementation than something like: if (memcmp(ref_date_buf,tmp_date_buf[i],DATE_SIZE)<0) break; */ for(j=0;(j<DATE_SIZE)&&(*(ref_date_buf+j)==*(tmp_date_buf[i]+j));j++); if (*(ref_date_buf+j)<*(tmp_date_buf[i]+j)) break; /* write the log line faster than a puts and we are sure to find a '\0' in log_buffer[i] */ write(1,log_buffer[i],(size_t)((char *)memchr(log_buffer[i],0,BUFFER_SIZE)-log_buffer[i])); /* is it an end of file ? */ if (mygets(log_buffer[i],BUFFER_SIZE,log_file[i],i) == NULL) { /* close all log files and exit if all end of files are reached */ if (--nb_files == 0) { for (j=0;j<argc-1;j++) { myclose(log_file[j]); } exit(0); } /* we don't want anymore output from this file we put a '9' at the beginning of the year, to fail the date test it's dirty, but it's fast, and doesn't need an extra test */ *(tmp_date_buf[i])='9'; break; } else { /* prepare the new pointer for the date test */ log_date=memchr(log_scan[i],'[',SCAN_SIZE); if (log_date != NULL) { /* convert the log line month if necessary copy the new date in the buffer */ if ((*(log_month[i]+2)==*(log_date+5))&&(*(log_month[i]+3)==*(log_date+6))) { memcpy(tmp_date_buf[i]+4,log_month[i],2); memcpy(tmp_date_buf[i],log_date+8,4); memcpy(tmp_date_buf[i]+6,log_date+1,2); memcpy(tmp_date_buf[i]+8,log_date+13,2); memcpy(tmp_date_buf[i]+10,log_date+16,2); memcpy(tmp_date_buf[i]+12,log_date+19,2); } else { for (j=0;((j<12)&&(memcmp(months+2*j,log_date+5,2) != 0));j++); if (j == 12) { fprintf(stderr,"problem with %s:\n%s\ncontinuing...\n",argv[i+1],log_buffer[i]); } else { memcpy(log_month[i],trans_digits[j],2); memcpy(log_month[i]+2,months+2*j,2); memcpy(tmp_date_buf[i]+4,trans_digits[j],2); memcpy(tmp_date_buf[i],log_date+8,4); memcpy(tmp_date_buf[i]+6,log_date+1,2); memcpy(tmp_date_buf[i]+8,log_date+13,2); memcpy(tmp_date_buf[i]+10,log_date+16,2); memcpy(tmp_date_buf[i]+12,log_date+19,2); } } } else { fprintf(stderr,"problem with %s:\n%s\ncontinuing...\n",argv[i+1],log_buffer[i]); } } } } } /* never reached */ exit(1); }
thStatus thLoad(char *fname) /* Open the file and read in all the blocks of test, histogram, or parameter code. Put the contents of each block into the title field of variables with the names block.TYPE.NAME. May want to change this later to take a file descriptor, not a file name (so that pipes can be used.) */ { FILE *INPUT_FILE; /* Descriptor file */ char *varname, *vartitle, **grouplist; int qualid,ig; if((INPUT_FILE = myopen(fname))==NULL) { fprintf(STDERR,"(thLoad) Failed to open %s\n",fname); return(S_FAILURE); } while(getblock(&INPUT_FILE,&varname,&vartitle,&qualid ,&grouplist)==S_SUCCESS){ daVarStruct var,*varp; if(daVarLookup(varname,&var) == S_SUCCESS){ /* Variable exists */ if(var.type != DAVARINT){ fprintf(STDERR,"Type for variable %s must be integer\n",varname); return(S_FAILURE); } /* Free and zero the varptr to indicate that this block has not been booked. */ if(var.varptr) { free(var.varptr); var.varptr = 0; } /* printf("XX: Found %s\n",varname);*/ } else { var.name = varname; var.type = DAVARINT; var.varptr = 0; /* Null pointer means not yet booked */ var.size = 1; var.opaque = 0; /* Booking routine may add opaque data */ var.rhook = 0; var.whook = 0; var.flag = DAVAR_READONLY | DAVAR_REPOINTOK; } var.title = vartitle; /* The lines to book test, hists, pars etc. */ var.flag = qualflags[qualid] | DAVAR_REPOINTOK; /* printf("XX: Registering %s\n",varname);*/ if(daVarRegister((int) 0, &var) == S_FAILURE){ /* Create block desciptor */ fprintf(STDERR,"Failure to register %s\n",varname); fclose(INPUT_FILE); return(S_FAILURE); } daVarLookupP(var.name,&varp); /* Go attach this block to each group, create var for group if it doesn't exist, check that block is not in group before adding it at the end. Do we do the group stuff before or after the block is fully read in? */ for(ig=0;grouplist[ig];ig++) { daVarStruct varg; daVarStructList *blist; /* Block list */ thGroupOpaque *opqptr; if(daVarLookup(grouplist[ig],&varg) != S_SUCCESS){ /* Variable exists */ varg.name = grouplist[ig]; varg.type = DAVARINT; varg.varptr = (void *) malloc(sizeof(DAINT)); *(DAINT *)varg.varptr = 0; varg.size = 1; varg.opaque = (void *) malloc(sizeof(thGroupOpaque)); opqptr = (thGroupOpaque *) varg.opaque; thInitGroupOpaque(varg.name,opqptr); /* Fill the elelments of the structure */ varg.rhook = 0; varg.whook = 0; /* Can put something neat here */ varg.flag = DAVAR_READONLY | DAVAR_REPOINTOK; varg.title = 0; /* Would be nice to put group descriptions here */ } else opqptr = (thGroupOpaque *) varg.opaque; blist = opqptr->blocklist; thAddVarToList(&blist, varp); if(!opqptr->blocklist) { /* Create group list var if it doesn't exist */ opqptr->blocklist = blist; if(daVarRegister((int) 0, &varg) == S_FAILURE){ fprintf(STDERR,"Failure to register %s\n",varg.name); fclose(INPUT_FILE); return(S_FAILURE); } } /* printf("X %s\n",grouplist[ig]);*/ } } /* Are we covering up something. Should we be able to get to here with a null value for INPUT_FILE? Does it mean we have left a file open? */ if(INPUT_FILE) fclose(INPUT_FILE); #if 0 { daVarStruct varg; daVarStructList *blist; if(daVarLookup("group.test.all",&varg)==S_SUCCESS) { printf("All Test group blocks:\n"); blist = ((thGroupOpaque *)varg.opaque)->blocklist; while(blist) { printf(" %s\n",blist->varp->name); blist = blist->next; } } if(daVarLookup("group.hist.all",&varg)==S_SUCCESS) { printf("All Histogram group blocks:\n"); blist = ((thGroupOpaque *)varg.opaque)->blocklist; while(blist) { printf(" %s\n",blist->varp->name); blist = blist->next; } } if(daVarLookup("group.parm.all",&varg)==S_SUCCESS) { printf("All Parameter group blocks:\n"); blist = ((thGroupOpaque *)varg.opaque)->blocklist; while(blist) { printf(" %s\n",blist->varp->name); blist = blist->next; } } } #endif return(S_SUCCESS); }