Changeset 1214 in kBuild for trunk/src/kash
- Timestamp:
- Oct 7, 2007 8:39:58 PM (17 years ago)
- Location:
- trunk/src/kash
- Files:
-
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/Makefile.kmk
r1212 r1214 54 54 miscbltin.c \ 55 55 bltin/echo.c \ 56 bltin/kill.c \ 56 57 bltin/test.c \ 57 58 \ 58 bltin/kill.c \59 59 $(PATH_TARGET)/arith.c \ 60 60 $(PATH_TARGET)/arith_lex.c \ -
trunk/src/kash/alias.c
r1198 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: alias.c,v 1.12 2003/08/07 09:05:29 agc Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <stdlib.h> -
trunk/src/kash/bltin/kill.c
r1213 r1214 30 30 */ 31 31 32 #ifdef HAVE_SYS_CDEFS_H 33 #include <sys/cdefs.h> 34 #endif 32 #if 0 35 33 #if !defined(lint) && !defined(SHELL) 36 34 __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\ 37 35 The Regents of the University of California. All rights reserved.\n"); 38 36 #endif /* not lint */ 39 40 37 #ifndef lint 41 #if 042 38 static char sccsid[] = "@(#)kill.c 8.4 (Berkeley) 4/28/95"; 43 39 #else 44 40 __RCSID("$NetBSD: kill.c,v 1.23 2003/08/07 09:05:13 agc Exp $"); 41 #endif /* not lint */ 45 42 #endif 46 #endif /* not lint */47 43 48 44 #include <ctype.h> … … 51 47 #include <stdlib.h> 52 48 #include <string.h> 49 #include "shtypes.h" 53 50 #include "jobs.h" 54 51 #include "error.h" -
trunk/src/kash/bltin/test.c
r1206 r1214 11 11 */ 12 12 13 #ifdef HAVE_SYS_CDEFS_H 14 #include <sys/cdefs.h> 15 #endif 13 #if 0 16 14 #ifndef lint 17 15 __RCSID("$NetBSD: test.c,v 1.26 2005/02/10 06:56:55 simonb Exp $"); 18 16 #endif 17 #endif 19 18 20 19 #include <sys/types.h> 21 22 20 #include <ctype.h> 23 21 #include <errno.h> -
trunk/src/kash/cd.c
r1199 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)cd.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: cd.c,v 1.34 2003/11/14 20:00:28 dsl Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <sys/types.h> 47 #include <sys/stat.h>48 44 #include <stdlib.h> 49 45 #include <string.h> 50 #include <unistd.h>51 46 #include <errno.h> 52 47 -
trunk/src/kash/error.c
r1208 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)error.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: error.c,v 1.31 2003/08/07 09:05:30 agc Exp $"); 43 #endif44 40 #endif /* not lint */ 41 #endif 45 42 46 43 /* … … 48 45 */ 49 46 50 #include <signal.h>51 47 #include <stdlib.h> 52 #include <unistd.h>53 48 #include <errno.h> 54 49 #include <stdio.h> -
trunk/src/kash/error.h
r1213 r1214 93 93 #define int_pending() psh->intpending 94 94 95 #if !defined(__GNUC__) && !defined(__attribute__) 96 # define __attribute__(a) 97 #endif 98 95 99 void exraise(struct shinstance *, int) __attribute__((__noreturn__)); 96 100 void onint(struct shinstance *); -
trunk/src/kash/eval.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; 41 38 #else 42 39 __RCSID("$NetBSD: eval.c,v 1.84 2005/06/23 23:05:29 christos Exp $"); 43 #endif44 40 #endif /* not lint */ 41 #endif 45 42 46 43 #include <stdlib.h> 47 #include <signal.h>48 44 #include <stdio.h> 49 #include <unistd.h>50 #include <sys/fcntl.h>51 #include <sys/times.h>52 #include <sys/param.h>53 45 #include <sys/types.h> 54 #include <sys/wait.h>55 46 #ifdef HAVE_SYSCTL_H 56 # include <sys/sysctl.h>57 #endif 58 #ifdef _ _sun__59 # include <iso/limits_iso.h>47 # include <sys/sysctl.h> 48 #endif 49 #ifdef _MSC_VER 50 # include "getopt.h" 60 51 #endif 61 52 … … 85 76 #include "main.h" 86 77 #ifndef SMALL 87 # include "myhistedit.h"78 # include "myhistedit.h" 88 79 #endif 89 80 #include "shinstance.h" … … 169 160 evalcmd(shinstance *psh, int argc, char **argv) 170 161 { 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 162 char *p; 163 char *concat; 164 char **ap; 165 166 if (argc > 1) { 167 p = argv[1]; 168 if (argc > 2) { 169 STARTSTACKSTR(psh, concat); 170 ap = argv + 2; 171 for (;;) { 172 while (*p) 173 STPUTC(psh, *p++, concat); 174 if ((p = *ap++) == NULL) 175 break; 176 STPUTC(psh, ' ', concat); 177 } 178 STPUTC(psh, '\0', concat); 179 p = grabstackstr(psh, concat); 180 } 181 evalstring(psh, p, EV_TESTED); 182 } 183 return psh->exitstatus; 193 184 } 194 185 … … 637 628 return sys_path; 638 629 #else 639 630 return def_path; 640 631 #endif 641 632 } … … 1236 1227 1237 1228 mins = ticks / tpm; 1229 #ifdef _MSC_VER 1230 { 1231 char tmp[64]; 1232 sprintf(tmp, "%.4f", (ticks - mins * tpm) * 60.0 / tpm); 1233 strlcpy(seconds, tmp, l); 1234 } 1235 #else 1238 1236 snprintf(seconds, l, "%.4f", (ticks - mins * tpm) * 60.0 / tpm ); 1237 #endif 1239 1238 1240 1239 if (seconds[0] == '6' && seconds[1] == '0') { -
trunk/src/kash/exec.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; 41 38 #else 42 39 __RCSID("$NetBSD: exec.c,v 1.37 2003/08/07 09:05:31 agc Exp $"); 43 #endif44 40 #endif /* not lint */ 41 #endif 45 42 46 43 #include <sys/types.h> 47 #include <sys/stat.h>48 #include <sys/wait.h>49 #include <unistd.h>50 #include <fcntl.h>51 44 #include <errno.h> 52 45 #include <stdio.h> … … 85 78 #include <InnoTekLIBC/backend.h> 86 79 #endif 87 88 80 #include "shinstance.h" 89 81 … … 199 191 stat_pc_exec_exts(psh, cmd, &st, 0); 200 192 #endif 201 #if defined __INNOTEK_LIBC__ && defined EXEC_HASH_BANG_SCRIPT193 #if defined(__INNOTEK_LIBC__) && defined(EXEC_HASH_BANG_SCRIPT) 202 194 __libc_Back_gfProcessHandleHashBangScripts = 0; 203 195 #endif -
trunk/src/kash/expand.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; 41 38 #else 42 39 __RCSID("$NetBSD: expand.c,v 1.71 2005/06/01 15:41:19 lukem Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <sys/types.h> 47 44 #include <sys/time.h> 48 #include <sys/stat.h>49 45 #include <errno.h> 50 #include <dirent.h>51 #include <unistd.h>52 #include <pwd.h>53 46 #include <stdlib.h> 54 47 #include <stdio.h> 55 #ifdef __sun__56 #include <iso/limits_iso.h>57 #endif58 48 59 49 /* … … 267 257 { 268 258 char c, *startp = p; 269 struct passwd *pw;270 259 const char *home; 271 260 int quotes = flag & (EXP_FULL | EXP_CASE); … … 292 281 goto lose; 293 282 } else { 294 if (( pw = getpwnam(startp+1)) == NULL)283 if ((home = sh_gethomedir(psh, startp+1)) == NULL) 295 284 goto lose; 296 home = pw->pw_dir;297 285 } 298 286 if (*home == '\0') … … 1140 1128 int metaflag; 1141 1129 struct stat statb; 1142 DIR*dirp;1143 s tructdirent *dp;1130 shdir *dirp; 1131 shdirent *dp; 1144 1132 int atend; 1145 1133 int matchdot; … … 1215 1203 enddir[-1] = '\0'; 1216 1204 } 1217 if ((dirp = opendir(cp)) == NULL)1205 if ((dirp = shfile_opendir(&psh->fdtab, cp)) == NULL) 1218 1206 return; 1219 1207 if (enddir != psh->expdir) … … 1233 1221 if (*p == '.') 1234 1222 matchdot++; 1235 while (! int_pending() && (dp = readdir(dirp)) != NULL) {1236 if (dp-> d_name[0] == '.' && ! matchdot)1223 while (! int_pending() && (dp = shfile_readdir(dirp)) != NULL) { 1224 if (dp->name[0] == '.' && ! matchdot) 1237 1225 continue; 1238 if (patmatch(psh, start, dp-> d_name, 0)) {1226 if (patmatch(psh, start, dp->name, 0)) { 1239 1227 if (atend) { 1240 scopy(dp-> d_name, enddir);1228 scopy(dp->name, enddir); 1241 1229 addfname(psh, psh->expdir); 1242 1230 } else { 1243 for (p = enddir, cp = dp-> d_name;1231 for (p = enddir, cp = dp->name; 1244 1232 (*p++ = *cp++) != '\0';) 1245 1233 continue; … … 1249 1237 } 1250 1238 } 1251 closedir(dirp);1239 shfile_closedir(dirp); 1252 1240 if (! atend) 1253 1241 endname[-1] = '/'; -
trunk/src/kash/generated/nodes.h
r631 r1214 2 2 * This file was generated by mknodes.sh 3 3 */ 4 5 #ifndef ___nodes_h 6 #define ___nodes_h 4 7 5 8 #define NSEMI 0 … … 158 161 union node *copyfunc(union node *); 159 162 void freefunc(union node *); 163 164 #endif -
trunk/src/kash/histedit.c
r1209 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: histedit.c,v 1.36 2005/05/09 11:35:19 christos Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */ 45 46 #include <sys/param.h> 47 #ifndef __sun__ 48 #include <paths.h> 49 #endif 42 50 43 #include <stdio.h> 51 44 #include <stdlib.h> 52 #include <unistd.h> 45 53 46 /* 54 47 * Editline and history functions (and glue). … … 63 56 #include "myhistedit.h" 64 57 #include "error.h" 58 65 59 #ifndef SMALL 66 60 #include "eval.h" … … 535 529 return (he.num); 536 530 } 537 #else 531 #else /* SMALL */ 538 532 int 539 533 histcmd(shinstance *psh, int argc, char **argv) … … 550 544 return -1; 551 545 } 552 #endif 546 #endif /* SMALL */ -
trunk/src/kash/input.c
r1210 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95"; 41 38 #else 42 39 __RCSID("$NetBSD: input.c,v 1.39 2003/08/07 09:05:32 agc Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <stdio.h> /* defines BUFSIZ */ 47 #include <fcntl.h>48 44 #include <errno.h> 49 #include <unistd.h>50 45 #include <stdlib.h> 51 46 #include <string.h> 52 #ifdef __sun__53 #include <iso/limits_iso.h>54 #endif55 47 56 48 /* -
trunk/src/kash/jobs.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #else 38 #define _PATH_DEVNULL "/dev/null" 39 #endif 35 #if 0 40 36 #ifndef lint 41 #if 042 37 static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; 43 38 #else 44 39 __RCSID("$NetBSD: jobs.c,v 1.63 2005/06/01 15:41:19 lukem Exp $"); 45 #endif46 40 #endif /* not lint */ 41 #endif 47 42 48 43 #include <fcntl.h> 49 #ifdef __sun__50 # define sys_siglist _sys_siglist51 #endif52 #include <signal.h>53 44 #include <errno.h> 54 #include <unistd.h>55 45 #include <stdlib.h> 56 #ifndef __sun__57 # include <paths.h>58 #endif59 46 #include <sys/types.h> 60 #include <sys/param.h>61 #if defined(BSD) || defined(__sun__)62 # include <sys/wait.h>63 # include <sys/time.h>64 # include <sys/resource.h>65 #endif66 #include <sys/ioctl.h>67 47 68 48 #include "shell.h" … … 815 795 816 796 TRACE((psh, "forkshell(%%%d, %p, %d) called\n", jp - psh->jobtab, n, mode)); 817 switch ((pid = fork())) {797 switch ((pid = sh_fork(psh))) { 818 798 case -1: 819 799 TRACE((psh, "Fork failed, errno=%d\n", errno)); -
trunk/src/kash/mail.c
r1198 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)mail.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: mail.c,v 1.16 2003/08/07 09:05:33 agc Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 /* … … 48 45 */ 49 46 #include <sys/types.h> 50 #include <sys/stat.h>51 47 #include <stdlib.h> 52 48 -
trunk/src/kash/main.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 37 __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ … … 42 40 43 41 #ifndef lint 44 #if 045 42 static char sccsid[] = "@(#)main.c 8.7 (Berkeley) 7/19/95"; 46 43 #else 47 44 __RCSID("$NetBSD: main.c,v 1.48 2003/09/14 12:09:29 jmmv Exp $"); 48 #endif49 45 #endif /* not lint */ 46 47 #endif 50 48 51 49 #include <errno.h> 52 50 #include <stdio.h> 53 #include <signal.h>54 51 #include <sys/stat.h> 55 #include <unistd.h>56 52 #include <locale.h> 57 #include <fcntl.h>58 53 59 54 … … 122 117 /* 123 118 * Check for --version and --help. 124 119 */ 125 120 if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '-') { 126 121 if (!strcmp(argv[1], "--help")) -
trunk/src/kash/memalloc.c
r1198 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: memalloc.c,v 1.28 2003/08/07 09:05:34 agc Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <stdlib.h> 47 #include <unistd.h>48 44 49 45 #include "shell.h" … … 53 49 #include "machdep.h" 54 50 #include "mystring.h" 51 #include "shinstance.h" 55 52 56 53 /* -
trunk/src/kash/miscbltin.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: miscbltin.c,v 1.35 2005/03/19 14:22:50 dsl Exp $"); 43 #endif44 40 #endif /* not lint */ 41 #endif 45 42 46 43 /* … … 49 46 50 47 #include <sys/types.h> 51 #include <sys/stat.h>52 #include <sys/time.h>53 #include <sys/resource.h>54 #include <unistd.h>55 48 #include <stdlib.h> 56 49 #include <ctype.h> 57 50 #include <errno.h> 58 #ifndef _MSC_VER59 # include "mscfakes.h"60 #endif61 51 62 52 #include "shell.h" … … 68 58 #include "miscbltin.h" 69 59 #include "mystring.h" 60 #include "shinstance.h" 70 61 71 62 #undef rflag … … 359 350 { 360 351 int c; 361 rlim_t val = 0;352 shrlim_t val = 0; 362 353 enum { SOFT = 0x1, HARD = 0x2 } 363 354 how = SOFT | HARD; … … 365 356 int set, all = 0; 366 357 int optc, what; 367 s tructrlimit limit;358 shrlimit limit; 368 359 369 360 what = 'f'; … … 397 388 val = RLIM_INFINITY; 398 389 else { 399 val = ( rlim_t) 0;390 val = (shrlim_t) 0; 400 391 401 392 while ((c = *p++) >= '0' && c <= '9') 402 393 { 403 394 val = (val * 10) + (long)(c - '0'); 404 if (val < ( rlim_t) 0)395 if (val < (shrlim_t) 0) 405 396 break; 406 397 } … … 412 403 if (all) { 413 404 for (l = limits; l->name; l++) { 414 getrlimit(l->cmd, &limit);405 sh_getrlimit(psh, l->cmd, &limit); 415 406 if (how & SOFT) 416 407 val = limit.rlim_cur; … … 430 421 } 431 422 432 getrlimit(l->cmd, &limit);423 sh_getrlimit(psh, l->cmd, &limit); 433 424 if (set) { 434 425 if (how & HARD) … … 436 427 if (how & SOFT) 437 428 limit.rlim_cur = val; 438 if (s etrlimit(l->cmd, &limit) < 0)429 if (sh_setrlimit(psh, l->cmd, &limit) < 0) 439 430 error(psh, "error setting limit (%s)", strerror(errno)); 440 431 } else { -
trunk/src/kash/mystring.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: mystring.c,v 1.16 2003/08/07 09:05:35 agc Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 /* -
trunk/src/kash/mystring.h
r1207 r1214 35 35 */ 36 36 37 #ifndef ___mystring_h 38 #define ___mystring_h 39 37 40 #include <string.h> 38 #include "sh instance.h"41 #include "shtypes.h" /* ssize_t */ 39 42 40 43 void scopyn(const char *, char *, ssize_t); 41 44 int prefix(const char *, const char *); 42 int number(s hinstance *, const char *);45 int number(struct shinstance *, const char *); 43 46 int is_number(const char *); 47 #ifdef _MSC_VER 48 size_t strlcpy(char *dst, const char *src, size_t siz); 49 #endif 44 50 45 51 #define equal(s1, s2) (strcmp(s1, s2) == 0) 46 52 #define scopy(s1, s2) ((void)strcpy(s2, s1)) 53 54 #endif -
trunk/src/kash/options.c
r1199 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: options.c,v 1.38 2005/03/20 21:38:17 dsl Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */ 45 46 #include <signal.h> 47 #include <unistd.h> 42 48 43 #include <stdlib.h> 49 44 … … 63 58 #include "mystring.h" 64 59 #ifndef SMALL 65 # include "myhistedit.h"60 # include "myhistedit.h" 66 61 #endif 67 62 #include "show.h" -
trunk/src/kash/options.h
r1198 r1214 64 64 65 65 #ifdef DEFINE_OPTIONS 66 # define DEF_OPTS(name, letter, opt_set) {name, letter, opt_set, 0},66 # define DEF_OPTS(name, letter, opt_set) {name, letter, opt_set, 0}, 67 67 const struct optent ro_optlist[NOPTS] = { 68 68 #else 69 # define DEF_OPTS(name, letter, opt_set)69 # define DEF_OPTS(name, letter, opt_set) 70 70 #endif 71 71 #define DEF_OPT(name,letter) DEF_OPTS(name, letter, 0) -
trunk/src/kash/output.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: output.c,v 1.28 2003/08/07 09:05:36 agc Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 /* … … 55 52 */ 56 53 57 #include <sys/types.h> /* quad_t */ 58 #include <sys/param.h> /* BSD4_4 */ 59 #include <sys/ioctl.h> 54 #include <sys/types.h> 60 55 61 56 #include <stdio.h> /* defines BUFSIZ */ 62 57 #include <string.h> 63 58 #include <errno.h> 64 #include <unistd.h>65 59 #include <stdlib.h> 66 60 … … 70 64 #include "memalloc.h" 71 65 #include "error.h" 72 73 66 #include "shinstance.h" 74 67 … … 276 269 */ 277 270 278 #define TEMPSIZE 24271 #define TEMPSIZE 32 279 272 280 273 #ifdef BSD4_4 … … 285 278 doformat(struct output *dest, const char *f, va_list ap) 286 279 { 287 #if 280 #ifdef HAVE_VASPRINTF 288 281 char *s; 289 282 … … 292 285 free(s); 293 286 #else /* !HAVE_VASPRINTF */ 294 static const char digit[] = "0123456789ABCDEF"; 287 static const char digit_lower[] = "0123456789abcdef"; 288 static const char digit_upper[] = "0123456789ABCDEF"; 289 const char *digit; 295 290 char c; 296 291 char temp[TEMPSIZE]; … … 303 298 char *p; 304 299 int sign; 305 #ifdef BSD4_4 306 quad_t l; 307 u_quad_t num; 308 #else 309 long l; 310 unsigned long num; 311 #endif 300 int64_t l; 301 uint64_t num; 312 302 unsigned base; 313 303 int len; … … 365 355 f++; 366 356 } 357 digit = digit_upper; 367 358 switch (*f) { 368 359 case 'd': 369 #ifdef BSD4_4370 360 if (isquad) 371 l = va_arg(ap, quad_t); 372 else 373 #endif 374 if (islong) 361 l = va_arg(ap, int64_t); 362 else if (islong) 375 363 l = va_arg(ap, long); 376 364 else … … 396 384 case 'x': 397 385 /* we don't implement 'x'; treat like 'X' */ 386 digit = digit_lower; 398 387 case 'X': 399 388 base = 16; 400 389 uns_number: /* an unsigned number */ 401 390 sign = 0; 402 #ifdef BSD4_4403 391 if (isquad) 404 num = va_arg(ap, u_quad_t); 405 else 406 #endif 407 if (islong) 392 num = va_arg(ap, uint64_t); 393 else if (islong) 408 394 num = va_arg(ap, unsigned long); 409 395 else … … 505 491 } 506 492 } 507 508 509 #ifdef not_used510 /*511 * Version of ioctl that retries after a signal is caught.512 * XXX unused function513 */514 515 int516 xioctl(shinstance *psh, int fd, unsigned long request, char *arg)517 {518 int i;519 520 while ((i = shfile_ioctl(&psh->fdtab, fd, request, arg)) == -1 && errno == EINTR);521 return i;522 }523 #endif /* not_used */ -
trunk/src/kash/output.h
r1199 r1214 54 54 extern struct output *out1; 55 55 extern struct output *out2;*/ 56 #ifdef _MSC_VER 57 # ifndef __attribute__ 58 # define __attribute__(a) 59 # endif 56 #if !defined(__GNUC__) && !defined(__attribute__) 57 # define __attribute__(a) 60 58 #endif 61 59 -
trunk/src/kash/parser.c
r1210 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; 41 38 #else 42 39 __RCSID("$NetBSD: parser.c,v 1.59 2005/03/21 20:10:29 dsl Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <stdlib.h> 47 #ifdef __sun__48 #include <iso/limits_iso.h>49 #endif50 44 51 45 #include "shell.h" … … 66 60 #include "show.h" 67 61 #ifndef SMALL 68 # include "myhistedit.h"62 # include "myhistedit.h" 69 63 #endif 70 64 #include "shinstance.h" -
trunk/src/kash/parser.h
r1210 r1214 34 34 * @(#)parser.h 8.3 (Berkeley) 5/4/95 35 35 */ 36 37 #ifndef ___parse_h 38 #define ___parse_h 36 39 37 40 /* control characters in argument strings */ … … 81 84 int goodname(const char *); 82 85 const char *getprompt(struct shinstance *, void *); 86 87 #endif -
trunk/src/kash/redir.c
r1212 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: redir.c,v 1.29 2004/07/08 03:57:33 christos Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <sys/types.h> 47 #include <sys/param.h> /* PIPE_BUF */ 48 #include <signal.h> 44 #include <limits.h> /* PIPE_BUF */ 49 45 #include <string.h> 50 #include <fcntl.h>51 46 #include <errno.h> 52 #include <unistd.h>53 47 #include <stdlib.h> 54 48 -
trunk/src/kash/shell.h
r809 r1214 50 50 */ 51 51 52 #ifndef ___shell_h 53 #define ___shell_h 54 52 55 #include <sys/param.h> 53 56 54 57 #define JOBS 1 55 58 #ifndef BSD 56 # define BSD 159 # define BSD 1 57 60 #endif 58 61 59 62 #ifndef DO_SHAREDVFORK 60 # if __NetBSD_Version__ >= 10400000061 # define DO_SHAREDVFORK62 # endif63 # if __NetBSD_Version__ >= 104000000 64 # define DO_SHAREDVFORK 65 # endif 63 66 #endif 64 67 65 68 typedef void *pointer; 66 69 #ifndef NULL 67 # define NULL (void *)070 # define NULL (void *)0 68 71 #endif 69 72 #define STATIC /* empty */ … … 71 74 72 75 #ifdef HAVE_SYS_CDEFS_H 73 # include <sys/cdefs.h>76 # include <sys/cdefs.h> 74 77 #endif 75 78 … … 78 81 79 82 #ifdef DEBUG 80 # define TRACE(param) trace param81 # define TRACEV(param) tracev param83 # define TRACE(param) trace param 84 # define TRACEV(param) tracev param 82 85 #else 83 # define TRACE(param)84 # define TRACEV(param)86 # define TRACE(param) 87 # define TRACEV(param) 85 88 #endif 89 90 #endif -
trunk/src/kash/shfile.h
r1213 r1214 25 25 */ 26 26 27 #ifndef ___shfile_h ___28 #define ___shfile_h ___27 #ifndef ___shfile_h 28 #define ___shfile_h 29 29 30 30 #include "shtypes.h" 31 31 #include <fcntl.h> 32 32 #include <sys/stat.h> 33 #ifdef _MSC_VER 34 # define _PATH_DEVNULL "nul" 35 # define _PATH_DEFPATH "." 36 #else 37 # if !defined(__sun__) 38 # include <paths.h> 39 # endif 40 # ifdef _PATH_DEVNULL 41 # define _PATH_DEVNULL "/dev/null" 42 # endif 43 # ifndef _PATH_DEFPATH 44 # define _PATH_DEFPATH "/bin:/usr/bin:/sbin:/usr/sbin" 45 # endif 46 #endif 33 47 #ifndef _MSC_VER 34 48 # include <sys/fcntl.h> … … 75 89 # define W_OK 2 76 90 # define R_OK 4 91 92 # define O_NONBLOCK 0 /// @todo 77 93 78 94 #endif … … 129 145 #endif 130 146 147 typedef struct sh_dirent 148 { 149 char name[260]; 150 } shdirent; 151 152 typedef struct shdir 153 { 154 shfdtab *shfdtab; 155 void *native; 156 shdirent ent; 157 } shdir; 158 159 shdir *shfile_opendir(shfdtab *, const char *); 160 shdirent *shfile_readdir(struct shdir *); 161 void shfile_closedir(struct shdir *); 162 131 163 #endif 132 164 -
trunk/src/kash/shinstance.h
r1213 r1214 33 33 # include <termios.h> 34 34 # include <sys/ioctl.h> 35 # include <sys/resource.h> 36 #endif 37 #include <errno.h> 38 #ifdef _MSC_VER 39 # define EWOULDBLOCK 512 35 40 #endif 36 41 … … 324 329 extern shinstance *sh_create_root_shell(shinstance *, int, char **); 325 330 char *sh_getenv(shinstance *, const char *); 331 const char *sh_gethomedir(shinstance *, const char *); 326 332 327 333 /* signals */ 328 334 typedef void (*sh_sig_t)(shinstance *, int); 329 335 #ifdef _MSC_VER 330 typedef uint32_t sh_sigset_t;336 typedef uint32_t sh_sigset_t; 331 337 #else 332 typedef sigset_t sh_sigset_t;338 typedef sigset_t sh_sigset_t; 333 339 #endif 334 340 struct sh_sigaction … … 341 347 #define SH_SIG_IGN ((sh_sig_t)SIG_IGN) 342 348 #ifdef _MSC_VER 343 # define SIG_BLOCK 1 344 # define SIG_UNBLOCK 2 345 # define SIG_SETMASK 3 346 # define SIGHUP 5 347 # define SIGQUIT 9 348 # define SIGPIPE 12 349 # define SIGTTOU 17 350 # define SIGTSTP 18 351 # define SIGTTIN 19 352 # define SIGCONT 20 349 # define SIG_BLOCK 1 350 # define SIG_UNBLOCK 2 351 # define SIG_SETMASK 3 352 # define SIGHUP 5 353 # define SIGQUIT 9 354 # define SIGPIPE 12 355 # define SIGTTOU 17 356 # define SIGTSTP 18 357 # define SIGTTIN 19 358 # define SIGCONT 20 359 extern const char * const sys_siglist[NSIG]; 353 360 #endif /* _MSC_VER */ 361 #ifdef __sun__ 362 # define sys_siglist _sys_siglist 363 #endif 354 364 355 365 int sh_sigaction(int, const struct sh_sigaction *, struct sh_sigaction *); 356 366 sh_sig_t sh_signal(shinstance *, int, sh_sig_t); 357 void sh_raise_sigint(shinstance *);367 int sh_siginterrupt(shinstance *, int, int); 358 368 void sh_sigemptyset(sh_sigset_t *); 359 369 int sh_sigprocmask(shinstance *, int, sh_sigset_t const *, sh_sigset_t *); 360 370 void sh_abort(shinstance *); 371 void sh_raise_sigint(shinstance *); 372 int sh_kill(shinstance *, pid_t, int); 373 int sh_killpg(shinstance *, pid_t, int); 361 374 362 375 /* times */ … … 371 384 } sh_tms; 372 385 #else 386 # include <sys/times.h> 373 387 # include <times.h> 374 388 typedef struct tms sh_tms; … … 400 414 # include <sys/wait.h> 401 415 #endif 416 pid_t sh_fork(shinstance *); 402 417 pid_t sh_waitpid(shinstance *, pid_t, int *, int); 403 418 void sh__exit(shinstance *, int); … … 411 426 pid_t sh_getpgid(shinstance *, pid_t); 412 427 int sh_setpgid(shinstance *, pid_t, pid_t); 413 int sh_kill(shinstance *, pid_t, int);414 int sh_killpg(shinstance *, pid_t, int);415 428 416 429 /* tc* */ … … 418 431 int sh_tcsetpgrp(shinstance *, int, pid_t); 419 432 420 #endif 433 /* sys/resourece.h */ 434 #ifdef _MSC_VER 435 typedef int64_t shrlim_t; 436 typedef struct shrlimit 437 { 438 shrlim_t rlim_cur; 439 shrlim_t rlim_max; 440 } shrlimit; 441 # define RLIMIT_CPU 0 442 # define RLIMIT_FSIZE 1 443 # define RLIMIT_DATA 2 444 # define RLIMIT_STACK 3 445 # define RLIMIT_CORE 4 446 # define RLIMIT_RSS 5 447 # define RLIMIT_MEMLOCK 6 448 # define RLIMIT_NPROC 7 449 # define RLIMIT_NOFILE 8 450 # define RLIMIT_SBSIZE 9 451 # define RLIMIT_VMEM 10 452 # define RLIM_NLIMITS 11 453 # define RLIM_INFINITY (0x7fffffffffffffffLL) 454 #else 455 typedef rlim_t shrlim_t; 456 typedef struct rlimit shrlimit; 457 #endif 458 int sh_getrlimit(shinstance *, int, shrlimit *); 459 int sh_setrlimit(shinstance *, int, const shrlimit *); 460 461 #endif -
trunk/src/kash/show.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: show.c,v 1.26 2003/11/14 10:46:13 dsl Exp $"); 43 #endif44 40 #endif /* not lint */ 41 #endif 45 42 46 43 #include <stdio.h> … … 54 51 #include "show.h" 55 52 #include "options.h" 53 #include "shinstance.h" 56 54 57 55 -
trunk/src/kash/show.h
r1199 r1214 32 32 */ 33 33 34 #ifndef ___show_h 35 #define ___show_h 36 34 37 #include <stdarg.h> 35 38 … … 44 47 void opentrace(struct shinstance *); 45 48 #endif 49 50 #endif -
trunk/src/kash/shtypes.h
r1207 r1214 77 77 typedef intptr_t ssize_t; 78 78 79 void * setmode(const char *p); 80 mode_t getmode(const void *bbox, mode_t omode); 81 79 82 #else 80 83 # include <stdint.h> -
trunk/src/kash/syntax.c
r809 r1214 1 1 /* $NetBSD: syntax.c,v 1.1 2004/01/17 17:38:12 dsl Exp $ */ 2 3 #ifdef __sun__4 #include <stdio.h>5 #include <iso/limits_iso.h>6 #endif7 2 8 3 #include "shell.h" 9 4 #include "syntax.h" 10 5 #include "parser.h" 6 #include "shinstance.h" 11 7 12 8 #ifdef _MSC_VER /* doesn't implement the fancy initializers I think... */ -
trunk/src/kash/trap.c
r1208 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; 41 38 #else 42 39 __RCSID("$NetBSD: trap.c,v 1.31 2005/01/11 19:38:57 christos Exp $"); 43 #endif44 40 #endif /* not lint */ 45 46 #include <signal.h> 47 #include <unistd.h> 41 #endif 42 48 43 #include <stdlib.h> 49 44 … … 112 107 #endif 113 108 for (i = 0; i < NSIG; ++i) 114 if (strcasecmp 109 if (strcasecmp(p, sys_signame[i]) == 0) 115 110 return i; 116 111 return -1; … … 246 241 */ 247 242 248 long 243 void 249 244 setsignal(shinstance *psh, int signo, int vforked) 250 245 { … … 297 292 * sigmode, so that we retry every time. 298 293 */ 299 return 0;294 return; 300 295 } 301 296 if (sigact == SH_SIG_IGN) { … … 310 305 } 311 306 if (tsig == S_HARD_IGN || tsig == action) 312 return 0;307 return; 313 308 switch (action) { 314 309 case S_DFL: sigact = SH_SIG_DFL; break; … … 318 313 if (!vforked) 319 314 *t = action; 320 s iginterrupt(signo, 1);321 return (long)sh_signal(psh, signo, sigact);315 sh_siginterrupt(psh, signo, 1); 316 sh_signal(psh, signo, sigact); 322 317 } 323 318 -
trunk/src/kash/trap.h
r881 r1214 39 39 int trapcmd(struct shinstance *, int, char **); 40 40 void clear_traps(struct shinstance *, int); 41 longsetsignal(struct shinstance *, int, int);41 void setsignal(struct shinstance *, int, int); 42 42 void ignoresig(struct shinstance *, int, int); 43 43 void onsig(struct shinstance *, int); -
trunk/src/kash/var.c
r1209 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; 41 38 #else 42 39 __RCSID("$NetBSD: var.c,v 1.36 2004/10/06 10:23:43 enami Exp $"); 43 #endif44 40 #endif /* not lint */ 45 46 #include <unistd.h> 41 #endif 42 47 43 #include <stddef.h> 48 44 #include <stdlib.h> 49 45 #include <strings.h> 50 #ifndef __sun__51 #include <paths.h>52 #else53 #define _PATH_DEFPATH "/usr/bin:/usr/sbin"54 #include <iso/limits_iso.h>55 #endif56 46 57 47 #ifdef PC_OS2_LIBPATHS … … 100 90 #include "show.h" 101 91 #ifndef SMALL 102 # include "myhistedit.h"92 # include "myhistedit.h" 103 93 #endif 104 94 #include "shinstance.h" -
trunk/src/kash/win/sys/resource.h
r1204 r1214 136 136 //int getpriority(int, /*int*/ id_t); /* bird: SuS uses id_t */ 137 137 int getrlimit(int, struct rlimit *); 138 int getrusage(int, struct rusage *);138 //int getrusage(int, struct rusage *); 139 139 //int setpriority(int, /*int*/ id_t, int); /* bird: SuS uses id_t */ 140 140 int setrlimit(int, const struct rlimit *);
Note:
See TracChangeset
for help on using the changeset viewer.