jcl

Linux Experts
  • Content Count

    1299
  • Joined

  • Last visited

Everything posted by jcl

  1. You can pipe the function as you would any utility, but if you only want to know whether NFS is mounted and don't care about the output of the function it might be easier to use 'return'. 'return' will cause the function to immediately return to its caller with a specifiable exit status; as usual $? can be used to access the exit status. For example check-nfs () { echo "checking" mount | grep 192.168.1 > /dev/null if [ "$?" = 0 ] then echo "NFS is mounted" return 0 else echo "NFS is not mounted" return 1 fi } which could be used lik
  2. Hmm. #1 is a valid complaint. #2 is more complex than it sounds (note the almost complete absence of binary patching on Freenix platforms) but I believe it's being addressed. #3 is trivial. #4 is gratuitous branding. #5 is valid but difficult to address as long as FF, TB, and Moz are seperate applications and Gecko is not seperately packaged (ponder how Windows users would handle that). #6 is trivial. #7 is almost trivial, if you want to brand FF just grab a source package and go to it. #8 is interesting. #9 is valid. #10 is sort of silly considering anyone can fork FF and take it in
  3. Yeah, I've been getting about a half-dozen a day for the last month or so. There's ongoing work to improve the popup blocker; I think the latest release or the next is supposed to be better. IIRC Macromedia also recently also made some adjustments to the Flash plugin to prevent people from using it to bypass the browser and spawn popups.
  4. For future reference some-command >/dev/null with redirect output to the bit bucket. Also, this seems to work if mount | grep 192.168.1 >/dev/null then # and so on if like me you're afraid of $?
  5. This expression type = cin.get() != "e" should probably be (type = cin.get()) != 'e' The parenthesis are necessary because = has lower precedence than !=, so the first form is identical to type = (cin.get() != 'e') the variable 'type' is assigned the value of the comparison (0 or 1). The single quotes are necessary because you want the character 'e' and not the string "e". In the first form you're comparing the character returned by get() to the address of the string literal "e". Also, get() returns an int rather than char, presumably because it can return traits::eof to signal EOF and the
  6. Heh, no thanks. I'm really enjoying this, I don't want to ruin it by making a job Anyway, did the board eat the rest of the post?
  7. Yup. If I'm reading the Single UNIX spec correctly, commands are looked up in the following places, in order: The list of special shell built-ins. The list of shell functions. The list of commands marked for special handling. The standard path lookup mechanism. Search the directories listed in PATH in order. The first match is used. The result is that shell functions should always override external utilities. Edit: This post was written before your edit
  8. That function is infinitely recursive: echo calls echo calls echo calls echo ad infinitum. The first one (rm) works because the shell doesn't care what commands exist in the environment; you define functions that alias utilities till your heart's content. I used to have a function called 'ls' that was defined as something like ls () { command ls -F $@; } It behaved just like the ls command except the -F option was always in effect. 'command' causes the shell to bypass any shell functions with the same name, avoiding the infinite recursion you probably hit. '$@' is the list of all the argume
  9. Conditionals don't create loops in the flow of control: the flow enters the conditional, possibly takes one of the branches, and then exits the conditional and continues on. Why they would be introduced as loops I cannot say. Where at the end?
  10. There aren't any loops in that code. Also, you should be using iostream instead of iostream.h. The latter is pre-ISO C++. And using 'exit' as a variable name when the exit() function is in scope is asking for trouble.
  11. You can always make it smaller but usually you shouldn't Looks fine.
  12. For future reference, the basic source character set, the character set available for use in source code, consists of the following characters: ABDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuzwxyz 0123456789 !"#%&'()*+,-./:;<=>?[\]^_{|}~ and space, and control characters for horizontal (\t) and vertical (\v) tabs, form feed (\f), and newline (\n). The basic execution character set, the character set that can be used at runtime e.g. for input, consists of all the source characters plus control characters for alert (\a), backspace (\, carriage return (\r), and the null character (value
  13. When you say you can't do anything do you mean you can't anything about the memory comsumption or do anything on the machine? The memory consumption itself isn't a problem unless its having a noticeable effect on performance.
  14. Nope, the function is all you need. For simple integer prompts this would suffice: int prompt(const string& s) { while (true) { int val; cout << s << flush; cin >> val; if (cin.fail()) { cerr << "invalid input"; cin.clear(); cin.ignore(); } else { return val; } } } usage: int val; while ((val = prompt("enter value: ")) != -1) { // etc }
  15. jcl

    Supa Compt

    Distributed computing. Fun thought: a 1Gbit/s Internet connection would be roughly as fast a SATA HDD. It could take less time to download new operating system images than to apply large patch sets to existing installations. If the network thoughput began to exceed HDD throughput you would quickly reach a point where it would be take less time to download the operating system at every boot than to load it off a drive.
  16. The one at the end of main() is force of habit; the first thing I write in main() is a return statement. It doesn't do anything in this case, but it doesn't hurt. The one in the else, on the other hand, is responsible for terminating the program when it receives a -1, so it has be there. (Or something has to be there anyway; it could replaced with some other transfer of control to break out of the while loop. Break or goto would work.) That's fine. Probably better, actually. I debated how to write the loop but decided that it would clearest if I made all the tests explicit. I don't real
  17. jcl

    Supa Compt

    Wait till you see Blue Gene/P and /Q. IBM is apparently aiming for an order-of-magnitude increase in theoretical performance within the next 3-5 years.
  18. jcl

    Supa Compt

    Blue Gene/L I presume. It's only half complete too.
  19. Right, the fail() member function will do the trick. $ cat t.cc #include <iostream> using namespace std; int main() { while (true) { int i; // Prompt cout << "val: "; // Flush cout to force prompt to be printed cout.flush(); cin >> i; if (cin.fail()) { cerr << "invalid input" << endl; // Clear failure/error flags cin.clear(); // Drop character that caused failure cin.ignore(); } else { if (i != -1) { cout &l
  20. Interesting post from Raymond Chen's blog about surreptitious overclocking and the (in)stability of Windows. Chen's on the Windows dev team at MS.
  21. There are spell check extensions for various browsers, e.g. SpellBound for Firefox/Mozilla and ieSpell for IE. Punctuation checking isn't possible in general.
  22. Indeed. I was just confirming that you meant the standard Win32 build and not e.g. a pure Cygwin build. You and iccaros seemed to be going around in circles on that point.
  23. Right, well, like I said I don't see why it would matter. The Win32 build processes doesn't appear to modify the Cygwin environment -- no files created or modified, etc -- so the fundamental problem with the CD isn't a problem in this case. That particular disc may not have all the required tools but you could always roll your own. I'd try it but I don't have VC++ and I really am quite sick of building Mozilla.
  24. You mean like this? I don't see why the CD would make any difference.