Home
last modified time | relevance | path

Searched refs:toybuf (Results 1 – 25 of 129) sorted by relevance

123456

/external/toybox/toys/pending/
Dcrontab.c126 snprintf(toybuf, sizeof(toybuf), "'%d': premature EOF\n", lno); in parse_crontab()
146 snprintf(toybuf, sizeof(toybuf), "'%d': %s\n", lno, line); in parse_crontab()
157 snprintf(toybuf, sizeof(toybuf), "'%d': %s\n", lno, line); in parse_crontab()
163 snprintf(toybuf, sizeof(toybuf), "'%d': %s\n", lno, line); in parse_crontab()
171 snprintf(toybuf, sizeof(toybuf), "'%d': %s\n", lno, line); in parse_crontab()
177 snprintf(toybuf, sizeof(toybuf), "'%d': bad minute\n", lno); in parse_crontab()
181 snprintf(toybuf, sizeof(toybuf), "'%d': bad hour\n", lno); in parse_crontab()
185 snprintf(toybuf, sizeof(toybuf), "'%d': bad day-of-month\n", lno); in parse_crontab()
189 snprintf(toybuf, sizeof(toybuf), "'%d': bad month\n", lno); in parse_crontab()
193 snprintf(toybuf, sizeof(toybuf), "'%d': bad day-of-week\n", lno); in parse_crontab()
[all …]
Dbootchartd.c86 if ((len = readall(fd, toybuf, sizeof(toybuf)-1)) < 0) { in dump_proc_data()
90 toybuf[len] = '\0'; in dump_proc_data()
92 fputs(toybuf, fp); in dump_proc_data()
94 if ((ptr = strchr(toybuf, '('))) { in dump_proc_data()
133 sscanf(ptr, "%s", toybuf); // string will come with double quotes. in parse_config_file()
134 if (!(strncmp(toybuf+1, "on", strlen("on"))) || in parse_config_file()
135 !(strncmp(toybuf+1, "yes", strlen("yes")))) TT.proc_accounting = 1; in parse_config_file()
222 memset(toybuf, 0, sizeof(toybuf)); in stop_logging()
223 strftime(toybuf, sizeof(toybuf), "%a %b %e %H:%M:%S %Z %Y", &st); in stop_logging()
225 fprintf(hdr_fp, "title = Boot chart for %s (%s)\n", host_name, toybuf); in stop_logging()
[all …]
Dlast.c78 toybuf[0] = toybuf[18] = toybuf[28] = '\0'; in seize_duration()
79 strncpy(toybuf, ctime(&tm0), 16); // Login Time. in seize_duration()
80 snprintf(toybuf+18, 8, "- %s", ctime(&tm1) + 11); // Logout Time. in seize_duration()
84 sprintf(toybuf+28, "(%u+%02u:%02u)", days, hours, mins); // Duration. in seize_duration()
138 toybuf, toybuf+18, toybuf+28); in last_main()
149 toybuf, toybuf+18, toybuf+28); in last_main()
161 strcpy(toybuf+18, " still"); in last_main()
162 strcpy(toybuf+28, "logged in"); in last_main()
165 strcpy(toybuf+18, "- down "); in last_main()
168 strcpy(toybuf+18, "- crash"); in last_main()
[all …]
Dwget.c111 strcat(toybuf, name); in mk_fld()
112 strcat(toybuf, ": "); in mk_fld()
113 strcat(toybuf, value); in mk_fld()
114 strcat(toybuf, "\r\n"); in mk_fld()
122 if (!strncmp(toybuf+i, "\r\n\r\n", 4)) break; in get_body()
125 return toybuf+i+4; in get_body()
146 sprintf(toybuf, "GET %s HTTP/1.1\r\n", path); in wget_main()
152 strcat(toybuf, "\r\n"); in wget_main()
155 len = strlen(toybuf); in wget_main()
156 if (write(sock, toybuf, len) != len) perror_exit("write error"); in wget_main()
[all …]
Dmdev.c53 len = read(fd, toybuf, 64); in make_device()
56 toybuf[len] = 0; in make_device()
61 sscanf(toybuf, "%u:%u", &major, &minor); in make_device()
226 sprintf(toybuf, "/dev/%s", custom_name); in make_device()
229 dir = opendir(toybuf); in make_device()
231 else mkdir(toybuf, 0755); in make_device()
235 sprintf(toybuf, "/dev/%s", device_name); in make_device()
238 unlink(toybuf); in make_device()
242 if (strchr(device_name, '/')) mkpath(toybuf); in make_device()
243 if (mknod(toybuf, mode | type, dev_makedev(major, minor)) && in make_device()
[all …]
Dlsof.c94 snprintf(toybuf, sizeof(toybuf), "/proc/%d/fdinfo/%s", fi->pi.pid, fi->fd); in fill_flags()
95 fp = fopen(toybuf, "r"); in fill_flags()
312 snprintf(toybuf, sizeof(toybuf), "/proc/%d/%s", pi->pid, path); in visit_symlink()
316 snprintf(toybuf, sizeof(toybuf), "/proc/%d/fd/%s", pi->pid, path); in visit_symlink()
320 fill_stat(fi, toybuf); in visit_symlink()
322 fi->name = xreadlink(toybuf); in visit_symlink()
324 fi->name = xmprintf("%s (readlink: %s)", toybuf, strerror(errno)); in visit_symlink()
338 snprintf(toybuf, sizeof(toybuf), "/proc/%d/maps", pi->pid); in visit_maps()
339 fp = fopen(toybuf, "r"); in visit_maps()
368 snprintf(toybuf, sizeof(toybuf), "/proc/%d/fd", pi->pid); in visit_fds()
[all …]
/external/toybox/toys/posix/
Dcpio.c115 if (!(size =readall(afd, toybuf, 110))) break; in cpio_main()
116 if (size != 110 || memcmp(toybuf, "070701", 6)) error_exit("bad header"); in cpio_main()
117 tofree = name = strpad(afd, x8u(toybuf+94), 110); in cpio_main()
127 size = x8u(toybuf+54); in cpio_main()
128 mode = x8u(toybuf+14); in cpio_main()
129 uid = x8u(toybuf+22); in cpio_main()
130 gid = x8u(toybuf+30); in cpio_main()
131 timestamp = x8u(toybuf+46); // unsigned 32 bit, so year 2100 problem in cpio_main()
162 data = toybuf; in cpio_main()
164 if (size < sizeof(toybuf)) data = strpad(afd, size, 0); in cpio_main()
[all …]
Dkill.c113 snprintf(toybuf, sizeof(toybuf), "/proc/%d/stat", procpid);
114 if (!readfile(toybuf, toybuf, sizeof(toybuf))) continue;
115 if (sscanf(toybuf, "%*d %*s %*c %*d %*d %d", &procsid) != 1) continue;
119 snprintf(toybuf, sizeof(toybuf), "/proc/%d/cmdline", procpid);
120 if (!readfile(toybuf, toybuf, sizeof(toybuf)) || !*toybuf) continue;
Dfile.c34 int endian = toybuf[5], bits = toybuf[4], i, j, dynamic = 0, stripped = 1,
59 i = elf_int(toybuf+16, 2);
65 if (elf_int(toybuf+36+12*(bits==2), 4) & 0x8000) printf(" (fdpic)");
85 j = elf_int(toybuf+18, 2);
104 phentsize = elf_int(toybuf+42+12*bits, 2);
105 phnum = elf_int(toybuf+44+12*bits, 2);
106 phoff = elf_int(toybuf+28+4*bits, 4+4*bits);
107 shsize = elf_int(toybuf+46+12*bits, 2);
108 shnum = elf_int(toybuf+48+12*bits, 2);
109 shoff = elf_int(toybuf+32+8*bits, 4+4*bits);
[all …]
Dstrings.c54 nread = read(fd, toybuf, sizeof(toybuf));
64 if ((toybuf[i]>=32 && toybuf[i]<=126) || toybuf[i]=='\t') {
65 if (count == wlen) fputc(toybuf[i], stdout);
67 string[count++] = toybuf[i];
Dps.c411 if (strcmp(typos[toybuf[i]].name, typos[toybuf[i+1]].name)>0) { in help_fields()
412 k = toybuf[i]; in help_fields()
413 toybuf[i] = toybuf[i+1]; in help_fields()
414 toybuf[i+1] = k; in help_fields()
422 t = (void *)(typos+toybuf[i]); in help_fields()
446 for (i = 0; i<jump; i++) toybuf[i] = PS_COMM+i; in help_help()
452 for (i = 0; i<ARRAY_LEN(typos)-jump; i++) toybuf[i] = i+(i>=PS_COMM)*jump; in help_help()
504 char *buf = toybuf+sizeof(toybuf)-260, *out = buf, *s; in string_field()
705 struct procpid *tb = (void *)toybuf; in get_ps()
758 len = sizeof(toybuf)-(buf-toybuf); in get_ps()
[all …]
/external/toybox/toys/other/
Dlogin.c58 if (gethostname(toybuf, sizeof(toybuf)-1)) *toybuf = 0; in login_main()
59 printf("%s%slogin: ", *toybuf ? toybuf : "", *toybuf ? " " : ""); in login_main()
62 if(!fgets(toybuf, sizeof(toybuf)-1, stdin)) xexit(); in login_main()
65 for (ss = toybuf; *ss; ss++) if (*ss<=' ' || *ss==':') break; in login_main()
67 if (!*(username = toybuf)) { in login_main()
87 if (!read_password(toybuf, sizeof(toybuf), "Password: ")) { in login_main()
88 int x = pass && (ss = crypt(toybuf, pass)) && !strcmp(pass, ss); in login_main()
91 memset(toybuf, 0, sizeof(toybuf)); in login_main()
111 ss = readfile("/etc/nologin", toybuf, sizeof(toybuf)); in login_main()
Ddos2unix.c44 len = read(fd, toybuf+(sizeof(toybuf)/2), sizeof(toybuf)/2);
49 char x = toybuf[in+sizeof(toybuf)/2];
53 if (c == 'u' || x != '\n') toybuf[out++] = '\r';
56 } else if (c == 'u' && x == '\n') toybuf[out++] = '\r';
59 else toybuf[out++] = x;
61 xwrite(outfd, toybuf, out);
Dpmap.c39 snprintf(toybuf, sizeof(toybuf), "/proc/%u/cmdline", pid); in pmap_main()
40 line = readfile(toybuf, 0, 0); in pmap_main()
47 sprintf(toybuf, "/proc/%u/%smaps", pid, in pmap_main()
49 if (!(fp = fopen(toybuf, "r"))) { in pmap_main()
65 &start, &end, toybuf, &off); in pmap_main()
69 if (toybuf[3] == 'p') toybuf[3] = '-'; in pmap_main()
92 xprintf("%s- %s%s", toybuf, line[off]=='[' ? " " : "", name); in pmap_main()
102 memset(toybuf, '-', 16); in pmap_main()
104 toybuf); in pmap_main()
Dmkpasswd.c64 if (read_password(toybuf, sizeof(toybuf), "Password: ")) in mkpasswd_main()
67 for (i = 0; i<sizeof(toybuf)-1; i++) { in mkpasswd_main()
68 if (!xread(0, toybuf+i, 1)) break; in mkpasswd_main()
69 if (toybuf[i] == '\n' || toybuf[i] == '\r') break; in mkpasswd_main()
71 toybuf[i] = 0; in mkpasswd_main()
76 xprintf("%s\n",crypt(*toys.optargs ? *toys.optargs : toybuf, salt)); in mkpasswd_main()
Dlsusb.c27 sprintf(toybuf, "%s/uevent", name); in list_device()
28 file = fopen(toybuf, "r"); in list_device()
32 while (fgets(toybuf, sizeof(toybuf), file)) in list_device()
33 if (sscanf(toybuf, "BUSNUM=%u\n", &busnum) in list_device()
34 || sscanf(toybuf, "DEVNUM=%u\n", &devnum) in list_device()
35 || sscanf(toybuf, "PRODUCT=%x/%x/", &pid, &vid)) count++; in list_device()
Dblkid.c79 len = readall(fd, toybuf, sizeof(toybuf)); in do_blkid()
80 if (len != sizeof(toybuf)) return; in do_blkid()
87 if (fstypes[i].magic_offset > off+sizeof(toybuf)) { in do_blkid()
96 test += ((uint64_t)toybuf[j+fstypes[i].magic_offset-off])<<(8*j); in do_blkid()
111 if (toybuf[1116]&4) type = "ext3"; in do_blkid()
112 if (toybuf[1120]&64) type = "ext4"; in do_blkid()
128 s = toybuf+fstypes[i].label_off-off; in do_blkid()
148 s += sprintf(s, "-%02x"+!(bits & (1<<j)), toybuf[uoff+j]); in do_blkid()
164 char *name = toybuf, *buffer = toybuf+1024, device[32]; in blkid_main()
Dtaskset.c48 unsigned long *mask = (unsigned long *)toybuf; in do_taskset()
54 int j = sizeof(toybuf), flag = 0; in do_taskset()
56 if (-1 == sched_getaffinity(pid, sizeof(toybuf), (void *)mask)) in do_taskset()
75 memset(toybuf, 0, sizeof(toybuf)); in do_taskset()
86 if (-1 == sched_setaffinity(pid, sizeof(toybuf), (void *)mask)) in do_taskset()
124 if (!toys.optflags && -1!=sched_getaffinity(getpid(), 4096, toybuf)) { in nproc_main()
126 if (toybuf[i]) for (j=0; j<8; j++) if (toybuf[i]&(1<<j)) nproc++; in nproc_main()
Dacpi.c57 len = readall(fd, toybuf, sizeof(toybuf)); in acpi_callback()
61 if (!strncmp(toybuf, "Battery", 7)) { in acpi_callback()
113 memset(toybuf, 0, sizeof(toybuf)); in cool_callback()
121 if (readfile(TT.cpath, toybuf, 256) && !errno) { in cool_callback()
122 toybuf[strlen(toybuf) -1] = 0; in cool_callback()
126 printf("Cooling %d: %s no state information\n", TT.cool++, toybuf); in cool_callback()
127 else printf("Cooling %d: %s %d of %d\n", TT.cool++, toybuf, cur, max); in cool_callback()
Dlspci.c42 char *p = toybuf, *vendor = toybuf+9, *device = toybuf+18,
58 int fd, size = 6 + 2*((toys.optflags & FLAG_e) && p == toybuf);
83 if (!fgets(s, sizeof(toybuf)-(p-toybuf)-1, TT.db)) break;
101 new->name+5, toybuf, vbig ? vbig : "", vendor,
109 : "%s Class %s: %s:%s", new->name+5, toybuf,
/external/toybox/toys/net/
Dnetstat.c118 if(!fgets(toybuf, sizeof(toybuf), fp)) return; //skip header. in show_ip()
120 while (fgets(toybuf, sizeof(toybuf), fp)) { in show_ip()
130 nitems = sscanf(toybuf, in show_ip()
138 nitems = sscanf(toybuf, in show_ip()
167 snprintf(toybuf, sizeof(toybuf), "%s", pw->pw_name); in show_ip()
168 else snprintf(toybuf, sizeof(toybuf), "%d", uid); in show_ip()
173 if ((toys.optflags & FLAG_e)) printf(" %-10s %-11ld", toybuf, inode); in show_ip()
192 if(!fgets(toybuf, sizeof(toybuf), fp)) return; //skip header. in show_unix_sockets()
194 while (fgets(toybuf, sizeof(toybuf), fp)) { in show_unix_sockets()
198 if (6<sscanf(toybuf, "%*p: %lX %*X %lX %lX %lX %lu %n", in show_unix_sockets()
[all …]
Dsntp.c73 unsigned long long *pktime = (void *)toybuf, now, then, before = before; in sntp_main()
119 memset(toybuf, 0, 48); in sntp_main()
120 *toybuf = 0xe3; // li = 3 (unsynchronized), version = 4, mode = 3 (client) in sntp_main()
121 toybuf[2] = 8; // poll frequency 1<<8 = 256 seconds in sntp_main()
123 xsendto(fd, toybuf, 48, ai->ai_addr); in sntp_main()
133 strike = xrecvwait(fd, toybuf, sizeof(toybuf), &sa, then-now); in sntp_main()
144 int mode = 7&*toybuf; in sntp_main()
159 char *buf = toybuf+48; in sntp_main()
216 format_iso_time(toybuf, sizeof(toybuf)-1, &tv2); in sntp_main()
217 printf("%s offset %c%lld.%09lld secs\n", toybuf, (diff<0) ? '-' : '+', in sntp_main()
/external/toybox/toys/lsb/
Dhostname.c46 if (gethostname(toybuf, sizeof(toybuf)-1) || !*toybuf)
57 if (gethostname(toybuf, sizeof(toybuf)-1)) perror_exit("gethostname");
60 if (!(h = gethostbyname(toybuf))) perror_exit("gethostbyname");
61 snprintf(toybuf, sizeof(toybuf), "%s", h->h_name);
63 dot = strchr(toybuf, '.');
65 xputs(FLAG(d) ? dot+1 : toybuf);
Dmd5sum.c277 i = read(fd, toybuf, sizeof(toybuf)); in do_lib_hash()
279 hash->update(&ctx, toybuf, i); in do_lib_hash()
281 hash->final(toybuf+128, &ctx); in do_lib_hash()
284 sprintf(toybuf+2*i, "%02x", toybuf[i+128]); in do_lib_hash()
306 i = read(fd, toybuf, sizeof(toybuf)); in do_builtin_hash()
308 hash_update(toybuf, i, transform); in do_builtin_hash()
330 sprintf(toybuf+2*i, "%02x", 255&(TT.state[i>>2] >> ((3-(i & 3)) * 8))); in do_builtin_hash()
331 else for (i=0; i<4; i++) sprintf(toybuf+8*i, "%08x", bswap_32(TT.state[i])); in do_builtin_hash()
335 i = strlen(toybuf)+1; in do_builtin_hash()
336 memset(toybuf+i, 0, sizeof(toybuf)-i); in do_builtin_hash()
[all …]
Dpasswd.c93 if (read_password(toybuf+2048, 2048, "Old password:")) return; in passwd_main()
94 pass = crypt(toybuf+2048, pw->pw_passwd); in passwd_main()
98 if (read_password(toybuf, 2048, "New password:")) return; in passwd_main()
100 if (CFG_PASSWD_SAD) weak_check(toybuf, toybuf+2048, name); in passwd_main()
101 if (read_password(toybuf+2048, 2048, "Retype password:")) return; in passwd_main()
102 if (strcmp(toybuf, toybuf+2048)) error_exit("Passwords do not match."); in passwd_main()
104 encrypted = crypt(toybuf, salt); in passwd_main()

123456